./configure --list-encoders
常见的编码器的格式有:AAC,AC3,H.264,H.265、MPEG4、MPEG2VIDEO、PCM以及FLV1的编码器支持
./configure --list-decoders
通过查询相关命令可以发现常见的编码格式有:H.264、H.265、MPEG4以及MP3
./configure --list-muxers
从封装(复用)格式所使用的的信息可以看到,FFmpeg支撑生成裸流文件,如H.264,AAC,PCM以及常见的某些格式:MP3、MP4,FLV,M3U8
./configure --list-demuxers
从解封装的格式信息可以看到,支持解封状的的信息特别多有:MP3、MP4,FLV、MOV,AVI、(image)
./configure --list-protocols
从协议的信息中可以看到,其支持的相关的信息包括,MMS,HTTP,HTTPS,HLS(M3U8),RTMP以及RTP甚至TCP和UTP
FFmpeg中常用的工具主要有FFmpeg、ffprobe,ffplay;他们分别作为多媒体的编解码工具,内容分析工具以及播放器。
usage:ffmpege [options] [[ infile options] -i infile] ... {[outfile options] outfiles}...
#执行命令
ffmget -formats 查看当前使用ffmpeg支持封装和解封装支持的格式
D. = Demuxing supported
.E = Muxing supported
--
D 3dostr 3DO STR
E 3g2 3GP2 (3GPP2 file format)
E 3gp 3GP (3GPP file format)
D 4xm 4X Technologies
E a64 a64 - video for Commodore 64
D aa Audible AA format files
D aac raw ADTS AAC (Advanced Audio Coding)
DE ac3 raw AC-3
D acm Interplay ACM
D act ACT Voice file format
D adf Artworx Data Format
D adp ADP
D ads Sony PS2 ADS
E adts ADTS AAC (Advanced Audio Coding)
DE adx CRI ADX
ffmpeg -encoders 可以查看是否支持某种编码格式
V..... = Video #视屏
A..... = Audio #音频
S..... = Subtitle #字幕
.F.... = Frame-level multithreading #帧级别的多线程支持
..S... = Slice-level multithreading #分片级别的多线程支持
...X.. = Codec is experimental #该编码为实验编码
....B. = Supports draw_horiz_band #draw,horiz,band
.....D = Supports direct rendering method 1 #直接渲染模式支持
------
V....D 012v Uncompressed 4:2:2 10-bit
V....D 4xm 4X Movie
V....D 8bps QuickTime 8BPS video
V....D aasc Autodesk RLE
V....D agm Amuse Graphics Movie
VF...D aic Apple Intermediate Codec
V....D alias_pix Alias/Wavefront PIX image
V....D amv AMV Video
V....D anm Deluxe Paint Animation
V....D ansi ASCII/ANSI art
VF...D apng APNG (Animated Portable Network Graphics) image
V....D arbc Gryphon's Anim Compressor
V....D asv1 ASUS V1
V....D asv2 ASUS V2
V....D aura Auravision AURA
ffmpeg -filters
#可以观察查看支持那些的滤镜
#第一列:3个字段支持
#第二列:滤镜名
#第三例:转化方式
#第三例:滤镜作用
T.. = Timeline support #第一个字段值表示时间轴支持
.S. = Slice threading #第二字段值表示分片线程处理支持
..C = Command support #第三字段值表示分片线程处理支持
A = Audio input/output
V = Video input/output
N = Dynamic number and/or type of input/output
| = Source or sink filter
... abench A->A Benchmark part of a filtergraph.
... acompressor A->A Audio compressor.
... acontrast A->A Simple audio dynamic range compression/expansion filter.
... acopy A->A Copy the input audio unchanged to the output.
... acue A->A Delay filtering to match a cue.
... acrossfade AA->A Cross fade two input audio streams.
... acrossover A->N Split audio into per-bands streams.
... acrusher A->A Reduce audio bit resolution.
.S. adeclick A->A Remove impulsive noise from input audio.
.S. adeclip A->A Remove clipping from input audio.
T.. adelay A->A Delay one or more audio channels.
... aderivative A->A Compute derivative of input audio.
... aecho A->A Add echoing to the audio.
... aemphasis A->A Audio emphasis.
... aeval A->A Filter audio signal according to a specified expression.
T.. afade A->A Fade in/out input audio.
TSC afftdn A->A Denoise audio samples using FFT.
... afftfilt A->A Apply arbitrary expressions to samples in frequency domain.
.S. afir AA->N Apply Finite Impulse Response filter with supplied coefficients in 2nd stream.
... aformat A->A Convert the input audio to one of the specified formats.
ffmpeg -h muxer=flv
#通过ffmpeg -h 可以查看具体参数的对应的类型信息
其中flv包含三部分信息
Muxer flv [FLV (Flash Video)]:
Common extensions: flv.
Mime type: video/x-flv.
Default video codec: flv1.
Default audio codec: mp3.
flv muxer AVOptions:
-flvflags <flags> E........ FLV muxer flags (default 0)
aac_seq_header_detect E........ Put AAC sequence header based on stream data
no_sequence_end E........ disable sequence end for FLV
no_metadata E........ disable metadata for FLV
no_duration_filesize E........ disable duration and filesize zero value metadata for FLV
add_keyframe_index E........ Add keyframe index metadata
ffmpeg的封装转换(转封装)功能包含在AVFormat模块中,通过libavformat库进行Mux和Demux操作;多媒体的格式有很多种,这些格式中的很多参数是公用的,可以通过ffmpeg --help full 信息,找到AVFormatContext参数部分,该参数下的所以皮参数均为封装转换可使用的参数。
FFmpeg的转码参数,ffmpeg编码部分的功能主要是通过模块AVCodec来完成的,通过libavcodec库进行Encode与Decode操作。多媒体格式的种类有很多,但是还有很多通用的基本操作参数。
ffmpeg的基本转码原理,ffmpeg工具的主要用途为编码、解码、转码以及媒体格式转换,ffmpeg常用于转码操作,可以设置相关的转码参数,如果转码操作实际封装的改变:
在ffmpeg套件中,除了ffmpeg作为对每日处理工具外,还有很多ffprobe多媒体信息查看工具,可以通过ffprobe主要用来查看多媒体文件的信息。
ffprobe:常用的参数比较多,可以通过ffprobe --hep查看详细的帮助信息。
usage: ffprobe [OPTIONS] [INPUT_FILE]
L show license
-h topic show help
-? topic show help
-help topic show help
--help topic show help
-version show version
-buildconf show build configuration
-formats show available formats
-muxers show available muxers
-demuxers show available demuxers
-devices show available devices
-codecs show available codecs
-decoders show available decoders
-encoders show available encoders
-bsfs show available bit stream filters
-protocols show available protocols
-filters show available filters
-pix_fmts show available pixel formats
-layouts show standard channel layouts
-sample_fmts show available audio sample formats
-colors show available color names
-loglevel loglevel set logging level
-v loglevel set logging level
-report generate a report
-max_alloc bytes set maximum size of a single alloc
使用ffprobe -show _packets input.flv查看多媒体数据信息:
[PACKET]
codec_type=video
stream_index=0
pts=4023
pts_time=160.920000
dts=4023
dts_time=160.920000
duration=1
duration_time=0.040000
convergence_duration=N/A
convergence_duration_time=N/A
size=3346
pos=15109472
flags=__
使用show_packets查看的多媒体数据包信心是用PACKET标签括祁连,其中包含的信息有:
command:ffprobe -show_data -show_packets output.avi
#-show_data 查看对应的内容
[PACKET]
codec_type=audio
stream_index=1
pts=7119
pts_time=170.856000
dts=7119
dts_time=170.856000
duration=1
duration_time=0.024000
convergence_duration=N/A
convergence_duration_time=N/A
size=384
pos=16293212
flags=K_
data=
00000000: fffb 9464 e500 0661 5cc8 6671 e000 bb0b ...d...a\.fq....
00000010: 899f cdc8 0055 ed63 3db9 9780 0103 0fe8 .....U.c=.......
00000020: 271a 5000 67d2 b2c1 fffe 3f0b f979 25e7 '.P.g.....?..y%.
00000030: 217a 919a 1437 b07f fff2 e073 9c26 5ab0 !z...7.....s.&Z.
00000040: f232 203e 8577 b069 ffff f3fc c525 ea43 .2 >.w.i.....%.C
00000050: 18b8 319a afa1 5dec 1a3e 85ff fffe 87c0 ..1...]..>......
00000060: 4b21 90d3 487c 89b4 32ef 60d1 f42b bd83 K!..H|..2.`..+..
00000070: 4fff ffff e54d 21f2 2da1 9056 13f6 5b4e O....M!.-..V..[N
00000080: 558a 15d8 60d1 f42b b0c1 d317 fc07 fffe U...`..+........
00000090: b000 900f 2cf3 0820 8200 05e0 1b46 2d8a ....,.. .....F-.
000000a0: 4792 5630 e321 6db9 3c5c 140e 645e 202c G.V0.!m.<\..d^ ,
000000b0: 2855 f0f8 a8b8 80b3 ffc5 0e2a 7416 fc22 (U.........*t.."
000000c0: 0b91 39fa c069 38ef e5d2 70ca 59ff 994c ..9..i8...p.Y..L
000000d0: 6a6a 4c41 4d45 332e 3130 30aa aa4c 414d jjLAME3.100..LAM
000000e0: 4533 2e31 3030 aaaa aaaa aaaa aaaa aaaa E3.100..........
000000f0: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000100: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000110: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000120: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000130: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000140: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000150: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000160: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
00000170: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa ................
[/PACKET]
command: ffprobe -show_frames output.flv
#-show_frames 输出帧信息将使用的FRAME标签包含起来
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=6874
pkt_pts_time=164.976000
pkt_dts=6874
pkt_dts_time=164.976000
best_effort_timestamp=6874
best_effort_timestamp_time=164.976000
pkt_duration=1
pkt_duration_time=0.024000
pkt_pos=15670606
pkt_size=384
sample_fmt=fltp
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=4125
pkt_pts_time=165.000000
pkt_dts=4125
pkt_dts_time=165.000000
best_effort_timestamp=4125
best_effort_timestamp_time=165.000000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=15670998
pkt_size=6275
width=1280
height=720
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=P
coded_picture_number=4124
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[SIDE_DATA]
side_data_type=QP table data
[/SIDE_DATA]
[SIDE_DATA]
side_data_type=QP table properties
[/SIDE_DATA]
[/FRAME]
command ffprobe -show_streams output.avi
#查看多媒体文件中的流信息
index=0
codec_name=mpeg4
codec_long_name=MPEG-4 part 2
profile=Simple Profile
codec_type=video
codec_time_base=1/25
codec_tag_string=FMP4
codec_tag=0x34504d46
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=1
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
quarter_sample=false
divx_packed=false
id=N/A
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/25
start_pts=0
start_time=0.000000
duration_ts=4272
duration=170.880000
bit_rate=630122
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=4272
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
command ffprobe -of xxx -show_streams output.avi
通过将输出的信息的以xxx(xml,json)指定的形式输出信息
{
Input #0, avi, from 'output.avi':
Metadata:
encoder : Lavf58.29.100
Duration: 00:02:50.90, start: 0.000000, bitrate: 771 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 630 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s
"streams": [
{
"index": 0,
"codec_name": "mpeg4",
"codec_long_name": "MPEG-4 part 2",
"profile": "Simple Profile",
"codec_type": "video",
"codec_time_base": "1/25",
"codec_tag_string": "FMP4",
"codec_tag": "0x34504d46",
"width": 1280,
"height": 720,
"coded_width": 1280,
"coded_height": 720,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p",
"level": 1,
"chroma_location": "left",
"refs": 1,
"quarter_sample": "false",
"divx_packed": "false",
"r_frame_rate": "25/1",
"avg_frame_rate": "25/1",
"time_base": "1/25",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 4272,
"duration": "170.880000",
"bit_rate": "630122",
"nb_frames": "4272",
"disposition": {
"default": 0,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
}
},
{
"index": 1,
"codec_name": "mp3",
"codec_long_name": "MP3 (MPEG audio layer 3)",
"codec_type": "audio",
"codec_time_base": "1/48000",
"codec_tag_string": "U[0][0][0]",
"codec_tag": "0x0055",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "3/125",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 7121,
"duration": "170.904000",
"bit_rate": "128018",
"nb_frames": "7121",
"disposition": {
"default": 0,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
}
}
]
}
ffplay不仅仅是播放器,同时可以作为ffmpeg的codec引擎,format引擎,以及filter引擎的工具,还可以进行可视化的媒体参数分析,其可以通过ffplay --help查看相关参数。
其包含的超级参数如下所示: