使用 ffmpeg 压缩视频同时保持高帧率

使用 ffmpeg 压缩视频同时保持高帧率

更新:我在另一台机器上观看了输出视频,一切正常。问题肯定出在我用来观看视频的程序上。没关系。

我正在尝试压缩用佳能相机拍摄的视频以便存储。不幸的是,输出视频的帧速率降低了,这导致视频不流畅。我尝试使用 -r 25 来增加帧速率,但没有什么不同。ffmpeg 似乎忽略了该选项。有没有办法强制 ffmpeg 使用更高质量的可变帧速率或恒定帧速率?我需要使用不同的视频编解码器吗?我需要使用 ffmpeg 以外的其他东西吗?经过大量研究,我还没有取得任何进展。如果需要,我可以添加输入和输出视频的链接。这是一个示例运行:

H:\test>ffmpeg -i input.mov -c:v libx264 -crf 23 -r 25 -force_fps -c:a aac -stri
ct experimental out.mp4
ffmpeg version N-59532-gadc09a3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2014 22:01:54 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 47.100 / 55. 47.100
  libavformat    55. 22.102 / 55. 22.102
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.103 /  4.  0.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537331968
    compatible_brands: qt  CAEP
    creation_time   : 2013-09-05 22:18:02
  Duration: 00:00:17.04, start: 0.000000, bitrate: 21175 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yu
