Fastest way to get keyframe indices from MOV files?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fastest way to get keyframe indices from MOV files?

Stuart Bruce
Indirectly related to my previous enquiry...

Programatically I want to use FFprobe get a list of the frame numbers
(numbers preferred, times if necessary) of keyframes (I frames without the
P frames) in a MOV file.

At present I'm using the arguments:

-select_streams v -show_frames "M:\ProcessTests\Timecode.mov" -of csv
-show_entries frame=pkt_pts_time,pict_type

but for this 30-minute video (available at
http://www.twentypenguins.co.uk/misc/ffpmeg_tests/Timecode.mov  ), that
process is taking around 20-30 seconds to provide the lengthy result of
approximately 45,000 CSV lines of frame info, which I then parse in my
Windows app to find the line indices of every frame with an 'I' at the end.

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?

Thanks

Stuart

--
Stuart Bruce - [hidden email] - www.stuartbruce.co.uk
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Fastest way to get keyframe indices from MOV files?

Gyan Doshi


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.

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.


Regards,
Gyan
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Fastest way to get keyframe indices from MOV files?

Stuart Bruce
On 23 April 2018 at 15:28, Gyan Doshi <[hidden email]> 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 - [hidden email] - www.stuartbruce.co.uk
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".