Navigation Menu

Skip to content
Pedro Sánchez edited this page Apr 16, 2024 · 11 revisions

Welcome to the RootEncoder wiki!

What is RootEncoder?

RootEncoder (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin

How does this work?

This library get audio and video data, encode it in AAC, G711, OPUS, H264, H265 or AV1 and send it to RTSP, RTMP, SRT or UDP module to stream.

This library use MediaCodec Android class to do hardware encoding.

What is the different in the 5 builders base?

The different of this builders is the form that you get audio and video data to encode.

  • StreamBase (API 21+): This is the recommended way to use the library. This allow you to attach or remove a preview in realtime using a normal SurfaceView or TextureView as preview, support background stream and Activity rotation. Also, you can use differents video and audio sources with this base and change it on fly (Camera1, Camera2, Screen, Files, Microphone, Audio from the device) or even add your custom source!

  • Camera1Base (API 16+): Get audio data from microphone in PCM buffer and from camera API1 in NV21 frames.

  • FromFileBase (API 18+): Get audio data from a file decoding it in PCM data and render video decoded data in a MediaCodec inputsurface.

  • Camera2Base (API 21+): Get audio data from microphone in PCM buffer and from camera API2 rendering a MediaCodec inputsurface. This builder can be executed in background mode if you use a context in the constructor instead of a surfaceview.

  • DisplayBase (API 21+): Get audio data from microphone in PCM buffer and video data from device display with MediaProjection android class rendering a mediacodec inputsurface. This builder can be executed in background.