[Ffmpeg-devel] Motion Jpeg to mpeg2
Thu Aug 11 16:52:18 CEST 2005
Behrbaum, Jeffrey S wrote:
> Hi again to all. I apologize but in my original email I didn't give enough
> information. The reason I can't use the ffmpeg command itself is because I
> need to have this capability within my program and I can't use the system
> command to kick off another executable. So I am trying to mimic the command
> "ffmpeg -i mypics%d.jpg -vcodec mpeg2video myvideo.mpg" So can someone tell
> me if my concept is correct? All I should need to do is pull in an unsigned
> char * which holds an individual jpeg, get that into an AVPicture* and then
> pass that into the img_convert and then onto the avcodec_encode_video function.
Does this unsigned char * point to
- a buffer containing the RGB image data, or
- an in-memory copy of the file?
Only the former will work. If that's not what you have, take a look at
libjpeg -- it'll read JPEGs from disk for you.
> 1) How do you get the jpeg buffer into an AVPicture
Well, if it's an image buffer with packed-pixel RGB data:
/* line size = number of pixels between the
start of two scanlines */
> 2) If avcodec_encode_video takes an AVFrame, is my AVPicture from img_convert automatically cast?
You should pass an AVFrame to avcodec_encode_video(), but you can pass
that AVFrame to img_convert() (AVPicture is a "base class" of AVFrame.)
See write_video_frame() in output_example.c.
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