我正在使用 powershell 中的 ffmpeg,
ffmpeg.exe -i i.mp4 o.mp4 -crf 22
由于某种原因,视频帧速率从 59.99 更改为 120。您知道为什么会发生这种情况吗?如何使用源帧速率而不将其设置为数字-r
?
编码之前我得到了以下报告:
ffmpeg version N-83781-g3016e91 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 48.100 / 55. 48.100
libavcodec 57. 82.102 / 57. 82.102
libavformat 57. 66.103 / 57. 66.103
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 74.100 / 6. 74.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'i.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
Duration: 00:15:00.17, start: 0.000000, bitrate: 31455 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt470bg/bt470bg/smpte170m), 1920x1080, 31431 kb/s, 59.99 fps, 120 tbr, 1k tbn, 2k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 15 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 00000000053af4e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000053af4e0] profile High, level 5.1
[libx264 @ 00000000053af4e0] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 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 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'o.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf57.66.103
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 1920x1080, q=-1--1, 120 fps, 15360 tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.82.102 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 8000 Hz, mono, fltp, 48 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.82.102 aac
答案1
59.99 fps, 120 tbr
--> 该文件看起来是可变帧速率的。虽然平均速率为 59.99 fps,但峰值帧速率为 120 fps。默认情况下,FFmpeg 的 MP4 复用器会写入恒定帧速率文件。这样做的目的是保持峰值速率,以免丢帧。在帧速率低于峰值速率的流区域中,它将复制帧以匹配峰值速率。当然,如果差异很大,这会导致大量帧重复。
您可以通过更改视频同步方法来禁用此行为。
ffmpeg.exe -i i.mp4 -vsync 0 -crf 22 -c:a copy o.mp4
-vsync 0
将视频同步方法更改为直通,从而抑制帧重复。-c:a copy
重新混合音频,跳过重新编码。