ffmpeg簡介
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
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.
ffmpeg功能介紹
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 # 構建選項,支持哪些功能模塊, 比如libfdk-aac libx264 libvpx
-formats show available formats # 文件格式(協議標准) ,比如rtmp,hls,rtp
-muxers show available muxers # 封裝格式 比如flv,mp3 mp4
-demuxers show available demuxers # 解封裝格式 比如mp3 h264
-devices show available devices # 封裝/解封裝的設備 ,比如sdl sdl2 xv
-codecs show available codecs # 編解碼器 比如aac,h264
-decoders show available decoders # 解碼器 比如aac,h264
-encoders show available encoders # 編碼器 比如aac, libx264
-bsfs show available bit stream filters # 字節流過濾 比如aac_adtstoasc
-protocols show available protocols # 協議 比如rtmp,hls
-filters show available filters # 過濾器, 比如vflip
-pix_fmts show available pixel formats # 像素格式,比如yuv420p,rgb24
-layouts show standard channel layouts # 聲道格式, 比如stereo(立體聲)
-sample_fmts show available audio sample formats # 音頻采樣格式, 比如s16 s16p, fltp
-colors show available color names # 顏色支持,比如Red, Green, Blue
-sources device list sources of the input device # 采集設備,比如攝像頭
-sinks device list sinks of the output device # 水印
-hwaccels show available HW acceleration methods # HW加速
參數介紹
全局參數
Global options (affect whole program instead of just one file:
-loglevel loglevel set logging level
-v loglevel set logging level
-report generate a report
-max_alloc bytes set maximum size of a single allocated block
-y overwrite output files # 覆蓋文件
-n never overwrite output files
-ignore_unknown Ignore unknown stream types
-filter_threads number of non-complex filter threads
-filter_complex_threads number of threads for -filter_complex
-stats print progress report during encoding # 過程信息
-max_error_rate maximum error rate ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.
-bits_per_raw_sample number set the number of bits per raw sample
-vol volume change audio volume (256=normal)
主要參數
Per-file main options:
-f fmt force format # 強轉碼
-c codec codec name # 指定編碼格式
-codec codec codec name
-pre preset preset name
-map_metadata outfile[,metadata]:infile[,metadata] set metadata information of outfile from infile
-t duration record or transcode "duration" seconds of audio/video # 處理時長
-to time_stop record or transcode stop time
-fs limit_size set the limit file size in bytes
-ss time_off set the start time offset # 開始時間
-sseof time_off set the start time offset relative to EOF
-seek_timestamp enable/disable seeking by timestamp with -ss
-timestamp time set the recording timestamp ('now' to set the current time)
-metadata string=string add metadata
-program title=string:st=number... add program with specified streams
-target type specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad audio pad
-frames number set the number of frames to output # 指定幀數顯示
-filter filter_graph set stream filtergraph # 過濾器
-filter_script filename read stream filtergraph description from a file
-reinit_filter reinit filtergraph on input parameter changes
-discard discard
-disposition disposition
音頻參數
Audio options:
-aframes number set the number of audio frames to output # 設置要輸出的音頻幀數
-aq quality set audio quality (codec-specific) # 指定音頻編碼質量 fltp
-ar rate set audio sampling rate (in Hz) # 采樣率,如44100hz
-ac channels set number of audio channels # 采樣通道,比如雙通道
-an disable audio # 禁用聲音
-acodec codec force audio codec ('copy' to copy stream) # 指定編解碼器
-vol volume change audio volume (256=normal) # 設置起始音量
-af filter_graph set audio filters # 指定過濾器
-b:a bitrate audio bitrate (please use -b:a) # 音頻碼率 比如192kbps
視頻參數
Video options:
-vframes number set the number of video frames to output # 輸出視頻幀數, 60/25
-r rate set frame rate (Hz value, fraction or abbreviation) # 視頻碼率
-s size set frame size (WxH or abbreviation) # 畫面大小,widthxheight
-aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777) # 縱橫比
-bits_per_raw_sample number set the number of bits per raw sample
-vn disable video # 禁用視頻
-vcodec codec force video codec ('copy' to copy stream) # 指定編解碼器
-timecode hh:mm:ss[:;.]ff set initial TimeCode value.
-pass n select the pass number (1 to 3)
-vf filter_graph set video filters # 視頻過濾器
-ab bitrate audio bitrate (please use -b:a) # 音頻碼率
-b bitrate video bitrate (please use -b:v) # 視頻碼率
-dn disable data
字幕參數
Subtitle options:
-s size set frame size (WxH or abbreviation)
-sn disable subtitle
-scodec codec force subtitle codec ('copy' to copy stream)
-stag fourcc/tag force subtitle tag/fourcc
-fix_sub_duration fix subtitles duration
-canvas_size size set canvas size (WxH or abbreviation)
-spre preset set the subtitle options to the indicated preset