1

I have confused one thing for Video Frame extraction.

I have sample.mp4 video, 15FPS.

I tried extracting Keyframe with FFMPEG.

ffmpeg -skip_frame nokey -i sample.mp4 -vsync 0 -frame_pts true out%d.png

I get 29 Pictures and I believe I have got 29 I frames. (If I have wrong, Please correct me)

Then I tried extracting specific timeline(10 sec) frame with picture

ffmpeg -i sample.mp4 -ss 00:00:10 -frames:v 1 test1.png

This output picture, I can not find same one among my Keyframes I get.

Question: test1.png, What is frame type? Does it one of P or B frame not I?

llogan
  • 121,796
  • 28
  • 232
  • 243
SY Moon
  • 121
  • 1
  • 10

1 Answers1

0

I get 29 Pictures and I believe I have got 29 I frames. (If I have wrong, Please correct me)

Correct. See Checking keyframe interval? to verify.

Question: test1.png, What is frame type? Does it one of P or B frame not I ?

Use ffprobe:

ffprobe -select_streams v -show_entries "frame=pkt_pts_time,pict_type" -of csv input.mp4

Example output:

frame,9.968000,B
frame,10.010000,B <---
frame,10.052000,P

Note that in this example -ss 00:00:10 rounded up to the nearest frame (10.010000). This is a B-frame in this example (input.mp4).

llogan
  • 121,796
  • 28
  • 232
  • 243
  • Thank you. I can get "frame,10.000000,P". It was "P" frame for my sampe.mp4. – SY Moon Apr 13 '21 at 06:34
  • Can I have one more question? With this ffprobe command,"ffprobe -v error -show_entries frame=pict_type,pkt_pts_time -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 sample.mp4 > frames.txt", I can get frame type and its pts. However, It looks some of frame does not show frame type. – SY Moon Apr 13 '21 at 06:37
  • @SYMoon Use a pastebin site to show the output from ffprobe. – llogan Apr 13 '21 at 16:13
  • I realized I have missing "-select_streams v:0" parameter on ffprobe. Thank you. – SY Moon Apr 14 '21 at 07:35