Open uripont opened 1 month ago
@uripont did you able to come with solution. I have similar usecase :D
Unfortunately no, we haven't found any solution to this issue.
But we have found an alternative way to fulfill our needs: instead of encoding a video ourselves frame by frame, we end up re-encoding an already recorded video to achieve the same result.
Title: Challenges with Raw Image Streaming to FFmpeg in React Native Application
Description:
Goal
We aim to implement a solution for capturing and encoding video directly within a React Native application. The objective is to stream raw image data directly into an FFmpeg process for continuous video encoding, ensuring minimal storage overhead and efficient processing.
Problem
Pipe Auto Closes with PNGs: When attempting to stream PNG images to the FFmpeg process, the pipe auto-closes after each image is passed. This behavior disrupts the continuous encoding process, resulting in incomplete video streams.
Inability to Pass Base64 Raw Images: In our current implementation we attempted to pass as base64 encoded raw images. However, the FFmpeg process expects a file path rather than raw data when passing it with
FFmpegKitConfig.writeToPipe()
, making it impossible to feed the images directly into the encoder. This limits our ability to keep the encoding process active until explicitly closed.The ideal solution involves continuously streaming raw image data directly to FFmpeg without the need for intermediate storage. This would involve:
Challenges
We seek guidance on:
Environment:
Expected Behavior: Continuous streaming of raw image data to FFmpeg, allowing seamless video encoding until the process is manually terminated.
Actual Behavior: Pipes auto-close after each PNG frame, and raw image data cannot be directly passed due to file path requirements.
Any advice or solutions to address these issues would be greatly appreciated. Thank you!