Search code examples
ffmpegx264ffprobe

Get frame type for specific frame using ffmpeg


I need to get the frame type (I/B/P) of a specific frame number for an x264 encoded movie.

How do I do this using ffmpeg/ffprobe? I'm open to other solutions as well.


Solution

  • You can use ffmpeg directly

    ffmpeg -i input.mp4 -vf select='eq(n,334)',showinfo -f null -
    

    The above will produce an output for the 335th frame of the video

    n: 0 pts: 171008 pts_time:11.1333 pos:  1090471 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:B checksum:A72D197D plane_checksum:[9008E835 680AC49A 6CD66C90] mean:[136 122 134] stdev:[65.4 7.0 9.5]
    

    You can skip the select filter and get output for all frames and then grep like @incBrain does. Note that you want the display picture number, not coded.