FFmpeg介紹及使用
- 2019 年 10 月 7 日
- 筆記
FFmpeg介紹及使用
1. FFmpeg簡介
FFmpeg是音影片領域很有名的一個庫, 這裡從兩方面介紹, 一方面根據FFMPEG的命令行工具介紹, 介紹這些命令行工具的使用方法, 滿足一般用戶要求. 還有一方面從組件/庫的劃分來介紹, 介紹FFMPEG是有哪些組件和庫組成, 每一個庫的作用, 便於後續的自定義開發.
全文整體脈絡可以用一張圖表示:

2. 從命令行工具角度介紹
FFmpeg命令行工具有以下四個:
- ffmepg
- ffprobe
- ffplay
- ffserver
2.1 ffmpeg命令
ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter.
ffmpeg主要作用是音影片轉換, 這裡轉換有兩個含義, 一個是封裝容器的轉換(比如mp4轉flv), 一個是指封裝格式的轉換(比如h264轉h265). 其次也支援影像大小轉換, 音頻重取樣.
下面慢慢揭開ffmpeg命令的面紗:
對於ffmpeg, 當我們忘記了命令或者需要查找想要的命令時, 可以通過 ffmpeg --help
查看幫助, 此時會輸出很多內容, 我們慢慢解讀這些輸出的內容:
Getting help: -h — print basic options -h long — print more options -h full — print all options (including all format and codec specific options, very long) -h type=name — print all options for the named decoder/encoder/demuxer/muxer/filter/bsf See man ffmpeg for detailed description of the options. Print help / information / capabilities: -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
最上面的Getting help:
是說如何獲得幫助. 使用ffmpeg --help long
會輸出高級參數, 使用ffmpeg --help full
會輸出全部幫助資訊. 使用ffmpeg -h topic
可以指定要輸出的幫助類型.
接下來的-formats
/-muxers
/-demuxers
/-devices
/-codecs
/-encoders
/-bsfs
/-protocols
/-filters
分別表示列印出所有格式/復用/解復用/設備/編碼器/解碼器/bitstream filters/協議/濾鏡. 我們接下來舉幾個例子說明:
2.1.1 ffmpeg -formats
當遇到無法解析的影片文件或者無法生成影片文件時, 可以使用這個命令查看是否支援對應的影片文件格式.
File formats: D. = Demuxing supported.E = Muxing supported DE h264 raw H.264 video DE flv FLV (Flash Video)
輸出內容DE h264 raw H.264 video
分為3部分:
第一列DE
是封裝格式的Demuxing(解復用)支援和Muxing(復用)支援.
第二列h264
是文件封裝格式.
第三列raw H.264 video
是文件格式的詳細說明, 表明是裸的h264影片, 也就是沒有壓縮過的h264.
2.1.1.1 ffmpeg -muxers
如果我們只想看復用格式, 可以使用ffmpeg -muxers
, 輸出如下所示:
File formats: D. = Demuxing supported .E = Muxing supportedundefined E h264 raw H.264 video E flv FLV (Flash Video)
輸出內容的解讀方式和ffmpeg -formats
一樣.
2.1.1.1.1 ffmpeg -h muxer=flv
當我們需要查看某種具體的復用格式時, 可以使用ffmpeg -h muxer=MUXER_NAME
來查看. 比如ffmpeg -h muxer=flv
輸出內容如下, 其中包含了只有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
FLV的muxer包含兩大部分.
第一部分Muxer flv [FLV (Flash Video)]:
是FLV封裝的默認配置描述, 如擴展名, MIME類型, 默認的影片編碼格式, 默認的音頻編碼格式.
第二部分flv muxer AVOptions:
為FLV封裝時支援的配置參數及相關說明, 通過這些參數, 我們可以更好的了解flv復用的能力.
2.1.1.2 ffmpeg -demuxers
如果我們只想看解復用格式, 可以使用ffmpeg -demuxers
, 輸出如下所示:
File formats: D. = Demuxing supported .E = Muxing supported — D flv FLV (Flash Video) D h264 raw H.264 video
輸出內容的解讀方式和ffmpeg -formats
一樣.
2.1.1.2.1 ffmpeg -h demuxer=flv
當我們需要查看某種具體的解復用格式時, 可以使用ffmpeg -h demuxer=MUXER_NAME
來查看. 比如ffmpeg -h demuxer=flv
輸出內容如下:
Demuxer flv FLV (Flash Video): Common extensions: flv. flvdec AVOptions: -flv_metadata <boolean> .D.V….. Allocate streams according to the onMetaData array (default false) -missing_streams <int> .D.V..XR. (from 0 to 255) (default 0)
FLV的demuxer的資訊包含兩大部分, 具體如下:
第一部分Demuxer flv [FLV (Flash Video)]:
為FLV解封裝默認的配置, 如擴展文件名.
第二部分flvdec AVOptions:
是FLV解封裝設置的參數和相關說明.
2.1.2 ffmpeg -decoders
ffmpeg -decoders
會輸出所有支援的解碼器, 輸出內容如下:
Decoders: V….. = Video A….. = Audio S….. = Subtitle .F…. = Frame-level multithreading ..S… = Slice-level multithreading …X.. = Codec is experimental ….B. = Supports draw_horiz_band …..D = Supports direct rendering method 1undefined VFS..D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
VFS..D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
分為三列,
第一列VFS..D
共6個欄位, 第一個欄位可以取值V/A/S
, 表示這個解碼器是音頻編碼器還是影片編碼器還是字幕編碼器, 第二個欄位F
表示幀級別的多執行緒支援, 第三個欄位S
表示分片級別的多執行緒, 第四個欄位X
表示該編碼屬於實驗版本, 第五個欄位B
表示支援draw horiz band模式, 第六個欄位D
表示支援直接渲染模式. 比如h264的VFS..D
表示影片解碼器, 支援幀級別和分片級別的多執行緒, 支援直接渲染模式.
第二列h264
是編碼格式.
第三列H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
是編碼格式的詳細說明.
2.1.2.1 ffmpeg -h decoder=h264
如果我們想知道h264
解碼器的更多資訊, 可以使用 ffmpeg -h decoder=h264
命令:
Decoder h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10: General capabilities: dr1 delay threads Threading capabilities: frame and slice H264 Decoder AVOptions: -enable_er <boolean> .D.V….. Enable error resilience on damaged frames (unsafe) (default auto) -x264_build <int> .D.V….. Assume this x264 version if no x264 version found in any SEI (from -1 to INT_MAX) (default -1)
第一部分Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]
是解碼h264
時可以採用的常用支援, 和多執行緒支援. 這裡的frame and slice
說明h264
支援幀級別/Slice級別的多執行緒解碼.
第二部分H264 Decoder AVOptions:
是解碼h264
可以採用的解碼參數和說明.
2.1.3 ffmpeg -encoders
ffmpeg -encoders
會輸出所有支援的解碼器, 輸出內容如下:
Decoders: V….. = Video A….. = Audio S….. = Subtitle .F…. = Frame-level multithreading ..S… = Slice-level multithreading …X.. = Codec is experimental ….B. = Supports draw_horiz_band …..D = Supports direct rendering method 1undefined V….. libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264) V….. libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264) V….. h264_videotoolbox VideoToolbox H.264 Encoder (codec h264)
V..... libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
分為三列,
第一列V.....
共6個欄位, 第一個欄位可以取值V/A/S
, 表示這個編碼器是音頻編碼器還是影片編碼器還是字幕編碼器, 第二個欄位F
表示幀級別的多執行緒支援, 第三個欄位S
表示分片級別的多執行緒, 第四個欄位X
表示該編碼屬於實驗版本, 第五個欄位B
表示支援draw horiz band模式, 第六個欄位D
表示支援直接渲染模式. 這裡和解碼器decoders
是一致的. 比如libx264
的V.....
表示影片編碼器.
第二列libx264
是編碼格式.
第三列H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
是編碼格式的詳細說明.
2.1.3.1 ffmpeg -h encoder=h264
如果我們想知道某個具體的編碼器參數, 可以通過ffmpeg -h encoder=ENCODER_NAME
, 比如ffmpeg -h encoder=h264
輸出如下:
Encoder libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10: General capabilities: delay threads Threading capabilities: auto Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 libx264 AVOptions: -preset <string> E..V….. Set the encoding preset (cf. x264 –fullhelp) (default "medium") -tune <string> E..V….. Tune the encoding params (cf. x264 –fullhelp) -profile <string> E..V….. Set profile restrictions (cf. x264 –fullhelp) -fastfirstpass <boolean> E..V….. Use fast settings when encoding first pass (default true) -level <string> E..V….. Specify level (as defined by Annex A) …… Encoder libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB: General capabilities: delay threads Threading capabilities: auto Supported pixel formats: bgr0 bgr24 rgb24 libx264rgb AVOptions: -preset <string> E..V….. Set the encoding preset (cf. x264 –fullhelp) (default "medium") -tune <string> E..V….. Tune the encoding params (cf. x264 –fullhelp) …… Encoder h264_videotoolbox VideoToolbox H.264 Encoder: General capabilities: delay Threading capabilities: none Supported pixel formats: videotoolbox_vld nv12 yuv420p h264_videotoolbox AVOptions: -profile <int> E..V….. Profile (from 0 to 4) (default 0) baseline E..V….. Baseline Profile main E..V….. Main Profile high E..V….. High Profile -level <int> E..V….. Level (from 0 to 52) (default 0) 1.3 E..V….. Level 1.3, only available with Baseline Profile ……
這裡列出了三個h264編碼器, 分別為libx264
, libx264rgb
, h264_videotoolbox
. 每個編碼器的幫助都分為兩個部分:
第一部分Encoder libx264 [libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
是該h264編碼器支援的基本編碼方式. 對比這三個編碼器, 可以發現雖然都是說基本編碼能力支援, 多執行緒編碼能力支援和支援的像素色彩格式, 但是不同編碼器支援的能力差別很大.
第二部分libx264 AVOptions:
是該編碼器編碼h264
時可以採用的編碼參數和說明. 不同的編碼器的參數之前差別很大, 設置時需要注意.
2.1.4 ffmpeg -filters
如果想知道ffmpeg支援的濾鏡/濾波器種類, 可以使用ffmpeg -filters
查看. ffmpeg的濾鏡種類豐富, 功能強大, 疊加方便.
Filters: 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 undefined T.C overlay VV->V Overlay a video source on top of the input. TS. colorkey V->V Turns a certain color into transparency. Operates on RGB colors.
輸出資訊一共四列:
第一列總共三個欄位TSC
, 第一個欄位 T
表示時間軸支援, 第二個欄位S
表示分片執行緒處理支援, 第三個欄位C
表示命令支援.
第二列overlay
是濾鏡名
第三列VV->V
是轉換方式, 比如音視轉音頻, 影片轉影片, 創建音頻, 創建影片, 多個影片合併為一個影片等操作.
第四列Overlay a video source on top of the input.
是濾鏡作用說明.
2.1.4.1 ffmpeg -h filter=colorkey
如果需要詳細查看某個濾鏡的詳細介紹, 可以通過ffmpeg -h filter=FILTER_NAME
來查看. 比如ffmpeg -h filter=colorkey
輸出如下:
Filter colorkey Turns a certain color into transparency. Operates on RGB colors. slice threading supported Inputs: #0: default (video) Outputs: #0: default (video) colorkey AVOptions: color <color> ..FV….. set the colorkey key color (default "black") similarity <float> ..FV….. set the colorkey similarity value (from 0.01 to 1) (default 0.01) blend <float> ..FV….. set the colorkey key blend value (from 0 to 1) (default 0)
colorkey
濾鏡的輸出資訊主要包含兩大部分:
第一部分Filter colorkey
說明了所支援的色彩格式資訊, 支援的多執行緒處理方式, 以及輸入輸出支援.
第二部分colorkey AVOptions:
是所支援的參數和說明.
2.1.5 sample
- ffmpeg -i ~/input.rmvb -vcodec mpeg4 -b:v 200k -r 15 -an output.mp4
-vcodec codec force video codec ('copy' to copy stream)
Set the video codec. This is an alias for -codec:v
.
-b bitrate video bitrate (please use -b:v)
封裝格式從RMVB轉換為MP4, 影片編碼轉換為mpeg4, 影片碼率轉換為200kbit/s, 影片幀率轉換為15fps, 轉碼後不包括音頻(-an)
2.1.6 others
ffmpeg功能十分強大, 更詳細命令可以參考
http://ffmpeg.org/ffmpeg-all.html
2.2 ffprobe
ffprobe gathers information from multimedia streams and prints it in human- and machine-readable fashion.
從ffprobe的介紹可知, ffprobe主要有兩個作用, 一個是從多媒體文件中獲得資訊, 二是輸出這些資訊.
2.2.1 ffprobe -h
ffprobe命令比較多, 我們可以通過ffprobe -h
來查看.
-show_data show packets data -show_data_hash show packets data hash -show_error show probing error -show_format show format/container info -show_frames show frames info -show_format_entry entry show a particular entry from the format/container info -show_entries entry_list show a set of specified entries -show_log show log -show_packets show packets info -show_programs show programs info -show_streams show streams info -show_chapters show chapters info -count_frames count the number of frames per stream -count_packets count the number of packets per stream
常用的命令有-show_packets
, -show_streams
, -show_frames
, -show_packets
.
比如我們可以通過ffprobe -show_packets input.mp4
查看多媒體數據包資訊. 其輸出如下:
PACKET codectype=audio 多媒體類型, 影片包/音頻包 stream_index=1 多媒體的stream多音 pts=9564160 多媒體的顯示時間值 pts_time=216.874376 根據不同格式計算後的多媒體的顯示時間 dts=9564160 多媒體的解碼時間值 dts_time=216.874376 根據不同格式計算後的多媒體的解碼時間 duration=1024 多媒體包佔用的時間值 duration_time=0.023220 根據不同格式計算後的多媒體包所佔用的時間值 convergence_duration=N/A convergence_duration_time=N/A size=364 多媒體包的大小 pos=14727208 多媒體包所在文件的便宜位置 flags=K 多媒體包標記, 如關鍵包和非關鍵包 /PACKET
還可以通過ffprobe -show_data -show_packets input.mp4
查看包中的具體數據:
PACKET codec_type=video stream_index=0 pts=19513494 pts_time=216.816600 dts=19510491 dts_time=216.783233 duration=3003 duration_time=0.033367 convergence_duration=N/A convergence_duration_time=N/A size=41 pos=14721293 flags=__ data= 00000000: 0000 0025 419a 2493 c21e 4ca6 07ff 0000 …%A.$…L….. 00000010: 0300 0003 0000 0300 0003 0000 0300 0003 ……………. 00000020: 0000 0300 0003 0001 ff ………
2.2.1.1 ffprobe -print_format / -of修改輸出格式
-print_format format set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)
-of format alias for -print_format
ffprobe -of csv –show_packets input.mp4
http://ffmpeg.org/ffprobe.html
http://ffmpeg.org/ffprobe-all.html
2.3 ffplay
FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs.
SDL,跨平台,便於測試ffmpeg的codec/format/filter
最新版不到四千行, IJKPlayer發源於此
2.3.1 ffplay -h
-fs force full screen -an disable audio -vn disable video -sn disable subtitling -ss pos seek to a given position in seconds -t duration play "duration" seconds of audio/video -bytes val seek by bytes 0=off 1=on -1=auto -seek_interval seconds set seek interval for left/right keys, in seconds -nodisp disable graphical display -noborder borderless window -volume volume set startup volume 0=min 100=max -f fmt force format -window_title window title set window title -af filter_graph set audio filters -showmode mode select show mode (0 = video, 1 = waves, 2 = RDFT) -i input_file read specified file -codec decoder_name force decoder -autorotate automatically rotate videoAdvanced options: -cpuflags flags force specific cpu flags -hide_banner hide_banner do not show program banner -ast stream_specifier select desired audio stream -vst stream_specifier select desired video stream -sst stream_specifier select desired subtitle stream -pix_fmt format set pixel format -stats show status -fast non spec compliant optimizations -genpts generate pts -drp let decoder reorder pts 0=off 1=on -1=auto -lowres -sync type set audio-video sync. type (type=audio/video/ext) -autoexit exit at the end -exitonkeydown exit on key down -exitonmousedown exit on mouse down -loop loop count set number of times the playback shall be looped -framedrop drop frames when cpu is too slow -infbuf don't limit the input buffer size (useful with realtime streams) -vf filter_graph set video filters -rdftspeed msecs rdft speed -default generic catch all option -acodec decoder_name force audio decoder -scodec decoder_name force subtitle decoder -vcodec decoder_name force video decoder -find_stream_info read and decode the streams to fill missing information with heuristics
2.3.2 ffplay -ss 20 -t 10 output.mp4
2.3.3 ffplay -showmode 1 output.mp3
-showmode mode select show mode (0 = video, 1 = waves, 2 = RDFT)
2.3.4 ffplay -debug mb_type output.mp4
-debug <flags> ED.VAS… print specific debug info (default 0)
pict .D.V….. picture info
bitstream .D.V…..
mb_type .D.V….. macroblock (MB) type
qp .D.V….. per-block quantization parameter (QP)
dct_coeff .D.V…..
green_metadata .D.V…..
skip .D.V…..
startcode .D.V…..
er .D.V….. error recognition
mmco .D.V….. memory management control operations (H.264)
bugs .D.V…..
buffers .D.V….. picture buffer allocations
thread_ops .D.VA…. threading operations
nomc .D.VA…. skip motion compensation
2.3.5 ffplay -flags2 +export_mvs f14163.mp4 -vf codecview=mv=pf+bf+bb
調試宏塊和運動矢量
https://trac.ffmpeg.org/wiki/Debug/MacroblocksAndMotionVectors
codecview AVOptions:
mv <flags> ..FV….. set motion vectors to visualize (default 0)
pf ..FV..... forward predicted MVs of P-frames
bf ..FV..... forward predicted MVs of B-frames
bb ..FV..... backward predicted MVs of B-frames
The following sections apply to ffmpeg versions older than October 21 2017.
Analyzing Macroblock Types
ffplay -debug vis_mb_type input.mp4
Analyzing QP Values
ffplay -debug vis_qp input.mp4
http://ffmpeg.org/ffplay-all.html
2.4 ffserver
ffserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds. You can seek to positions in the past on each live feed, provided you specify a big enough feed storage.
http://ffmpeg.org/ffserver.html
http://ffmpeg.org/ffserver-all.html
ffserver has been removed on 2018-01-06. If you still need it checkout commit 2ca65fc or use the 3.4 release branch Or try an alternative such as mkvserver_mk2 https://trac.ffmpeg.org/wiki/ffserver
https://trac.ffmpeg.org/wiki/ffserver
https://github.com/klaxa/mkvserver_mk2
Simple-RTMP-Server
3. 從組件/庫角度介紹
3.1 libavutil:大雜燴, 函數不知道應該放哪就放這裡.
The libavutil library is a utility library to aid portable multimedia programming. It contains safe portable string functions, random number generators, data structures, additional mathematics functions, cryptography and multimedia related functionality (like enumerations for pixel and sample formats). It is not a library for code needed by both libavcodec and libavformat.
http://www.ffmpeg.org/libavutil.html
http://www.ffmpeg.org/ffmpeg-utils.html
3.2 libswscale:影片格式轉換與大小縮放
The libswscale library performs highly optimized image scaling and colorspace and pixel format conversion operations. Specifically, this library performs the following conversions: Rescaling: is the process of changing the video size. Several rescaling options and algorithms are available. This is usually a lossy process. Pixel format conversion: is the process of converting the image format and colorspace of the image, for example from planar YUV420P to RGB24 packed. It also handles packing conversion, that is converts from packed layout (all pixels belonging to distinct planes interleaved in the same buffer), to planar layout (all samples belonging to the same plane stored in a dedicated buffer or "plane").This is usually a lossy process in case the source and destination colorspaces differ.
http://www.ffmpeg.org/libswscale.html
http://www.ffmpeg.org/ffmpeg-scaler.html
3.3 libswresample:音頻重取樣
The libswresample library performs highly optimized audio resampling, rematrixing and sample format conversion operations. Specifically, this library performs the following conversions: Resampling: is the process of changing the audio rate, for example from a high sample rate of 44100Hz to 8000Hz. Audio conversion from high to low sample rate is a lossy process. Several resampling options and algorithms are available. Format conversion: is the process of converting the type of samples, for example from 16-bit signed samples to unsigned 8-bit or float samples. It also handles packing conversion, when passing from packed layout (all samples belonging to distinct channels interleaved in the same buffer), to planar layout (all samples belonging to the same channel stored in a dedicated buffer or "plane"). Rematrixing: is the process of changing the channel layout, for example from stereo to mono. When the input channels cannot be mapped to the output streams, the process is lossy, since it involves different gain factors and mixing. Various other audio conversions (e.g. stretching and padding) are enabled through dedicated options.
http://www.ffmpeg.org/libswresample.html
http://www.ffmpeg.org/ffmpeg-resampler.html
3.4 libavcodec:編解碼
The libavcodec library provides a generic encoding/decoding framework and contains multiple decoders and encoders for audio, video and subtitle streams, and several bitstream filters.
AVCodecContext
http://www.ffmpeg.org/libavcodec.html
http://www.ffmpeg.org/ffmpeg-codecs.html
3.4.1 bitsream-filters
http://www.ffmpeg.org/ffmpeg-bitstream-filters.html
A bitstream filter operates on the encoded stream data, and performs bitstream level modifications without performing decoding.
https://stackoverflow.com/questions/32028437/what-are-bitstream-filters-in-ffmpeg
在不做碼流解碼的前提下,對已經編碼後的比特流做特定的修改、調整。比如添加SEI, SEI可以做直播答題
https://zhuanlan.zhihu.com/p/33720871
3.5 libavformat:封裝與解封裝
The libavformat library provides a generic framework for multiplexing and demultiplexing (muxing and demuxing) audio, video and subtitle streams. It encompasses multiple muxers and demuxers for multimedia container formats. It also supports several input and output protocols to access a media resource.
http://www.ffmpeg.org/libavformat.html
http://www.ffmpeg.org/ffmpeg-formats.html
http://www.ffmpeg.org/ffmpeg-protocols.html
3.6 libavdevice:音影片輸入/輸出設備
The libavdevice library provides a generic framework for grabbing from and rendering to many common multimedia input/output devices, and supports several input and output devices, including Video4Linux2, VfW, DShow, and ALSA. The libavdevice library provides the same interface as libavformat. Namely, an input device is considered like a demuxer, and an output device like a muxer, and the interface and generic device options are the same provided by libavformat (see the ffmpeg-formats manual).
http://www.ffmpeg.org/libavdevice.html
http://www.ffmpeg.org/ffmpeg-devices.html
3.7 libavfilter:音影片濾鏡
The libavfilter library provides a generic audio/video filtering framework containing several filters, sources and sinks.
http://www.ffmpeg.org/libavfilter.html
http://www.ffmpeg.org/ffmpeg-filters.html
4. 結語
本文暫且告一段落. "從組件/庫角度介紹"寫的比較簡略, 內容主要是ffmpeg官網鏈接和內容, 因為這裡需要結合FFmpeg源碼才能更好的描述. 在後續文章介紹"如何debug ffmpeg源碼", 以及"ffmpeg訂製開發示例"時, 會更詳細的描述FFmpeg組件/庫.