[Libav-user] any way to interrupt avcodec_decode_video2 ?

Don Moir donmoir at comcast.net
Wed Jan 1 22:26:47 CET 2014

----- Original Message ----- 
From: "Carl Eugen Hoyos" <cehoyos at ag.or.at>
To: <libav-user at ffmpeg.org>
Sent: Wednesday, January 01, 2014 3:01 PM
Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ?

> Don Moir <donmoir at ...> writes:
>> >> A simple seek to zero is quick, but if I have to wait on
>> >> avcodec_decode_video2 to return, then its slower and can
>> >> be quite slow.
>> >
>> > Yes, this is exactly what CODEC_FLAG2_SHOW_ALL is for.
>> CODEC_FLAG2_SHOW_ALL ///< Show all frames before the first
>> keyframe
>> So show garbage? What does that have to do with how fast
>> avcodec_decode_video2 returns?
> From a purely technical point-of-view, one could probably
> argue that CODEC_FLAG2_SHOW_ALL only affects how fast
> avcodec_decode_video2() returns.

Checked and CODEC_FLAG2_SHOW_ALL doesn't seem to have any effect at all on return speed. Checked with some H264 files. I am not sure 
what it does anymore. Way back I believe every call to avcodec_decode_video2 returned a finished frame when using 
CODEC_FLAG2_SHOW_ALL on every call even if garbage. Not so now and not sure if it had any effect because don't seem to get  garbage 
and don't get finished frame on every call.

> Once you have verified this solves the performance problem
> you see (remember that as explained on irc, nobody understands
> your reports),

Sometimes I try to give you the benefit of knowing something and sometimes I may not be able to communicate via text well. In this 
case orignally I used the word finish and realize I should not have but others did understand.

> you can worry about the "garbage": Either it
> is possible to call the decode function as often as necessary
> (I am not sure) or it will be trivial to add such a return
> flag compared to the callback you suggest.


> I agree with you that multi-threading may not help in your
> use case because of its large overhead.
> Carl Eugen

More information about the Libav-user mailing list