Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get number of I/P/B frames of a video file?

I want to extract information of a video file to get the count of its I/P/B frames. How to do it in ffmpeg? Or should I programming using libavformat and libavcodec to do it? Many thanks!

like image 265
Treper Avatar asked Mar 06 '13 10:03

Treper


People also ask

What are IPB frames?

I‑frames are the least compressible but don't require other video frames to decode. P‑frames can use data from previous frames to decompress and are more compressible than I‑frames. B‑frames can use both previous and forward frames for data reference to get the highest amount of data compression.

What is P frame in h264?

P-frame means that only some pixels still exist (usually the moving/changed ones) and the rest of picture is predicted (or copied) based on whats already known from previous frame.

What is iframe and Pframe?

An I‑frame (Intra-coded picture) is a complete image, like a JPG or BMP image file. A P‑frame (Predicted picture) holds only the changes in the image from the previous frame. For example, in a scene where a car moves across a stationary background, only the car's movements need to be encoded.

What are the three types of reference frames used in predictive video encoding?

A video codec, used for encoding or decoding a digital data stream, all have some form of interframe management. H. 264, MPEG-2 and MPEG-4 all use a three frame approach that includes: keyframes, p-frames, and b-frames.


1 Answers

On the command line use ffprobe -show_frames input_file. you can parse this input to get the frame type information.

You can also do ffprobe -show_frames inputfile | grep pict_type

The string to grep may vary depending on version of ffprobe you have.

like image 167
av501 Avatar answered Sep 22 '22 08:09

av501