Ffmpeg 命令学习

141 阅读3分钟

Ffmpeg 录制命令

image.png

ffmpeg 分解复用命令

image.png

处理原始数据

image.png

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/protocol
    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 显示可用过滤器

-pix_fmts           show available pixel formats 显示可用像素格式

-layouts            show standard channel layouts 显示标准频道布局

-sample_fmts        show available audio sample formats 显示可用音频xx格式

-dispositions       show available stream dispositions 显示可用流非定位

-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 methods

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 decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.

-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

Video options:

-vframes number     set the number of video frames to output

-r rate             set frame rate (Hz value, fraction or abbreviation)

-fpsmax rate        set max frame rate (Hz value, fraction or abbreviation)

-s size             set frame size (WxH or abbreviation)

-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)

-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

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 filters

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

FFmpeg mp4转 gif

ffmpeg -i input.mp4  -t 12 -vf "scale=480:-1" -r 15 output.gif