继续来到老地方,https://www.ffmpeg.org/documentation.html
点进去之后,目录中
H265视频编解码实例
由于使用的是python
执行的代码,所以采用了os.system()
函数执行命令行。
os.system()
中需要用字符串形式给出在cmd
中执行的命令行
该代码为2021中兴算法大赛图灵派的代码,代码+数据将在我的GitHub
库中给出https://github.com/xiaolingwei/ZET_algorithm
整体的代码如下
import os
#对excel视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i excel_01.yuv -pix_fmt yuv420p excel420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i excel420.yuv -vcodec libx265 excel265.265 -y")
os.system("ffmpeg -i excel265.265 -r 25 -pix_fmt yuv420p -vcodec libx265 -preset veryslow -b:v 32k -profile main -crf 32 -strict -2 excel_enc.265 -y")
os.system("ffmpeg -i excel_enc.265 -c:v rawvideo -pix_fmt yuv444p excel_dec.yuv -y")
#对ppt视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i ppt_02.yuv -pix_fmt yuv420p ppt420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i ppt420.yuv -vcodec libx265 ppt265.265 -y")
os.system("ffmpeg -i ppt265.265 -r 25 -pix_fmt yuv420p -vcodec libx265 -preset veryslow -b:v 32k -profile main -crf 32 -strict -2 ppt_enc.265 -y")
os.system("ffmpeg -i ppt_enc.265 -c:v rawvideo -pix_fmt yuv444p ppt_dec.yuv -y")
#对web视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i web_03.yuv -pix_fmt yuv420p web420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i web420.yuv -vcodec libx265 web265.265 -y")
os.system("ffmpeg -i web265.265 -r 25 -pix_fmt yuv420p -vcodec libx265 -preset veryslow -b:v 32k -profile main -crf 32 -strict -2 web_enc.265 -y")
os.system("ffmpeg -i web_enc.265 -c:v rawvideo -pix_fmt yuv444p web_dec.yuv -y")
#对word视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i word_04.yuv -pix_fmt yuv420p word420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i word420.yuv -vcodec libx265 word265.265 -y")
os.system("ffmpeg -i word265.265 -r 25 -pix_fmt yuv420p -vcodec libx265 -preset veryslow -b:v 32k -profile main -crf 32 -strict -2 word_enc.265 -y")
os.system("ffmpeg -i word_enc.265 -c:v rawvideo -pix_fmt yuv444p word_dec.yuv -y")
下面拆解一下代码的含义
上述代码是对四个视频进行编解码,这里只拆解一个。
ffmpeg -s 1280*720 -pix_fmt yuv444p -i excel_01.yuv -pix_fmt yuv420p excel420.yuv -y
-s
用于指出源文件格式,-pix_fmt
指出像素格式为 yuv444p
,-i
指出输入文件为excel_01.yuv
,第二个-pix_fmt
指出输出像素格式 excel420.yuv
为输出文件名 -y
为选择覆盖已有文件(即当已有同名文件,则覆盖)。
ffmpeg -s 1280*720 -pix_fmt yuv420p -i excel420.yuv -vcodec libx265 excel265.265 -y
-vcodec
用于指出编码器 libx265
为H265编码器,excel265.265
为输出文件名。
ffmpeg -i excel265.265 -r 25 -pix_fmt yuv420p -vcodec libx265 -preset veryslow -b:v 32k -profile main -crf 32 -strict -2 excel_enc.265 -y
-r
指出视频每秒帧数, -preset
设置编码速度模式,-b:v
设置码率为32k
, -profile
设置模式为main
,-crf
(固定码率因子)设置画面质量(默认为23,一般使用18-28之间的数值),-strict
严格编码,excel_enc.265
输出文件名。-strict -2 是实验参数表示使用aac音频编码。
preset
有如下参数可用:
ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow and placebo.
crf
是264和265中默认的质量/码率控制设置。这个值可以在0到51之间,值越低,质量越好,文件大小越大。
ffmpeg -i excel_enc.265 -c:v rawvideo -pix_fmt yuv444p excel_dec.yuv -y
-c:v
设置解码器 ,excel_dec.yuv
输出文件格式
什么是Yuv444p,422p,420p
YUV 4:4:4采样,每一个Y对应一组UV分量。
YUV 4:2:2采样,每两个Y共用一组UV分量。
YUV 4:2:0采样,每四个Y共用一组UV分量
H264视频编解码实例
import os
#对excel视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i excel_01.yuv -pix_fmt yuv420p excel420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i excel420.yuv -vcodec libx264 -f h264 excelh264.h264 -y")
os.system("ffmpeg -i excelh264.h264 -r 25 -pix_fmt yuv420p -vcodec h264 -preset veryslow -profile:v baseline -crf 23 -acodec aac -b:a 32k -strict -5 excel_enc.h264 -y")
os.system("ffmpeg -i excel_enc.h264 -c:v rawvideo -pix_fmt yuv444p excel_dec.yuv -y")
#对ppt视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i ppt_02.yuv -pix_fmt yuv420p ppt420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i ppt420.yuv -vcodec libx264 -f h264 ppth264.h264 -y")
os.system("ffmpeg -i ppth264.h264 -r 25 -pix_fmt yuv420p -vcodec h264 -preset veryslow -profile:v baseline -crf 23 -acodec aac -b:a 32k -strict -5 ppt_enc.h264 -y")
os.system("ffmpeg -i ppt_enc.h264 -c:v rawvideo -pix_fmt yuv444p ppt_dec.yuv -y")
#对web视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i web_03.yuv -pix_fmt yuv420p web420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i web420.yuv -vcodec libx264 -f h264 webh264.h264 -y")
os.system("ffmpeg -i webh264.h264 -r 25 -pix_fmt yuv420p -vcodec h264 -preset veryslow -profile:v baseline -crf 23 -acodec aac -b:a 32k -strict -5 web_enc.h264 -y")
os.system("ffmpeg -i web_enc.h264 -c:v rawvideo -pix_fmt yuv444p web_dec.yuv -y")
#对word视频编解码
os.system("ffmpeg -s 1280*720 -pix_fmt yuv444p -i word_04.yuv -pix_fmt yuv420p word420.yuv -y")
os.system("ffmpeg -s 1280*720 -pix_fmt yuv420p -i word420.yuv -vcodec libx264 -f h264 wordh264.h264 -y")
os.system("ffmpeg -i wordh264.h264 -r 25 -pix_fmt yuv420p -vcodec h264 -preset veryslow -profile:v baseline -crf 23 -acodec aac -b:a 32k -strict -5 word_enc.h264 -y")
os.system("ffmpeg -i word_enc.h264 -c:v rawvideo -pix_fmt yuv444p word_dec.yuv -y")
代码解释:
基本与上述H265类同,如有不解,参看https://zhuanlan.zhihu.com/p/364231069
视频编码器 Encoders
其中包含了h265
和h264
的编码器,需要的就是搞明白如何应用这两种编码器,具体的选项解释官网都包含。
视频解码器 Decoders
同样参考官网的解释,可以选取上述各种解码器,实例中采用rawvideo
解码器。
Codec Options-编码选项(通用的选项)
选项太多了,常用的不多,由于作者不专业很多没法给出准确的翻译,或者避免误人子弟没有翻译,希望指正。
The list of supported options follow: 选项列表
b integer (encoding,audio,video) 码率设置
Set bitrate in bits/s. Default value is 200K.
ab integer (encoding,audio) 音频码率
Set audio bitrate (in bits/s). Default value is 128K.
bt integer (encoding,video) 视频码率
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 min/max bitrate. Lowering tolerance too much has an adverse effect on quality.
flags flags (decoding/encoding,audio,video,subtitles) 可以用于编解码、音视频
Set generic flags.
以下是可能值
Possible values:
‘mv4’
Use four motion vector by macroblock (mpeg4). mpeg4运动矢量
‘qpel’
Use 1/4 pel motion compensation. 1/4 pel运动补偿
‘loop’
Use loop filter. 循环滤波
‘qscale’
Use fixed qscale.
‘pass1’
Use internal 2pass ratecontrol in first pass mode.
‘pass2’
Use internal 2pass ratecontrol in second pass mode.
‘gray’
Only decode/encode grayscale.
‘psnr’
Set error variables during encoding.
‘truncated’
Input bitstream might be randomly truncated.
‘drop_changed’
Don’t output frames whose parameters differ from first decoded frame in stream. Error AVERROR_INPUT_CHANGED is returned when a frame is dropped.
‘ildct’
Use interlaced DCT.
‘low_delay’
Force low delay.
‘global_header’
Place global headers in extradata instead of every keyframe.
‘bitexact’
Only write platform-, build- and time-independent data. (except (I)DCT). This ensures that file and data checksums are reproducible and match between platforms. Its primary use is for regression testing.
‘aic’
Apply H263 advanced intra coding / mpeg4 ac prediction.
‘ilme’
Apply interlaced motion estimation.
‘cgop’
Use closed gop.
‘output_corrupt’
Output even potentially corrupted frames.
time_base rational number 设置编码时间基
Set codec time base.
It is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be 1 / frame_rate and timestamp increments should be identically 1.
g integer (encoding,video) 设置视频组的大小
Set the group of picture (GOP) size. Default value is 12.
ar integer (decoding/encoding,audio) 设置音频采样率
Set audio sampling rate (in Hz).
ac integer (decoding/encoding,audio) 设置音频信道
Set number of audio channels.
cutoff integer (encoding,audio) 设置截断带宽
Set cutoff bandwidth. (Supported only by selected encoders, see their respective documentation sections.)
frame_size integer (encoding,audio) 设置音频帧大小
Set audio frame size.
Each submitted frame except the last must contain exactly frame_size samples per channel. May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not restricted. It is set by some decoders to indicate constant frame size.
frame_number integer 设置帧数目
Set the frame number.
delay integer
qcomp float (encoding,video)
Set video quantizer scale compression (VBR). It is used as a constant in the ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0.
qblur float (encoding,video)
Set video quantizer scale blur (VBR).
qmin integer (encoding,video)
Set min video quantizer scale (VBR). Must be included between -1 and 69, default value is 2.
qmax integer (encoding,video)
Set max video quantizer scale (VBR). Must be included between -1 and 1024, default value is 31.
qdiff integer (encoding,video)
Set max difference between the quantizer scale (VBR).
bf integer (encoding,video) 设置最大B帧
Set max number of B frames between non-B-frames.
Must be an integer between -1 and 16. 0 means that B-frames are disabled. If a value of -1 is used, it will choose an automatic value depending on the encoder.
Default value is 0.
b_qfactor float (encoding,video)
Set qp factor between P and B frames.
b_strategy integer (encoding,video) 设置选取I/P/B帧策略
Set strategy to choose between I/P/B-frames.
ps integer (encoding,video) 设置PTR负载大小
Set RTP payload size in bytes.
mv_bits integer
header_bits integer
i_tex_bits integer
p_tex_bits integer
i_count integer
p_count integer
skip_count integer
misc_bits integer
frame_bits integer
codec_tag integer
bug flags (decoding,video) BUG标志位
Workaround not auto detected encoder bugs.
Possible values:
可能的取值
‘autodetect’
‘xvid_ilace’
Xvid interlacing bug (autodetected if fourcc==XVIX)
‘ump4’
(autodetected if fourcc==UMP4)
‘no_padding’
padding bug (autodetected)
‘amv’
‘qpel_chroma’
‘std_qpel’
old standard qpel (autodetected per fourcc/version)
‘qpel_chroma2’
‘direct_blocksize’
direct-qpel-blocksize bug (autodetected per fourcc/version)
‘edge’
edge padding bug (autodetected per fourcc/version)
‘hpel_chroma’
‘dc_clip’
‘ms’
Workaround various bugs in microsoft broken decoders.
‘trunc’
trancated frames
strict integer (decoding/encoding,audio,video)
Specify how strictly to follow the standards.
Possible values:
‘very’
strictly conform to an older more strict version of the spec or reference software
‘strict’
strictly conform to all the things in the spec no matter what consequences
‘normal’
‘unofficial’
allow unofficial extensions
‘experimental’
allow non standardized experimental things, experimental (unfinished/work in progress/not well tested) decoders and encoders. Note: experimental decoders can pose a security risk, do not use this for decoding untrusted input.
b_qoffset float (encoding,video) 设置P帧与B帧之间的偏置
Set QP offset between P and B frames.
err_detect flags (decoding,audio,video) 设置错误检测标志
Set error detection flags.
Possible values:
‘crccheck’
verify embedded CRCs
‘bitstream’
detect bitstream specification deviations
‘buffer’
detect improper bitstream length
‘explode’
abort decoding on minor error detection
‘ignore_err’
ignore decoding errors, and continue decoding. This is useful if you want to analyze the content of a video and thus want everything to be decoded no matter what. This option will not result in a video that is pleasing to watch in case of errors.
‘careful’
consider things that violate the spec and have not been seen in the wild as errors
‘compliant’
consider all spec non compliancies as errors
‘aggressive’
consider things that a sane encoder should not do as an error
has_b_frames integer B帧
block_align integer 块对准
mpeg_quant integer (encoding,video)
Use MPEG quantizers instead of H.263.使用MPEG量化器替代H.263
rc_override_count integer
maxrate integer (encoding,audio,video)
Set max bitrate tolerance (in bits/s). Requires bufsize to be set. 设置最大容忍比特率,需要设置缓冲区大小
minrate integer (encoding,audio,video)
Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use elsewise. 最小容忍比特率,在CBR编码中非常有用,其他编码中收效甚微。
bufsize integer (encoding,audio,video) 缓冲区大小
Set ratecontrol buffer size (in bits).
i_qfactor float (encoding,video) 设置QP因数,介于P与I帧之间。
Set QP factor between P and I frames.
i_qoffset float (encoding,video)
Set QP offset between P and I frames.
dct integer (encoding,video) 设置离散余弦变换算法
Set DCT algorithm.
Possible values:
‘auto’
autoselect a good one (default)
‘fastint’
fast integer
‘int’
accurate integer
‘mmx’
‘altivec’
‘faan’
floating point AAN DCT
lumi_mask float (encoding,video)
Compress bright areas stronger than medium ones.
tcplx_mask float (encoding,video)
Set temporal complexity masking.
scplx_mask float (encoding,video)
Set spatial complexity masking.
p_mask float (encoding,video)
Set inter masking.
dark_mask float (encoding,video)
Compress dark areas stronger than medium ones.
idct integer (decoding/encoding,video) 选择反傅立叶变换的实现
Select IDCT implementation.
Possible values:
‘auto’
‘int’
‘simple’
‘simplemmx’
‘simpleauto’
Automatically pick a IDCT compatible with the simple one
‘arm’
‘altivec’
‘sh4’
‘simplearm’
‘simplearmv5te’
‘simplearmv6’
‘simpleneon’
‘xvid’
‘faani’
floating point AAN IDCT
slice_count integer
ec flags (decoding,video)
Set error concealment strategy.
Possible values:
‘guess_mvs’
iterative motion vector (MV) search (slow)
‘deblock’
use strong deblock filter for damaged MBs
‘favor_inter’
favor predicting from the previous frame instead of the current
bits_per_coded_sample integer
pred integer (encoding,video) 设置预测方式
Set prediction method.
Possible values:
‘left’
‘plane’
‘median’
aspect rational number (encoding,video) 设置采样宽高比
Set sample aspect ratio.
sar rational number (encoding,video)
Set sample aspect ratio. Alias to aspect.
debug flags (decoding/encoding,audio,video,subtitles) 打印具体的debug信息
Print specific debug info.
Possible values:
‘pict’
picture info
‘rc’
rate control
‘bitstream’
‘mb_type’
macroblock (MB) type
‘qp’
per-block quantization parameter (QP)
‘dct_coeff’
‘green_metadata’
display complexity metadata for the upcoming frame, GoP or for a given duration.
‘skip’
‘startcode’
‘er’
error recognition
‘mmco’
memory management control operations (H.264)
‘bugs’
‘buffers’
picture buffer allocations
‘thread_ops’
threading operations
‘nomc’
skip motion compensation
cmp integer (encoding,video)
Set full pel me compare function.
Possible values:
‘sad’
sum of absolute differences, fast (default)
‘sse’
sum of squared errors
‘satd’
sum of absolute Hadamard transformed differences
‘dct’
sum of absolute DCT transformed differences
‘psnr’
sum of squared quantization errors (avoid, low quality)
‘bit’
number of bits needed for the block
‘rd’
rate distortion optimal, slow
‘zero’
0
‘vsad’
sum of absolute vertical differences
‘vsse’
sum of squared vertical differences
‘nsse’
noise preserving sum of squared differences
‘w53’
5/3 wavelet, only used in snow
‘w97’
9/7 wavelet, only used in snow
‘dctmax’
‘chroma’
subcmp integer (encoding,video)
Set sub pel me compare function.
Possible values:
‘sad’
sum of absolute differences, fast (default)
‘sse’
sum of squared errors
‘satd’
sum of absolute Hadamard transformed differences
‘dct’
sum of absolute DCT transformed differences
‘psnr’
sum of squared quantization errors (avoid, low quality)
‘bit’
number of bits needed for the block
‘rd’
rate distortion optimal, slow
‘zero’
0
‘vsad’
sum of absolute vertical differences
‘vsse’
sum of squared vertical differences
‘nsse’
noise preserving sum of squared differences
‘w53’
5/3 wavelet, only used in snow
‘w97’
9/7 wavelet, only used in snow
‘dctmax’
‘chroma’
mbcmp integer (encoding,video)
Set macroblock compare function.
Possible values:
‘sad’
sum of absolute differences, fast (default)
‘sse’
sum of squared errors
‘satd’
sum of absolute Hadamard transformed differences
‘dct’
sum of absolute DCT transformed differences
‘psnr’
sum of squared quantization errors (avoid, low quality)
‘bit’
number of bits needed for the block
‘rd’
rate distortion optimal, slow
‘zero’
0
‘vsad’
sum of absolute vertical differences
‘vsse’
sum of squared vertical differences
‘nsse’
noise preserving sum of squared differences
‘w53’
5/3 wavelet, only used in snow
‘w97’
9/7 wavelet, only used in snow
‘dctmax’
‘chroma’
ildctcmp integer (encoding,video)
Set interlaced dct compare function. 设置交错离散余弦变换比较函数
Possible values:
‘sad’
sum of absolute differences, fast (default)
‘sse’
sum of squared errors
‘satd’
sum of absolute Hadamard transformed differences
‘dct’
sum of absolute DCT transformed differences
‘psnr’
sum of squared quantization errors (avoid, low quality)
‘bit’
number of bits needed for the block
‘rd’
rate distortion optimal, slow
‘zero’
0
‘vsad’
sum of absolute vertical differences
‘vsse’
sum of squared vertical differences
‘nsse’
noise preserving sum of squared differences
‘w53’
5/3 wavelet, only used in snow
‘w97’
9/7 wavelet, only used in snow
‘dctmax’
‘chroma’
dia_size integer (encoding,video)
Set diamond type & size for motion estimation.
‘(1024, INT_MAX)’
full motion estimation(slowest)
‘(768, 1024]’
umh motion estimation
‘(512, 768]’
hex motion estimation
‘(256, 512]’
l2s diamond motion estimation
‘[2,256]’
var diamond motion estimation
‘(-1, 2)’
small diamond motion estimation
‘-1’
funny diamond motion estimation
‘(INT_MIN, -1)’
sab diamond motion estimation
last_pred integer (encoding,video) 设置基于之前帧运动预测的数目
Set amount of motion predictors from the previous frame.
preme integer (encoding,video) 设置预运动估计
Set pre motion estimation.
precmp integer (encoding,video)
Set pre motion estimation compare function.
Possible values:
‘sad’
sum of absolute differences, fast (default)
‘sse’
sum of squared errors
‘satd’
sum of absolute Hadamard transformed differences
‘dct’
sum of absolute DCT transformed differences
‘psnr’
sum of squared quantization errors (avoid, low quality)
‘bit’
number of bits needed for the block
‘rd’
rate distortion optimal, slow
‘zero’
0
‘vsad’
sum of absolute vertical differences
‘vsse’
sum of squared vertical differences
‘nsse’
noise preserving sum of squared differences
‘w53’
5/3 wavelet, only used in snow
‘w97’
9/7 wavelet, only used in snow
‘dctmax’
‘chroma’
pre_dia_size integer (encoding,video)
Set diamond type & size for motion estimation pre-pass.
subq integer (encoding,video)
Set sub pel motion estimation quality.
me_range integer (encoding,video)
Set limit motion vectors range (1023 for DivX player).
global_quality integer (encoding,audio,video) 全局质量值
coder integer (encoding,video) 熵编码方式
Possible values:
‘vlc’
variable length coder / huffman coder
‘ac’
arithmetic coder
‘raw’
raw (no encoding)
‘rle’
run-length coder
context integer (encoding,video) 设置背景模式
Set context model.
slice_flags integer
mbd integer (encoding,video) 设置宏决策算法
Set macroblock decision algorithm (high quality mode).
Possible values:
‘simple’
use mbcmp (default)
‘bits’
use fewest bits
‘rd’
use best rate distortion
sc_threshold integer (encoding,video)
Set scene change threshold.
nr integer (encoding,video) 设置去噪声
Set noise reduction.
rc_init_occupancy integer (encoding,video)
Set number of bits which should be loaded into the rc buffer before decoding starts.
flags2 flags (decoding/encoding,audio,video,subtitles)
Possible values:
‘fast’
Allow non spec compliant speedup tricks.
‘noout’
Skip bitstream encoding.
‘ignorecrop’
Ignore cropping information from sps.
‘local_header’
Place global headers at every keyframe instead of in extradata.
‘chunks’
Frame data might be split into multiple chunks.
‘showall’
Show all frames before the first keyframe.
‘export_mvs’
Export motion vectors into frame side-data (see AV_FRAME_DATA_MOTION_VECTORS) for codecs that support it. See also doc/examples/export_mvs.c.
‘skip_manual’
Do not skip samples and export skip information as frame side data.
‘ass_ro_flush_noop’
Do not reset ASS ReadOrder field on flush.
export_side_data flags (decoding/encoding,audio,video,subtitles)
Possible values:
‘mvs’
Export motion vectors into frame side-data (see AV_FRAME_DATA_MOTION_VECTORS) for codecs that support it. See also doc/examples/export_mvs.c.
‘prft’
Export encoder Producer Reference Time into packet side-data (see AV_PKT_DATA_PRFT) for codecs that support it.
‘venc_params’
Export video encoding parameters through frame side data (see AV_FRAME_DATA_VIDEO_ENC_PARAMS) for codecs that support it. At present, those are H.264 and VP9.
‘film_grain’
Export film grain parameters through frame side data (see AV_FRAME_DATA_FILM_GRAIN_PARAMS). Supported at present by AV1 decoders.
threads integer (decoding/encoding,video)
Set the number of threads to be used, in case the selected codec implementation supports multi-threading.
Possible values:
‘auto, 0’
automatically select the number of threads to set
Default value is ‘auto’.
dc integer (encoding,video)
Set intra_dc_precision.
nssew integer (encoding,video)
Set nsse weight.
skip_top integer (decoding,video)
Set number of macroblock rows at the top which are skipped.
skip_bottom integer (decoding,video)
Set number of macroblock rows at the bottom which are skipped.
profile integer (encoding,audio,video)
Set encoder codec profile. Default value is ‘unknown’. Encoder specific profiles are documented in the relevant encoder documentation.
level integer (encoding,audio,video)
Possible values:
‘unknown’
lowres integer (decoding,audio,video)
Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions. 按照1=1/2…的原分辨率解码
skip_threshold integer (encoding,video) 设置帧跳过阈值
Set frame skip threshold.
skip_factor integer (encoding,video) 设置帧跳过因数
Set frame skip factor.
skip_exp integer (encoding,video)
Set frame skip exponent. Negative values behave identical to the corresponding positive ones, except that the score is normalized. Positive values exist primarily for compatibility reasons and are not so useful.
skipcmp integer (encoding,video)
Set frame skip compare function.
Possible values:
‘sad’
sum of absolute differences, fast (default)
‘sse’
sum of squared errors
‘satd’
sum of absolute Hadamard transformed differences
‘dct’
sum of absolute DCT transformed differences
‘psnr’
sum of squared quantization errors (avoid, low quality)
‘bit’
number of bits needed for the block
‘rd’
rate distortion optimal, slow
‘zero’
0
‘vsad’
sum of absolute vertical differences
‘vsse’
sum of squared vertical differences
‘nsse’
noise preserving sum of squared differences
‘w53’
5/3 wavelet, only used in snow
‘w97’
9/7 wavelet, only used in snow
‘dctmax’
‘chroma’
mblmin integer (encoding,video)
Set min macroblock lagrange factor (VBR).
mblmax integer (encoding,video)
Set max macroblock lagrange factor (VBR).
mepc integer (encoding,video)
Set motion estimation bitrate penalty compensation (1.0 = 256).
skip_loop_filter integer (decoding,video)
skip_idct integer (decoding,video)
skip_frame integer (decoding,video)
Make decoder discard processing depending on the frame type selected by the option value.
skip_loop_filter skips frame loop filtering, skip_idct skips frame IDCT/dequantization, skip_frame skips decoding.
Possible values:
‘none’
Discard no frame.
‘default’
Discard useless frames like 0-sized frames.
‘noref’
Discard all non-reference frames.
‘bidir’
Discard all bidirectional frames.
‘nokey’
Discard all frames excepts keyframes.
‘nointra’
Discard all frames except I frames.
‘all’
Discard all frames.
Default value is ‘default’.
bidir_refine integer (encoding,video)
Refine the two motion vectors used in bidirectional macroblocks.
brd_scale integer (encoding,video)
Downscale frames for dynamic B-frame decision.
keyint_min integer (encoding,video)
Set minimum interval between IDR-frames.
refs integer (encoding,video)
Set reference frames to consider for motion compensation.
chromaoffset integer (encoding,video)
Set chroma qp offset from luma.
trellis integer (encoding,audio,video)
Set rate-distortion optimal quantization.
mv0_threshold integer (encoding,video)
b_sensitivity integer (encoding,video)
Adjust sensitivity of b_frame_strategy 1.
compression_level integer (encoding,audio,video)
min_prediction_order integer (encoding,audio)
max_prediction_order integer (encoding,audio)
timecode_frame_start integer (encoding,video)
Set GOP timecode frame start number, in non drop frame format.
bits_per_raw_sample integer
channel_layout integer (decoding/encoding,audio)
request_channel_layout integer (decoding,audio)
Possible values:
rc_max_vbv_use float (encoding,video)
rc_min_vbv_use float (encoding,video)
ticks_per_frame integer (decoding/encoding,audio,video)
color_primaries integer (decoding/encoding,video) 基色设置
Possible values:
‘bt709’
BT.709
‘bt470m’
BT.470 M
‘bt470bg’
BT.470 BG
‘smpte170m’
SMPTE 170 M
‘smpte240m’
SMPTE 240 M
‘film’
Film
‘bt2020’
BT.2020
‘smpte428’
‘smpte428_1’
SMPTE ST 428-1
‘smpte431’
SMPTE 431-2
‘smpte432’
SMPTE 432-1
‘jedec-p22’
JEDEC P22
color_trc integer (decoding/encoding,video)
Possible values:
‘bt709’
BT.709
‘gamma22’
BT.470 M
‘gamma28’
BT.470 BG
‘smpte170m’
SMPTE 170 M
‘smpte240m’
SMPTE 240 M
‘linear’
Linear
‘log’
‘log100’
Log
‘log_sqrt’
‘log316’
Log square root
‘iec61966_2_4’
‘iec61966-2-4’
IEC 61966-2-4
‘bt1361’
‘bt1361e’
BT.1361
‘iec61966_2_1’
‘iec61966-2-1’
IEC 61966-2-1
‘bt2020_10’
‘bt2020_10bit’
BT.2020 - 10 bit
‘bt2020_12’
‘bt2020_12bit’
BT.2020 - 12 bit
‘smpte2084’
SMPTE ST 2084
‘smpte428’
‘smpte428_1’
SMPTE ST 428-1
‘arib-std-b67’
ARIB STD-B67
colorspace integer (decoding/encoding,video) 颜色空间设置
Possible values:
‘rgb’
RGB
‘bt709’
BT.709
‘fcc’
FCC
‘bt470bg’
BT.470 BG
‘smpte170m’
SMPTE 170 M
‘smpte240m’
SMPTE 240 M
‘ycocg’
YCOCG
‘bt2020nc’
‘bt2020_ncl’
BT.2020 NCL
‘bt2020c’
‘bt2020_cl’
BT.2020 CL
‘smpte2085’
SMPTE 2085
‘chroma-derived-nc’
Chroma-derived NCL
‘chroma-derived-c’
Chroma-derived CL
‘ictcp’
ICtCp
**color_range integer (decoding/encoding,video)**颜色范围设置
If used as input parameter, it serves as a hint to the decoder, which color_range the input has.
Possible values:
‘tv’
‘mpeg’
MPEG (219*2^(n-8))
‘pc’
‘jpeg’
JPEG (2^n-1)
chroma_sample_location integer (decoding/encoding,video)
Possible values:
‘left’
‘center’
‘topleft’
‘top’
‘bottomleft’
‘bottom’
log_level_offset integer
Set the log level offset.
slices integer (encoding,video)
Number of slices, used in parallelized encoding.
**thread_type flags (decoding/encoding,video)**设置多线程方式
Select which multithreading methods to use.
Use of ‘frame’ will increase decoding delay by one frame per thread, so clients which cannot provide future frames should not use it.
Possible values:
‘slice’
Decode more than one part of a single frame at once.
Multithreading using slices works only when the video was encoded with slices.
‘frame’
Decode more than one frame at once.
Default value is ‘slice+frame’.
audio_service_type integer (encoding,audio) 音频服务模式
Set audio service type.
Possible values:
‘ma’
Main Audio Service
‘ef’
Effects
‘vi’
Visually Impaired
‘hi’
Hearing Impaired
‘di’
Dialogue
‘co’
Commentary
‘em’
Emergency
‘vo’
Voice Over
‘ka’
Karaoke
request_sample_fmt sample_fmt (decoding,audio)
Set sample format audio decoders should prefer. Default value is none.
pkt_timebase rational number
sub_charenc encoding (decoding,subtitles)
Set the input subtitles character encoding.
field_order field_order (video)
Set/override the field order of the video.
Possible values:
‘progressive’
Progressive video
‘tt’
Interlaced video, top field coded and displayed first
‘bb’
Interlaced video, bottom field coded and displayed first
‘tb’
Interlaced video, top coded first, bottom displayed first
‘bt’
Interlaced video, bottom coded first, top displayed first
skip_alpha bool (decoding,video)
Set to 1 to disable processing alpha (transparency). This works like the ‘gray’ flag in the flags option which skips chroma information instead of alpha. Default is 0.
codec_whitelist list (input)
“,” separated list of allowed decoders. By default all are allowed.
dump_separator string (input)
Separator used to separate the fields printed on the command line about the Stream parameters. For example, to separate the fields with newlines and indentation: