[Libav-user] Criteria for h.264 key-frame detection

Robert Krüger krueger at lesspain.de
Tue Oct 22 13:46:56 CEST 2013


On Tue, Oct 22, 2013 at 12:57 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Robert Krüger <krueger at ...> writes:
>
>> I just cut away everything from the file until the start
>> of the packet containing the 27th frame
>> (tail -c4329532 gh1_720p.mts > gh1_720p_cat.mts) and the
>> resulting file decodes without artifacts using ffmpeg.
>
> (With or without -flags2 showall?)
>
>> The number of decoded frames is also as expected. So I
>> think this is at least an indication that the 27th
>> frame is indeed a valid random access point.
>
> I don't think the fact that a frame can be decoded
> (correctly) implies that it is a random access point.

I thought that was the definition of it but more importantly for all
practical purposes (being able to create subclips, seeking) that's
what is typically the important thing but I agree that it takes more
knowledge than that to change ffmpeg code in a way that reliably
detects that (if possible at all). As I wrote earlier in this thread,
if this is not done in ffmpeg (I am not qualified to do that in the
h264 code), I will probably do that outside (parse h264 structures to
build an index of random access points, if necessary applying
heuristics that work for the files I am interested in).


More information about the Libav-user mailing list