[FFmpeg-user] Fastest way to get keyframe indices from MOV files?

Stuart Bruce stuartrbruce at gmail.com
Mon Apr 23 19:41:50 EEST 2018


On 23 April 2018 at 15:28, Gyan Doshi <gyandoshi at gmail.com> wrote:

> On 4/23/2018 7:31 PM, Stuart Bruce wrote:
>
>>
>> In principle, should there be a faster way to just get the keyframe / I
>> frame numbers (or times), which doesn't require FFprobe to output over
>> 1500
>> lines of data per minute of video for parsing afterwards?
>>
>
> Using ffmpeg, you can run
>
>     ffmpeg -copyts -discard nokey -i Timecode.mov -vf showinfo -an -f null
> -
>
> The discard option sends only demuxer-flagged keyframes to the showinfo
> filter. Takes a lot fewer seconds. You can get PTS values; the frame index
> simply counts frames received by the filter, so not useful for your
> purposes.
>

Thank you Gyan for your very prompt response.

This is really very useful, thanks very much. On the same movie file it
takes under 2 seconds, compared to the 20-30 seconds to get FFprobe's
output. Although frame numbers would have been more relevant for this
particular use case, I can work with parsing the pts_time values from
FFmpeg's output and it does get the job done. Overall this is definitely a
better and quicker solution than what I was currently working with.


> Fastest way probably would be to use some other app which can dump data
> from inside the MOOV box/atom, specifically the track stss box.
>

I would still be interested to hear if anyone has recommendations for such
an app, though thanks to the above solution my particular need is no longer
nearly so pressing.

Thanks again

Stuart

-- 
Stuart Bruce - stuart at stuartbruce.co.uk - www.stuartbruce.co.uk


More information about the ffmpeg-user mailing list