Skip to content
Pedro Sánchez edited this page Sep 8, 2023 · 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 and SRT with all code written in Java/Kotlin

How does this work?

This library get audio and video data, encode it in AAC and H264 respectively and send it to rtsp or rtmp module to stream.

In rtsp module create a RTP packets of video and audio and send to server. In rtmp module create a RTP packets of video and audio, encapsulate it in flv packets and send to server.

This library use MediaCodec Android class to do hardware encoding.

What is the different in the 4 builders base?

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

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