java rtmp client_Skeaner/rtmp-rtsp-stream-client-java

这是一个Java库,用于实现RTMP和RTSP流媒体。支持Android API 16及以上,具备多种编码类型,如缓冲到缓冲、表面到缓冲。库中包含了RTMP/RTSP认证、音频降噪、回声消除等功能。可以记录MP4文件、切换摄像头、调整视频比特率,并支持硬件编码。提供了RTMPS和RTSPS,以及RTSP H265支持。通过示例代码展示了如何创建并启动RTMP和RTSP流。
摘要由CSDN通过智能技术生成

rtmp-rtsp-stream-client-java

Android%20Arsenal-rtmp%20rtsp%20stream%20client%20java-green.svg?style=true

rtmp-rtsp-stream-client-java.svg

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

If you need a player see this project:

Wiki

Permissions:

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.7'

}

Features:

Android min API 16.

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:

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();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值