FFMPEG进阶系列02-ffmpeg命令详解1

本文介绍了FFmpeg在音视频编解码中的应用,并详细解析了ffmpeg命令的不同部分,包括信息查询、公共操作参数、文件操作、视频音频字幕参数。通过ffmpeg -h long和ffmpeg -h full获取更详细的帮助信息。同时提到了FFmpeg支持的license协议。此外,还提供了FFmpeg、WebRTC等音视频流媒体高级开发的学习资源。
摘要由CSDN通过智能技术生成

帮助信息

主要信息

ffmpeg在做音视频编解码时非常方便,所以很多场景下转码使用的是ffmpeg,铜鼓通过ffmpeg -help命令操作可以看到ffmpeg常见的命令大概分为六部分:

  1. ffmpeg信息查询部分

  2. 公共做操参数部分

  3. 文件主要操作参数部分

  4. 视频操作参数部分

  5. 音频操作参数部分

  6. 字幕操作参数部分 ffmpeg信息查询部分主要参数:ffmpeg.exe -h

ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.1 (GCC) 20180722
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-f
ontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --e
nable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libs
nappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --ena
ble-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvids
tab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --e
nable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva
2 --enable-avisynth
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
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.
​
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
-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 errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an err
or 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
​
Video options:
-vframes number     set the number of video frames to output
-r rate             set 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)
-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
​
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 -h查看到的help信息是基础的信息,如果想获得高级参数部分,可以通过使用 ffmpeg -h long参数来查看,如果希望获得全部的帮助信息,可以同过使用ffmpeg -h full参数来获得。 通过-L参数,可以看到ffmpeg目前所支持的license协议 ffmpeg -h full部分内容,总内容有1万多行,以下为部分节选内容:

【学习地址】:FFmpeg/WebRTC/RTMP/NDK/Android音视频流媒体高级开发
【文章福利】:免费领取更多音视频学习资料包、大厂面试题、技术视频和学习路线图,资料包括(C/C++,Linux,FFmpeg webRTC rtmp hls rtsp ffplay srs 等等)有需要的可以点击1079654574加群领取哦~
  

  • AVCodecContext相关

AVCodecContext AVOptions:
  -b                 <int64>      E..VA.... set bitrate (in bits/s) (from 0 to I64_MAX) (default 200000)
  -ab                <int64>      E...A.... set bitrate (in bits/s) (from 0 to INT_MAX) (default 128000)
  -bt                <int>        E..V..... Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far ratecontrol is willing to deviate from the target average bitrate value. This is not related to minimum/maximum bitrate. Lowering tolerance too much has an adverse effect on quality. (from 1 to INT_MAX) (default 4e+06)
  -flags             <flags>      ED.VAS... (default 0)
     unaligned                    .D.V..... allow decoders to produce unaligned output
     mv4                          E..V..... use four motion vectors per macroblock (MPEG-4)
     qpel                         E..V..... use 1/4-pel motion compensation
     loop                         E..V..... use loop filter
     gray                         ED.V..... only decode/encode grayscale
     psnr                         E..V..... error[?] variables will be set during encoding
     truncated                    .D.V..... Input bitstream might be randomly truncated
     ildct                        E..V..... use interlaced DCT
     low_delay                    ED.V..... force low delay
     global_header                E..VA.... place global headers in extradata instead of every keyframe
     bitexact                     ED.VAS... use only bitexact functions (except (I)DCT)
     aic                          E..V..... H.263 advanced intra coding / MPEG-4 AC prediction
     ilme                         E..V..... interlaced motion estimation
     cgop                         E..V..... closed GOP
     output_corrupt               .D.V..... Output even potentially corrupted frames
  -g                 <int>        E..V..... set the group of picture (GOP) size (from INT_MIN to INT_MAX) (default 12)
  -ar                <int>        ED..A.... set audio sampling rate (in Hz) (from 0 to INT_MAX) (default 0)
  -ac                <int>        ED..A.... set number of audio channels (from 0 to INT_MAX) (default 0)
  -cutoff            <int>        E...A.... set cutoff bandwidth (from INT_MIN to INT_MAX) (default 0)
  -frame_size        <int>        E...A.... (from 0 to INT_MAX) (default 0)
  -qcomp             <float>      E..V..... vi
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值