FFMPEG命令参数

来源:互联网 发布:如何做淘宝店铺 编辑:程序博客网 时间:2024/06/14 00:29

命令解析

进入bin目录,输入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    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-devices            show available devices显示支持的编解码格式-codecs             show available codecs-decoders           show available decoders-encoders           show available encoders显示支持的bit流过滤协议-bsfs               show available bit stream filters显示支持的协议-protocols          show available protocols-filters            show available filters显示支持的像素格式(rgb,yuv,nv...)-pix_fmts           show available pixel formats显示standard声道布局-layouts            show standard channel layouts显示音频采样的格式(8位,16,32位...)-sample_fmts        show available audio sample formats-colors             show available color names-sources device     list sources of the input device-sinks device       list sinks of the output device硬件加速方法-hwaccels           show available HW acceleration methodsGlobal 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-stats              print progress report during encoding-max_error_rate ratio of errors (0.0: no errors, 1.0: 100% error  maximum error rate-bits_per_raw_sample number  set the number of bits per raw sample-vol volume         change audio volume (256=normal)Per-file main options:强制采用格式fmt-f fmt              force format 编解码名称-c codec            codec name-codec codec        codec name-pre preset         preset name设置outfile metadata  from infile-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视频参数Video options:设置视频帧的数量-vframes number     set the number of video frames to output设置帧率-r rate             set frame rate (Hz value, fraction or abbreviation)设置帧的大小(格式为宽X高,如1080X720)-s size             set frame size (WxH or abbreviation)设置横纵比-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强制使用codec编解码方式-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音频参数Audio options:设置音频帧的数量-aframes number     set the number of audio frames to output设置音频的质量-aq quality         set audio quality (codec-specific)设置音频的采样率-ar rate            set audio sampling rate (in Hz)设置音频的通道-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 filtersSubtitle 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

命令使用

常用参数如下:

主要参数: -i 设定输入流 -f 设定输出格式 -ss 开始时间 视频参数: -b 设定视频流量,默认为200Kbit/s -r 设定帧速率,默认为25 -s 设定画面的宽与高 -aspect 设定画面的比例 -vn 不处理视频 -vcodec 设定视频编解码器,未设定时则使用与输入流相同的编解码器 音频参数: -ar 设定采样率 -ac 设定声音的Channel数 -acodec 设定声音编解码器,未设定时则使用与输入流相同的编解码器 -an 不处理音频

1.分离视频音频流

ffmpeg -i test.mp4 -an -vcodec copy videoffmpeg -i test.mp4 -vn -acodec copy audeo

2.合并音视频流

ffmpeg -i video -i audio -vcodec copy -acodec copy video.mp4

3.视频转码

ffmpeg –i test.mp4 –vcodec h264 –s 352*278 –an –f m4v test.264
0 0
原创粉丝点击