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!
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With