Convert Figma logo to code with AI

pedroSG94 logoRootEncoder

RootEncoder for Android (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

2,522
768
2,522
79

Top Related Projects

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.

32,488

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

FFmpeg libav tutorial - learn how media works from basic to transmuxing, transcoding and more. Translations: πŸ‡ΊπŸ‡Έ πŸ‡¨πŸ‡³ πŸ‡°πŸ‡· πŸ‡ͺπŸ‡Έ πŸ‡»πŸ‡³ πŸ‡§πŸ‡·

45,445

Mirror of https://git.ffmpeg.org/ffmpeg.git

21,714

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media

πŸ“Έ A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.

Quick Overview

The RootEncoder project is a Java library that provides a simple and efficient way to encode and decode data using the Root encoding algorithm. This algorithm is particularly useful for applications that require compact data representation, such as in the field of data compression or embedded systems.

Pros

  • Efficient Encoding: The Root encoding algorithm used in this library is known for its ability to produce compact representations of data, making it suitable for applications with limited storage or bandwidth.
  • Ease of Use: The library provides a straightforward API that allows developers to easily integrate the encoding and decoding functionality into their projects.
  • Cross-Platform Compatibility: The Java-based implementation of the library ensures that it can be used across various platforms and operating systems.
  • Actively Maintained: The project is actively maintained, with regular updates and bug fixes, ensuring its continued reliability and functionality.

Cons

  • Limited Documentation: The project's documentation could be more comprehensive, which may make it challenging for new users to get started with the library.
  • Specific Use Case: The Root encoding algorithm is primarily useful for specific applications, such as data compression or embedded systems, and may not be the best choice for general-purpose encoding tasks.
  • Performance Overhead: While the library is efficient, the encoding and decoding process may still introduce some performance overhead, which could be a concern for time-critical applications.
  • Lack of Community Support: The project does not have a large user community, which may limit the availability of resources and support for developers.

Code Examples

Here are a few examples of how to use the RootEncoder library:

// Encoding data
byte[] data = "Hello, World!".getBytes();
byte[] encodedData = RootEncoder.encode(data);
System.out.println(Arrays.toString(encodedData));

This code demonstrates how to encode a string of text using the RootEncoder.encode() method.

// Decoding data
byte[] decodedData = RootEncoder.decode(encodedData);
System.out.println(new String(decodedData));

This code shows how to decode the previously encoded data using the RootEncoder.decode() method.

// Encoding data with custom parameters
RootEncoderConfig config = new RootEncoderConfig.Builder()
    .withMaxValue(127)
    .withMinValue(-128)
    .build();
byte[] encodedData = RootEncoder.encode(data, config);

This example demonstrates how to customize the encoding parameters using the RootEncoderConfig class.

Getting Started

To use the RootEncoder library in your Java project, follow these steps:

  1. Add the library as a dependency in your project's build configuration. For example, if you're using Maven, add the following dependency to your pom.xml file:
<dependency>
    <groupId>com.github.pedroSG94</groupId>
    <artifactId>RootEncoder</artifactId>
    <version>1.0.0</version>
</dependency>
  1. Import the necessary classes from the com.github.pedroSG94.rootencoder package in your Java code:
import com.github.pedroSG94.rootencoder.RootEncoder;
import com.github.pedroSG94.rootencoder.RootEncoderConfig;
  1. Use the RootEncoder class to encode and decode data, as shown in the code examples above.

  2. Optionally, you can customize the encoding parameters by creating a RootEncoderConfig instance and passing it to the RootEncoder.encode() method.

That's it! You can now start using the RootEncoder library in your Java projects.

Competitor Comparisons

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.

Pros of mobile-ffmpeg

  • Comprehensive FFmpeg support for mobile platforms
  • Wide range of audio/video codecs and filters
  • Active development and regular updates

Cons of mobile-ffmpeg

  • Larger library size due to extensive feature set
  • More complex integration process
  • Higher learning curve for beginners

Code Comparison

RootEncoder:

val encoder = MediaEncoder(surface, width, height)
encoder.setVideoCallback { buffer, info ->
    // Handle encoded video data
}
encoder.start()

mobile-ffmpeg:

let command = "-i input.mp4 -c:v libx264 -preset fast output.mp4"
FFmpeg.execute(command) { result in
    // Handle FFmpeg execution result
}

Key Differences

RootEncoder focuses on simplifying Android media encoding, while mobile-ffmpeg provides a more comprehensive FFmpeg toolkit for mobile platforms. RootEncoder offers a streamlined API for basic encoding tasks, whereas mobile-ffmpeg provides access to the full range of FFmpeg capabilities, including complex filtering and transcoding options.

RootEncoder is better suited for projects requiring straightforward media encoding on Android, while mobile-ffmpeg is ideal for applications needing advanced audio/video processing across multiple mobile platforms.

32,488

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

Pros of ijkplayer

  • More comprehensive multimedia player with support for various formats and protocols
  • Mature project with a larger community and extensive documentation
  • Cross-platform support (iOS, Android, and more)

Cons of ijkplayer

  • Larger codebase and more complex to integrate
  • Potentially higher resource usage due to its full-featured nature
  • May require more frequent updates to maintain compatibility with different platforms

Code Comparison

RootEncoder (Java):

rtmpCamera1 = new RtmpCamera1(openGlView, connectCheckerRtmp);
rtmpCamera1.setReTries(10);
rtmpCamera1.startStream("rtmp://your_server/live/stream_name");

ijkplayer (Java):

IjkMediaPlayer player = new IjkMediaPlayer();
player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 0);
player.setDataSource("rtmp://your_server/live/stream_name");
player.prepareAsync();

Summary

RootEncoder is a lightweight RTMP streaming library focused on Android, while ijkplayer is a more comprehensive multimedia player with broader platform support. RootEncoder may be easier to integrate for simple RTMP streaming needs, while ijkplayer offers more features but with increased complexity. The choice between the two depends on the specific requirements of your project, such as platform support, streaming protocols, and desired features.

FFmpeg libav tutorial - learn how media works from basic to transmuxing, transcoding and more. Translations: πŸ‡ΊπŸ‡Έ πŸ‡¨πŸ‡³ πŸ‡°πŸ‡· πŸ‡ͺπŸ‡Έ πŸ‡»πŸ‡³ πŸ‡§πŸ‡·

Pros of ffmpeg-libav-tutorial

  • Comprehensive tutorial on FFmpeg and libav libraries
  • Focuses on educational content and in-depth explanations
  • Covers a wide range of multimedia processing concepts

Cons of ffmpeg-libav-tutorial

  • Not a ready-to-use library or framework
  • Requires more effort to implement in practical projects
  • May be overwhelming for beginners looking for quick solutions

Code Comparison

ffmpeg-libav-tutorial (C code example):

AVFormatContext *input_format_context = NULL;
int ret = avformat_open_input(&input_format_context, input_file, NULL, NULL);
if (ret < 0) {
    fprintf(stderr, "Could not open input file '%s'", input_file);
    return ret;
}

RootEncoder (Kotlin code example):

val encoder = MediaEncoder(surface, width, height)
encoder.setVideoCallback { byteBuffer, _ ->
    // Handle encoded video data
}
encoder.start()

Summary

ffmpeg-libav-tutorial is an educational resource that provides in-depth knowledge about FFmpeg and libav libraries, making it ideal for those who want to understand multimedia processing at a lower level. However, it requires more effort to implement in practical projects.

RootEncoder, on the other hand, is a ready-to-use library for Android that simplifies video and audio encoding tasks. It offers a more straightforward implementation for developers who need quick solutions for multimedia encoding in their Android applications.

The choice between these repositories depends on the user's needs: deep understanding and flexibility (ffmpeg-libav-tutorial) versus ease of use and quick implementation (RootEncoder).

45,445

Mirror of https://git.ffmpeg.org/ffmpeg.git

Pros of FFmpeg

  • Extensive feature set covering a wide range of multimedia processing tasks
  • Highly optimized and efficient performance for various codecs and formats
  • Large community support and regular updates

Cons of FFmpeg

  • Complex command-line interface with a steep learning curve
  • Large codebase and dependencies, which can be challenging to integrate into mobile apps

Code Comparison

FFmpeg (command-line usage):

ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 22 -c:a copy output.mp4

RootEncoder (Java code snippet):

RtmpCamera1 rtmpCamera1 = new RtmpCamera1(openGlView, connectCheckerRtmp);
rtmpCamera1.startStream("rtmp://your_server/live/stream_key");

Summary

FFmpeg is a powerful and versatile multimedia framework with broad capabilities, while RootEncoder focuses on real-time video encoding and streaming for Android. FFmpeg offers more extensive features but has a steeper learning curve, whereas RootEncoder provides a simpler API for specific use cases in mobile development. The choice between them depends on the project requirements and target platform.

21,714

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media

Pros of ExoPlayer

  • More comprehensive media playback solution with support for various formats and streaming protocols
  • Backed by Google, ensuring regular updates and extensive documentation
  • Larger community and ecosystem, providing more resources and third-party extensions

Cons of ExoPlayer

  • Larger library size, which may increase app size and complexity
  • Steeper learning curve due to its extensive feature set
  • Primarily focused on playback, with limited encoding capabilities compared to RootEncoder

Code Comparison

RootEncoder (encoding example):

val encoder = MediaEncoder(surface, width, height)
encoder.setVideoCallback { buffer, info ->
    // Handle encoded video data
}
encoder.start()

ExoPlayer (playback example):

val player = SimpleExoPlayer.Builder(context).build()
val mediaItem = MediaItem.fromUri(videoUri)
player.setMediaItem(mediaItem)
player.prepare()
player.play()

Summary

ExoPlayer is a more robust solution for media playback, offering extensive features and broad format support. RootEncoder, on the other hand, focuses on encoding capabilities, making it more suitable for applications that require video encoding functionality. The choice between the two depends on the specific requirements of your project, with ExoPlayer being better for playback-centric applications and RootEncoder for encoding-focused tasks.

πŸ“Έ A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.

Pros of CameraView

  • More comprehensive camera functionality, including advanced features like real-time filters and overlays
  • Better documentation and extensive wiki for easier implementation
  • Actively maintained with frequent updates and bug fixes

Cons of CameraView

  • Larger library size, which may impact app size and performance
  • Steeper learning curve due to more complex API and features
  • May be overkill for simple camera implementations

Code Comparison

CameraView:

cameraView.setLifecycleOwner(this)
cameraView.addCameraListener(object : CameraListener() {
    override fun onPictureTaken(result: PictureResult) {
        // Handle the captured image
    }
})

RootEncoder:

rtmpCamera1.startPreview()
rtmpCamera1.startStream("rtmp://your_server")
rtmpCamera1.stopStream()

Summary

CameraView offers a more feature-rich camera solution with better documentation and maintenance, but comes with a larger footprint and complexity. RootEncoder focuses primarily on RTMP streaming and encoding, providing a simpler API for specific use cases. Choose CameraView for comprehensive camera functionality or RootEncoder for lightweight RTMP streaming implementations.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

RootEncoder for Android

Android Arsenal Release Documentation

Sponsored with Γ°ΒŸΒ’Β– Β  by
Stream Chat
Enterprise Grade APIs for Feeds & Chat. Try the Android Chat tutorial Γ°ΒŸΒ’Β¬


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

Note: The library was renamed from rtmp-rtsp-stream-client-java to RootEncoder after add SRT protocol because the name has no sense anymore

iOS version (under develop):

https://github.com/pedroSG94/RootEncoder-iOS

Wiki

https://github.com/pedroSG94/RootEncoder/wiki

Permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />

Compile

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

Last version
allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  implementation 'com.github.pedroSG94.RootEncoder:library:2.5.0'
}

Old versions (2.2.6 or less)
allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  implementation 'com.github.pedroSG94.RootEncoder:rtplibrary:2.2.6'
}

Features:

  • Android min API 16.

Encoder:

  • Support camera1 and camera2 API
  • Encoder type buffer to buffer.
  • Encoder type surface to buffer.
  • Audio noise suppressor.
  • Audio echo cancellation.
  • Disable/Enable video and audio while streaming.
  • Switch camera while streaming.
  • Change video bitrate while streaming (API 19+).
  • AV1, H264, H265, G711, AAC and OPUS hardware/software encoding.
  • Force video and audio Codec to use hardware/software encoding (Not recommended).
  • Record MP4 file while streaming (API 18+).
  • Set Image, Gif or Text to stream on real time.
  • OpenGL real time filters. More info
  • Stream from video and audio files like mp4, webm, mp3, etc (Limited by device decoders). More info
  • Stream device screen (API 21+).

RTMP:

  • Get upload bandwidth used.
  • RTSP auth (adobe and llnw).
  • AV1, H265 (Using RTMP enhanced), H264, AAC and G711 support.
  • RTMPS (under TLS)
  • RTMPT and RTMPTS (tunneled and tunneled under TLS)
  • AMF0
  • AMF3

RTSP:

  • Get upload bandwidth used.
  • RTMP auth (basic and digest).
  • AV1, H264, H265, AAC, G711 and OPUS support.
  • TCP/UDP.
  • RTSPS.

SRT (beta):

  • Get upload bandwidth used.
  • H264, H265, AAC and OPUS support.
  • Resend lost packets
  • Encrypt (AES128, AES192 and AES256)
  • SRT auth.

https://haivision.github.io/srt-rfc/draft-sharabayko-srt.html

UDP (beta):

  • Get upload bandwidth used.
  • H264, H265, AAC and OPUS support.
  • Unicast, Multicast and Broadcast support.
  • MPEG2-TS support.

Other related projects:

https://github.com/pedroSG94/RTSP-Server Support UVC camera (use rotation example and change the video source on fly using the menu): https://github.com/pedroSG94/RootEncoder/tree/feature/usb-camera

3rd party projects:

Projects related with the library developed by other users. Contact with user owner if you have any problem or question.

https://github.com/FunnyDevs/rtmp-rtsp-stream-client-java-recordcontrollers

Real time filters:

NOTE:

In library version 2.0.9, the filters was refactored. Check the wiki link to migrate your implementation.

https://github.com/pedroSG94/RootEncoder/wiki/Real-time-filters

Looking for sponsors

This library need sponsors to get new devices or pay platforms to test and debug errors. Any donation or sponsor is welcome! If you are interested. You can contact me by email or donate directly on Github or Paypal Thank you!

Use examples:

Rotation example

This is the recommend way to use the library. This example support screen rotation, stream orientation (vertical, horizontal) filters and change video/audio sources on fly: https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/rotation

Screen example

Example to stream using Screen as video source using a service to stream in background: https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/screen

From file example

Code example to stream using a video file as video/audio source: https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/file

Old Api example

Code example for low API devices (Android API 16+): https://github.com/pedroSG94/RootEncoder/tree/master/app/src/main/java/com/pedro/streamer/oldapi