[Libav-user] Save frame to jpg with data from avcodec_decode_video2

Alex Cohn alexcohn at netvision.net.il
Tue Jun 26 12:59:24 CEST 2012

On Tue, Jun 26, 2012 at 12:00 PM, Camera Man
<i.like.privacy.too at gmail.com> wrote:
> On 06/26/2012 04:13 AM, Alex Cohn wrote:
>> On Tue, Jun 26, 2012 at 9:18 AM, Simon Daniels <simondaniels23 at gmail.com>
>> wrote:
>>> I don't want to use the ffmpeg command-line to save out the frames
>>> because
>>> for some reason the frame counts are not matching. Ffmpeg.exe saves more
>>> frame jpegs than avcodec_decode_video2 seems to find.See an old thread
>> http://libav-users.943685.n4.nabble.com/Save-AVFrame-to-jpg-file-td2314979.html
> I've been using that code successfully. I've done a git pull recently, and
> noticed that the encoders (including mjpegs) are now frame/slice multithread
> capable. Does this mean it's possible that the return from
> avcodec_encode_video2 is somehow pipelined for mjpeg?
> That is, when calling avcodec_decode_video2(), you put in a packet, you get
> a frame, but the frame might be related to an earlier packet (either because
> of I/P/B/reference frame reordering, or because of a multithreaded decoder).
> Is it possible that when calling avcodec_encode_video2() for mjpeg, you will
> receive an encoded packet which is related to an earlier frame because of
> the new multithreading infrastructure?

To the best of my knowledge, with multithreading you are still
expected to receive results in correct order, but the delay may be

Alex Cohn

More information about the Libav-user mailing list