我希望拍摄视频并以类似于Instagram使用的压缩方式对其进行压缩。哪个ffmpeg命令可以执行此操作?
答案 0 :(得分:2)
Instagram当前使用x264编码视频,而我观看的单个视频被裁剪为640x640,并且没有音频。
没有从样本中删除编码信息,因此您可以对其进行探测以推断出使用了哪些编码选项。
$ strings input.mp4 | grep x264
x264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=8 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1638 vbv_bufsize=3276 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=2:1.00
或者,您可以使用mediainfo
来获取此信息。
基本上,我的示例中使用的是默认设置(-crf 23
-preset medium
),其中包括一些其他选项:
ffmpeg -i input -maxrate 1638k -bufsize 3276k -psy 0 -aq-mode 2 -movflags +faststart output.mp4
我不会费心地逐字复制这些设置(尤其是-psy 0
),并且会尝试使用更简单的命令来查看最适合您的需求的命令。参见FFmpeg Wiki: H.264。