Reputation: 77
How can I retrieve each keyframe information from the video using ffmpeg/ffprobe.
I have read a lot stackoverflow questions and answers regarding this but the command only returns the keyframe duration.
I have used this command to extract the keyframe duration
ffprobe -loglevel error -skip_frame nokey -select_streams v:0 -show_entries frame=pkt_pts_time -of csv "/var/www/html/YoutubeTesting/1080p.mp4"
But the info which I need from each keyframe are
1- Byte offset from video byte size
2- Duration of keyframe
Thanks!
Upvotes: 1
Views: 5273
Reputation: 357
You can get the keyframe offset byte and also the frame number with the below command.
ffprobe -skip_frame nokey -select_streams v:0 -count_frames -show_entries frame=pkt_pos,best_effort_timestamp_time -of csv INPUT
Upvotes: 2
Reputation: 77
Just found myself to extract all info regarding the keygrames. It will be useful for someone.
Just add the -skip_frame nokey to the command for example
ffprobe -select_streams v -skip_frame nokey -show_frames -v quiet video.mp4
It will show the info for the keyframes, the info will contain time, duration, offset bytes etc.
Upvotes: 1
Reputation: 92928
Use
ffprobe -loglevel error -skip_frame nokey -select_streams v:0 -show_entries frame=pkt_duration_time,pkt_pos -of csv "video.mp4"
Upvotes: 2