Git Product home page Git Product logo

rtmp-rtsp-stream-client-java's Introduction

rtmp-rtsp-stream-client-java

Android Arsenal Release

Library for stream in RTMP and RTSP. All code in Java.

If you need a player see this project:

https://github.com/pedroSG94/vlc-example-streamplayer

Wiki

https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/wiki

Permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--Optional for play store-->
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

Compile

To use this library in your project with gradle add this to your build.gradle:

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:1.9.4'
}

Features:

  • Android min API 16.
  • Support camera1 and camera2 API
  • Encoder type buffer to buffer.
  • Encoder type surface to buffer.
  • RTMP/RTSP auth.
  • Audio noise suppressor.
  • Audio echo cancellation.
  • Disable/Enable video and audio while streaming.
  • Switch camera while streaming.
  • Change video bitrate while streaming (API 19+).
  • Get upload bandwidth used.
  • Record MP4 file while streaming (API 18+).
  • H264, H265 and AAC hardware encoding.
  • Force H264 and AAC Codec hardware/software encoding (Not recommended).
  • RTSP TCP/UDP.
  • Stream from video and audio files like mp4, webm, mp3, etc (Limited by device decoders). More info
  • Stream device display (API 21+).
  • Set Image, Gif or Text to stream on real time.
  • OpenGL real time filters. More info
  • RTMPS and RTSPS.
  • RTSP H265 support (Waiting FLV official packetization to add RTMP support).

Other related projects:

https://github.com/pedroSG94/RTSP-Server

https://github.com/pedroSG94/AndroidReStreamer

https://github.com/pedroSG94/Stream-USB-test

Use example:

This code is a basic example. I recommend you go to Activities in app module and see all examples.

RTMP:

//default

//create builder
RtmpCamera1 rtmpCamera1 = new RtmpCamera1(openGlView, connectCheckerRtmp);
//start stream
if (rtmpCamera1.prepareAudio() && rtmpCamera1.prepareVideo()) {
  rtmpCamera1.startStream("rtmp://yourEndPoint");
} else {
 /**This device cant init encoders, this could be for 2 reasons: The encoder selected doesnt support any configuration setted or your device hasnt a H264 or AAC encoder (in this case you can see log error valid encoder not found)*/
}
//stop stream
rtmpCamera1.stopStream();

//with params

//create builder
RtmpCamera1 rtmpCamera1 = new RtmpCamera1(openGlView, connectCheckerRtmp);
//start stream
if (rtmpCamera1.prepareAudio(int bitrate, int sampleRate, boolean isStereo, boolean echoCanceler,
      boolean noiseSuppressor) && rtmpCamera1.prepareVideo(int width, int height, int fps, int bitrate, int rotation)) {
  rtmpCamera1.startStream("rtmp://yourEndPoint");
} else {
 /**This device cant init encoders, this could be for 2 reasons: The encoder selected doesnt support any configuration setted or your device hasnt a H264 or AAC encoder (in this case you can see log error valid encoder not found)*/
}
//stop stream
rtmpCamera1.stopStream();

RTSP:

//default

//create builder
//by default TCP protocol.
RtspCamera1 rtspCamera1 = new RtspCamera1(openGlView, connectCheckerRtsp);
//start stream
if (rtspCamera1.prepareAudio() && rtspCamera1.prepareVideo()) {
  rtspCamera1.startStream("rtsp://yourEndPoint");
} else {
 /**This device cant init encoders, this could be for 2 reasons: The encoder selected doesnt support any configuration setted or your device hasnt a H264 or AAC encoder (in this case you can see log error valid encoder not found)*/
}
//stop stream
rtspCamera1.stopStream();

//with params

//create builder
RtspCamera1 rtspCamera1 = new RtspCamera1(openGlView, connectCheckerRtsp);
rtspCamera1.setProtocol(protocol);
//start stream
if (rtspCamera1.prepareAudio(int bitrate, int sampleRate, boolean isStereo, boolean echoCanceler,
      boolean noiseSuppressor) && rtspCamera1.prepareVideo(int width, int height, int fps, int bitrate, int rotation)) {
  rtspCamera1.startStream("rtsp://yourEndPoint");
} else {
 /**This device cant init encoders, this could be for 2 reasons: The encoder selected doesnt support any configuration setted or your device hasnt a H264 or AAC encoder (in this case you can see log error valid encoder not found)*/
}
//stop stream
rtspCamera1.stopStream();

rtmp-rtsp-stream-client-java's People

Contributors

pedrosg94 avatar marcin-adamczewski avatar hbergqvist avatar nodinosaur avatar troy-lamerton avatar adderly avatar svprdga avatar mikemannox avatar tbeyou avatar fruchtzwerg94 avatar obsidiansnoo avatar dsteve595 avatar hirogakatageri avatar gustavoggs avatar saurik avatar madmate avatar sammy44nts avatar ssabae avatar exxkx avatar ekslv avatar b95505017 avatar gizm090 avatar marinesco avatar miwaniec avatar mkrn avatar pascalbaljet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.