vj420p(pc, smpte170m), 1280x720, 19592 kb/s, 25 fps, 25 tbr, 25k tbn, 50k tbc (d
efault)
    Metadata:
      creation_time   : 2013-09-05 22:18:02
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s1
6, 1536 kb/s (default)
    Metadata:
      creation_time   : 2013-09-05 22:18:02
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0319fc20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0319fc20] profile High, level 3.1
[libx264 @ 0319fc20] 264 - core 140 r2377 1ca7bb9 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=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 scenec
ut=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 'out.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537331968
    compatible_brands: qt  CAEP
    encoder         : Lavf55.22.102
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p,
1280x720, q=-1--1, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2013-09-05 22:18:02
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, flt
p, 128 kb/s (default)
    Metadata:
      creation_time   : 2013-09-05 22:18:02
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (pcm_s16le -> aac)
Press [q] to stop, [?] for help
frame=   46 fps=0.0 q=0.0 size=       0kB time=00:00:01.89 bitrate=   0.2kbits/s
frame=   53 fps= 41 q=28.0 size=      77kB time=00:00:02.34 bitrate= 268.0kbits/
frame=   58 fps= 33 q=28.0 size=     152kB time=00:00:02.34 bitrate= 531.2kbits/
frame=   65 fps= 27 q=28.0 size=     246kB time=00:00:02.83 bitrate= 711.6kbits/
frame=   70 fps= 24 q=28.0 size=     303kB time=00:00:02.85 bitrate= 869.2kbits/
frame=   76 fps= 22 q=28.0 size=     370kB time=00:00:03.30 bitrate= 916.8kbits/
frame=   82 fps= 20 q=28.0 size=     437kB time=00:00:03.30 bitrate=1082.6kbits/
frame=   87 fps= 19 q=26.0 size=     505kB time=00:00:03.79 bitrate=1089.7kbits/
frame=   94 fps= 19 q=28.0 size=     630kB time=00:00:03.79 bitrate=1358.8kbits/
frame=   99 fps= 18 q=28.0 size=     708kB time=00:00:04.26 bitrate=1358.9kbits/
frame=  104 fps= 17 q=28.0 size=     782kB time=00:00:04.26 bitrate=1502.3kbits/
frame=  111 fps= 16 q=28.0 size=     913kB time=00:00:04.75 bitrate=1572.5kbits/
frame=  117 fps= 16 q=28.0 size=    1004kB time=00:00:04.75 bitrate=1729.6kbits/
frame=  124 fps= 15 q=28.0 size=    1104kB time=00:00:05.22 bitrate=1729.9kbits/
frame=  130 fps= 15 q=28.0 size=    1217kB time=00:00:05.22 bitrate=1907.4kbits/
frame=  135 fps= 14 q=28.0 size=    1372kB time=00:00:05.71 bitrate=1966.4kbits/
frame=  139 fps= 14 q=28.0 size=    1538kB time=00:00:05.71 bitrate=2203.6kbits/
frame=  142 fps= 13 q=28.0 size=    1644kB time=00:00:05.73 bitrate=2346.4kbits/
frame=  148 fps= 13 q=28.0 size=    1838kB time=00:00:06.18 bitrate=2433.3kbits/
frame=  153 fps= 13 q=28.0 size=    2016kB time=00:00:06.18 bitrate=2669.4kbits/
frame=  157 fps= 13 q=28.0 size=    2170kB time=00:00:06.67 bitrate=2662.2kbits/
frame=  162 fps= 12 q=28.0 size=    2398kB time=00:00:06.67 bitrate=2942.2kbits/
frame=  166 fps= 12 q=28.0 size=    2556kB time=00:00:06.67 bitrate=3135.8kbits/
frame=  171 fps= 12 q=28.0 size=    2745kB time=00:00:07.14 bitrate=3146.4kbits/
frame=  177 fps= 12 q=28.0 size=    2987kB time=00:00:07.14 bitrate=3424.4kbits/
frame=  182 fps= 12 q=28.0 size=    3223kB time=00:00:07.63 bitrate=3457.1kbits/
frame=  188 fps= 12 q=28.0 size=    3481kB time=00:00:07.63 bitrate=3734.2kbits/
frame=  193 fps= 12 q=28.0 size=    3688kB time=00:00:08.10 bitrate=3726.3kbits/
frame=  198 fps= 11 q=28.0 size=    3894kB time=00:00:08.10 bitrate=3934.8kbits/
frame=  202 fps= 11 q=28.0 size=    4084kB time=00:00:08.10 bitrate=4126.8kbits/
frame=  208 fps= 11 q=28.0 size=    4388kB time=00:00:08.59 bitrate=4181.1kbits/
frame=  213 fps= 11 q=28.0 size=    4592kB time=00:00:08.59 bitrate=4375.6kbits/
frame=  218 fps= 11 q=28.0 size=    4805kB time=00:00:09.06 bitrate=4341.8kbits/
frame=  222 fps= 11 q=28.0 size=    4976kB time=00:00:09.06 bitrate=4495.5kbits/
frame=  226 fps= 11 q=28.0 size=    5139kB time=00:00:09.17 bitrate=4589.1kbits/
frame=  231 fps= 11 q=28.0 size=    5388kB time=00:00:09.55 bitrate=4618.3kbits/
frame=  236 fps= 11 q=28.0 size=    5597kB time=00:00:09.55 bitrate=4797.0kbits/
frame=  241 fps= 11 q=28.0 size=    5820kB time=00:00:10.02 bitrate=4754.9kbits/
frame=  244 fps= 10 q=28.0 size=    5929kB time=00:00:10.02 bitrate=4844.1kbits/
frame=  247 fps= 10 q=25.0 size=    6074kB time=00:00:10.02 bitrate=4962.3kbits/
frame=  252 fps= 10 q=28.0 size=    6366kB time=00:00:10.51 bitrate=4958.3kbits/
frame=  257 fps= 10 q=28.0 size=    6678kB time=00:00:10.51 bitrate=5201.1kbits/
frame=  260 fps= 10 q=28.0 size=    6888kB time=00:00:10.51 bitrate=5365.1kbits/
frame=  265 fps= 10 q=28.0 size=    7162kB time=00:00:10.98 bitrate=5340.1kbits/
frame=  269 fps=9.9 q=28.0 size=    7360kB time=00:00:10.98 bitrate=5487.6kbits/
frame=  273 fps=9.9 q=28.0 size=    7577kB time=00:00:10.98 bitrate=5650.0kbits/
frame=  276 fps=9.8 q=28.0 size=    7793kB time=00:00:11.47 bitrate=5562.6kbits/
frame=  280 fps=9.7 q=28.0 size=    7997kB time=00:00:11.47 bitrate=5708.1kbits/
frame=  284 fps=9.6 q=28.0 size=    8242kB time=00:00:11.47 bitrate=5882.8kbits/
frame=  289 fps=9.5 q=28.0 size=    8546kB time=00:00:11.94 bitrate=5860.2kbits/
frame=  293 fps=9.5 q=28.0 size=    8783kB time=00:00:11.94 bitrate=6023.0kbits/
frame=  298 fps=9.4 q=28.0 size=    9060kB time=00:00:11.94 bitrate=6212.6kbits/
frame=  302 fps=9.4 q=28.0 size=    9312kB time=00:00:12.43 bitrate=6133.1kbits/
frame=  306 fps=9.3 q=28.0 size=    9535kB time=00:00:12.43 bitrate=6280.6kbits/
frame=  309 fps=9.3 q=28.0 size=    9701kB time=00:00:12.43 bitrate=6389.6kbits/
frame=  313 fps=9.2 q=28.0 size=    9923kB time=00:00:12.90 bitrate=6298.4kbits/
frame=  316 fps=9.2 q=28.0 size=   10074kB time=00:00:12.90 bitrate=6394.2kbits/
frame=  321 fps=9.1 q=28.0 size=   10300kB time=00:00:12.90 bitrate=6537.8kbits/
frame=  326 fps=9.1 q=28.0 size=   10542kB time=00:00:13.39 bitrate=6445.9kbits/
frame=  332 fps=9.1 q=28.0 size=   10853kB time=00:00:13.39 bitrate=6636.1kbits/
frame=  337 fps=9.0 q=28.0 size=   11126kB time=00:00:13.86 bitrate=6573.2kbits/
frame=  342 fps=9.0 q=28.0 size=   11391kB time=00:00:13.86 bitrate=6729.7kbits/
frame=  346 fps=9.0 q=28.0 size=   11588kB time=00:00:14.16 bitrate=6701.2kbits/
frame=  351 fps=9.0 q=28.0 size=   11843kB time=00:00:14.35 bitrate=6757.5kbits/
frame=  355 fps=9.0 q=28.0 size=   12061kB time=00:00:14.35 bitrate=6881.6kbits/
frame=  361 fps=9.0 q=28.0 size=   12349kB time=00:00:14.82 bitrate=6822.8kbits/
frame=  367 fps=9.0 q=28.0 size=   12620kB time=00:00:14.82 bitrate=6972.6kbits/
frame=  372 fps=9.0 q=28.0 size=   12868kB time=00:00:15.31 bitrate=6881.9kbits/
frame=  377 fps=8.9 q=28.0 size=   13054kB time=00:00:15.31 bitrate=6981.7kbits/
frame=  382 fps=8.9 q=28.0 size=   13284kB time=00:00:15.31 bitrate=7104.7kbits/
frame=  388 fps=9.0 q=28.0 size=   13538kB time=00:00:15.78 bitrate=7025.1kbits/
frame=  393 fps=9.0 q=28.0 size=   13740kB time=00:00:15.78 bitrate=7129.9kbits/
frame=  397 fps=8.9 q=28.0 size=   13918kB time=00:00:16.27 bitrate=7004.5kbits/
frame=  403 fps=9.0 q=28.0 size=   14150kB time=00:00:16.27 bitrate=7121.2kbits/
frame=  408 fps=9.0 q=28.0 size=   14338kB time=00:00:16.74 bitrate=7013.8kbits/
frame=  412 fps=9.0 q=28.0 size=   14494kB time=00:00:16.74 bitrate=7090.2kbits/
frame=  417 fps=9.0 q=28.0 size=   14663kB time=00:00:16.74 bitrate=7172.7kbits/
frame=  423 fps=9.0 q=28.0 size=   14918kB time=00:00:16.98 bitrate=7196.5kbits/
frame=  426 fps=8.1 q=-1.0 Lsize=   17139kB time=00:00:17.04 bitrate=8237.1kbits
/s
video:16860kB audio:267kB subtitle:0 global headers:0kB muxing overhead 0.074326
%
[libx264 @ 0319fc20] frame I:7     Avg QP:22.59  size: 32989
[libx264 @ 0319fc20] frame P:297   Avg QP:26.67  size: 47713
[libx264 @ 0319fc20] frame B:122   Avg QP:29.30  size: 23459
[libx264 @ 0319fc20] consecutive B-frames: 43.0% 56.3%  0.7%  0.0%
[libx264 @ 0319fc20] mb I  I16..4: 34.1% 58.2%  7.7%
[libx264 @ 0319fc20] mb P  I16..4:  5.9% 14.0%  6.5%  P16..4: 43.0% 18.8%  9.0%
 0.0%  0.0%    skip: 2.8%
[libx264 @ 0319fc20] mb B  I16..4:  0.6%  1.2%  0.5%  B16..8: 50.5% 11.3%  3.1%
 direct:14.7%  skip:18.1%  L0:38.2% L1:37.5% BI:24.3%
[libx264 @ 0319fc20] 8x8 transform intra:53.3% inter:48.3%
[libx264 @ 0319fc20] coded y,uvDC,uvAC intra: 67.6% 70.7% 24.2% inter: 56.1% 47.
0% 1.4%
[libx264 @ 0319fc20] i16 v,h,dc,p: 16% 24% 21% 39%
[libx264 @ 0319fc20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 22% 24%  5%  5%  5%  7%
 6%  8%
[libx264 @ 0319fc20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 21% 19%  6%  7%  6%  7%
 7%  7%
[libx264 @ 0319fc20] i8c dc,h,v,p: 54% 25% 16%  5%
[libx264 @ 0319fc20] Weighted P-Frames: Y:20.5% UV:14.8%
[libx264 @ 0319fc20] ref P L0: 63.8% 21.7% 10.3%  4.0%  0.2%
[libx264 @ 0319fc20] ref B L0: 94.9%  5.1%  0.0%
[libx264 @ 0319fc20] ref B L1: 100.0%  0.0%
[libx264 @ 0319fc20] kb/s:8105.05

相关内容