0

I'm working on a c++ project that generates frames to be converted to a video later. The project currently dumps all frames as jpg or png files in a folder and then I run ffmpeg manually to generate a mp4 video file.

This project runs on a web server and an ios/android app (under development) will call this web server to have the video generated and downloaded.

The web service is pretty much done and working fine.

I don't like this approach for obvious reasons like a server dependency, cost etc... I successfully created a POC that exposes the frame generator lib to android and I got it to save the frames in a folder, my next step now is to convert it to video. I considered using any ffmpeg for android/ios lib and just call it when the frames are done.

Although it seems like I fixed half of the problem, I found a new one which is... each frame depending on the configuration could end up having 200kb+ in size, so depending on the amount of frames, it will take a lot of space from the user's device. I'm sure this will become a huge problem very easily.

So I believe that the ideal solution would be to generate the mp4 file on demand as each frame is created, so in the end there would be no storage space being taken as I woudn't need to save a file for the frame.

The problem is that I don't know how to do that, I don't know much about ffmpeg, I know it's open source but I have no idea how to include a reference to it from the frames generator and generate the video "on demand". I heard about libav as well but again, same problem...

I would really appreciate any sugestion on how to do it. What I need is basically a way to generate a mp4 video file given a list of frames.

thanks for any help!

user3900456
  • 2,003
  • 3
  • 25
  • 33
  • 2
    While reading OpenCV came out to my mind directly. – Yunus Temurlenk Jan 29 '20 at 06:08
  • Probably you could do that with OpenCV, it's one that came to my mind, too, but I would also suggest you looking into gstreamer. – Adrian Roman Jan 29 '20 at 09:50
  • Ffmpeg/libav/opencv/gstreamer, will all work. Asking for recommendations is off topic for stackoverflow, because everyone will give a different answer. (For example, I would use libav directly) – szatmary Jan 29 '20 at 16:00

0 Answers0