FFmpeg user manual-common ffprobe commands
In the FFMpeg suite, there are ffmpeg and ffprobe, which are mainly used to view the information of multimedia files. The following describes common basic commands in ffprobe.
5.1 ffprobe common parameters
Ffprobe has many common parameters. You can use ffprobe -- help to view detailed information:
5.2 The following focuses on several examples:
5.2.1 use show_packets to view multimedia reports:
The multimedia package information displayed by show_packets is included by the PACKET tag. The information contained in the PACKET tag is as follows:
Codec_type: multimedia type, such as video package and audio package;
Stream_index: multimedia stream index;
Pts: display time value of Multimedia
Pts_time: The display time of multimedia after calculation based on different formats
Dts: multimedia decoding Time Value
Dts_time: multimedia decoding time after calculation based on different formats
Duration: the time used by the multimedia package.
Duration_time: the time used by the multimedia package after calculation based on different formats
Size: the size of the multimedia package.
Pos: The file offset location of the multimedia package
Flags: multimedia package tag, key package tag and non-key package tag
In addition to the preceding fields and information, you can use the show_data and show_packets combinations to display the specific data in the packets package:
The figure shows the data contained in the multimedia package. The initial information is 0000 01b6 51e0 47ff. We can view the data based on the pos in the figure, that is, the file offset position. According to the figure, the pos value is 3273. It is converted to hexadecimal with the position 0x00000cc9, which can correspond to data:
Use ffprobe to read packets for corresponding data analysis. Use show_packets with show_data for more accurate analysis.
5.2.2 In addition to packets and data, ffprobe can also analyze the multimedia Encapsulation FORMAT. The show_format parameter can be used to view the multimedia Encapsulation FORMAT, but the FORMAT label is used for display:
By reading the format information, we can see that this video file has only one channel. The starting time is 0.000000, the length is 85.867000, the file size is 2377700 bytes, And the bit rate is 221523 bytes per second, this file may be mov, mp4, m4a, 3gp, 3g2, or mj2, and ffprobe outputs this way, because the labels identified by these encapsulation formats are basically the same in ffmpeg, so there are so many display modes, and Other encapsulation formats are not necessarily like this, next, let's look at the Encapsulation Format of A wmv.
The input. wmv file contains two channels. The file Encapsulation Format is asf.
5.2.3 you can use the show_frame parameter of ffprobe to view the FRAME information in the video file. The output FRAME information is enclosed by the FRAME tag.
You can view the information of each frame through the-show_frame parameter. The following describes the important information.
Attribute |
Description |
Value |
Media_type |
Frame Type (video, audio, subtitles, etc) |
Video |
Stream_index |
Index Area of the frame |
0 |
Key_frame |
Whether it is a key frame |
1 |
Pkt_pts |
Pts of the Frame package |
0 |
Pkt_pts_time |
Display the pts time of the Frame package |
0.000000 |
Pkt_dts |
Frame package dts |
0 |
Pkt_dts_time |
Frame package dts Time Display |
0.000000 |
Pkt_duration |
Duration of the Frame package |
1024 |
Pkt_duration_tine |
Frame package duration display |
0.066667 |
Pkt_pos |
Offset position of the file where the Frame package is located |
44 |
Width |
Frame display width |
608 |
Height |
Frame display height |
320 |
Pix_fmt |
Frame image color format |
Yuv420p |
Pict_type |
Frame Type |
I |
When the commonly used Elecard Stream Eye in windows is opened to view mp4, a very intuitive Frame Type display is displayed, and the judgment of each frame can be seen using the pict_type of ffprobe, the size of each frame can also be seen through the pkt_size of ffprobe. pict_type can be used to obtain the video frame I, P, or B.
The-show_streams parameter allows you to view the stream information in the multimedia file. The stream information is enclosed by the STREAMS Tag:
To view the stream information:
Attribute |
Description |
Value |
Index |
Index Area of the stream |
0 |
Codec_name |
Encoding name |
Mpeg4 |
Codec_long_name |
Full name |
MPEG-4 part 2 |
Profile |
Encoded profile |
Simple Profile |
Level |
Encoding level |
1 |
Has_ B _frames |
Contains B frame information |
0 |
Codec_tyoe |
Encoding type |
Video |
Codec_time_base |
Encoding timestamp calculation base unit |
1/15 |
Pix_fmt |
Image Display image color format |
Yuv420p |
Coded_width |
Image Width |
608 |
Coded_height |
Image Height |
320 |
Codec_tag_string |
Encoded tag data |
Mp4v |
In addition to the above information, there is more information
Next we will introduce the information in section 1.
Attribute |
Description |
Value |
R_frame_rate |
Actual Frame Rate |
15/1 |
Avg_frame_rate |
Average Frame Rate |
15/1 |
Time_base |
Time Base (used for timestamp calculation) |
1/15360 |
Bit_rate |
Bit Rate |
220914 |
Max_bit_rate |
Maximum Bit Rate |
220914 |
Nb_frames |
Frames |
1288 |
5.3 ffprobe can obtain the corresponding key-value by using the preceding parameters, but some people think it is convenient and some people think it is inconvenient to read because they are used to it, in this way, the print_format parameter of ffprobe is used for corresponding format output. The following are several output examples:
5.3.1XML format output:
5.3.2ini output
5.3.3flat format output
5.3.4json output
5.3.5csv format output
You can use the corresponding Plotting Method to draw a visual image through various output formats:
Use excel to open a table after output in csv format
Graph The data in the table
When the image is drawn, you can see that the corresponding image is basically the same as Elecard Stream Eye.
5.4 If you only want to view the audio stream or video stream, use the select_streams parameter. For example, you can only view the frames information of the Video Stream:
Ffprobe-show_frames-select_streams v-ofxml input.mp4
After the command line is executed, the output information is as follows, all of which are video frames information: