[Ffmpeg-devel] Motion Jpeg to mpeg2

Martin Boehme boehme
Wed Aug 10 09:31:37 CEST 2005

Behrbaum, Jeffrey S wrote:
> Hi all. I'm trying to take a bunch of jpeg's (not jfif's) and put them into
> an mpeg2 stream My question is how do you do this.

If this is really all you want to do, you don't have to write your own 
program... just do

ffmpeg -i mypics%d.jpg -vcodec mpeg2video myvideo.mpg

(assuming your JPEGs are called mypics1.jpg, mypics2.jpg...)

> I have everything setup
> but am having trouble figuring out exactly what to do with the images I have.
> There is a segment of ffmpeg sample code where a dummy frame is being set up,
> see below (from apiexample.c line 235)  Now, I have a mono color jpeg (see
> attached if you'd like) and I'm not sure what to do with it before passing
> it into avcodec_encode_video.

You don't say what you're using to read the JPEG into memory, but if 
it's libjpeg or similar, you probably have that JPEG in RGB format, so 
you'll have to convert it to planar YUV using img_convert().

There's a sample program in an article I wrote


that does the reverse conversion (i.e. YUV-to-RGB)... hope you'll be 
able to figure it out from there.


Martin B?hme
Inst. f. Neuro- and Bioinformatics
Ratzeburger Allee 160, D-23538 Luebeck
Phone: +49 451 500 5514
Fax:   +49 451 500 5502
boehme at inb.uni-luebeck.de

More information about the ffmpeg-devel mailing list