Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques i-frame recognition

  • i-frame recognition

    Posted by Doug Bay on October 9, 2012 at 2:15 pm

    I need a CLI application that will analyze a video file and output the i-frame location as timecode or framenumber in text. I know its a long shot for ffmpeg to do something like this as ffmpeg is not made to analyze video, but its worth asking. Any suggestions?

    Doug

    Reuben Martin replied 13 years, 10 months ago 3 Members · 3 Replies
  • 3 Replies
  • Michael Rampe

    October 9, 2012 at 8:53 pm

    [Doug Bay] “I know its a long shot for ffmpeg to do something like this”

    Not at all!

    FFprobe (which installs with newer FFmpeg builds) is your candidate.

    $ ffprobe -show_frames input.mp4

    This will print out various attributes for each frame.
    What you are after is “coded_picture_number=” for the frame and “pict_type=” for frame type (I,P or B).

    I usually use grep to turn this into useful data without all of the other noise.

    For your requirements:
    $ ffprobe -show_frames input.mp4 2> /dev/null | grep ‘coded_picture_number|pict_type’

    It is important to note that the “coded_picture_number” starts logically at 0 so you may need to offset this by 1 depending on how you use the output.

    Michael

  • Michael Rampe

    October 10, 2012 at 5:57 am

    I just realised my escape slash was removed by the text editor as an escape slash;-(

    this:… grep ‘coded_picture_number|pict_type’

    should read

    grep ‘coded_picture_number\|pict_type’

    Michael

  • Reuben Martin

    October 11, 2012 at 5:20 am

    There is also a filter that will give frame info.


    ffplay input.mp4 -vf showinfo |& grep 'type:I'

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy