Reputation: 55
After searching for frames in a video that match an image, getting the following output
[Parsed_blackframe_1 @ 0x55a8513722c0] frame:884 pblack:99 pts:452608 t:35.360000 type:B last_keyframe:864
How to extract an image of a the last_keyframe
in the case above 864
?
How to get the timestamp of the last_keyframe
in the case above 864
?
Upvotes: 1
Views: 1594
Reputation: 5463
How to extract an image of a the last_keyframe in the case above 864?
ffmpeg -i input -vf select=eq(pict_type\,I)*gt(n\,864) -update 1 -vsync 0 last.png
select
filter keeps only the key(I) frames and(*) frames above #864-update 1
discards/overwrites the previous frame, so the final frame is saved-vsync 0
keeps encoder from unnecessarily making copies of the key frames to fill the timeHow to get the timestamp of the last_keyframe in the case above 864?
I don't know if there is a way to do this in FFmpeg, but with FFprobe you can run the following to get all the keyframe timestamps:
ffprobe -skip_frame nokey -select_streams v:0 -show_entries frame=pts_time
References:
Upvotes: 1