Question

My hardware (video capture card) gives me the images in YV12 (YUV 420) format and I am trying to generate a video from it. I am using C++ under windows and I would like to generate a mpeg-4 VBR video from that stream but I dont know where I should start... (I need it to be VBR because it is a security camera and there will be a lot of repeated frames) Is there any library that does something like this?

Was it helpful?

Solution

ffmpeg will do this for you. Check out this part of the documentation where they talk about encoding raw YUV 420P frames. You can use ffmpeg's built-in mpeg 4 encoder, or it also allows you to interface with other libraries like xvid and x264.

The easiest way to handle this would be to just use the command line ffmpeg executable and just call it from your C++ program. Another option is to use libavformat and libavcodec (ffmpeg libraries). This will require more work, but give you more control over the process (for instance, if you need to do any processing of the video data).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top