Ali Hasan
Ali Hasan

Reputation: 77

Extract keyframe info and byte offset from video ffmpeg/ffprobe

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

Answers (3)

geo-freak
geo-freak

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

Ali Hasan
Ali Hasan

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

Gyan
Gyan

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

Related Questions