Encoding graphics into an mpeg stream
looking for an example of how to programatically encode a frame-buffer into an mpeg stream. I need this to experiment with some mp开发者_C百科eg encoders, to see how different patterns compress.
I have a slight inclination towards Windows, although if linux gives some advantage it is not a problem.
Assuming that you can turn your frame-buffer into a series of image files, you could convert them to mpeg video using ffmpeg:
From the docs:
For creating a video from many images:
ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
The syntax
"foo-%03d.jpeg"
specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the Cprintf
function, but only formats accepting a normal integer are suitable.
You'd want something like:
ffmpeg -f image2 -i in-%d.jpg out.mpg
for an mpeg stream.
精彩评论