[Ffmpeg-devel] attribute_deprecated img_convert

Vlad GURDIGA gurdiga
Wed Mar 21 15:34:45 CET 2007

> avcodec_encode_video (the codec would be CODEC_ID_MJPEG). The output
> buffer can be written to file as such (ie, open/write/close).

I'm very sorry I'm asking so many questions, but I just do not now
enough to make id. As far as I can see, the only argument of the
avcodec_encode_video() the has a "codec_id" member si AVCodecContext,
wich is the source codec context and it seems to me unproper to change
to CODEC_ID_MJPEG. I'll try to explain how I'm doing right now and you
show me the place where is wrong and how it should be to get that JPEG

Here roughly is how I do now to capture X frames to PPM files (of
course it is not the format I need, but I followed a tutorial a hoped
I'l find a way to convert PPM to JPEG):

... here I get an AVCodecContext ...
... find the first video stream from the AVCodecContext ...
avcodec_find_decoder(); // I do not know the type of video until runtime
... here I get the AVCodec ...
avcodec_alloc_frame(); // here I get a pointer to a prepared memory block

loop to read packets
   av_read_frame(); // here I get the AVPachet
   ... now I get the AVFrame (in the second OUT argument) ...
   avpicture_alloc(); // here I ged a memory block to store AVPicture
   img_convert(); //here I get the AVPicture (PPM) data from AVFrame
   // now I write a header and binary data in a file to disk
end loop

I use all these functions from C# (if it matters).
Thanks a lot!

More information about the ffmpeg-devel mailing list