将有问题的 9.99fps 视频转换为标准视频(ffmpeg?)

将有问题的 9.99fps 视频转换为标准视频(ffmpeg?)

我最近通过 FOIA/PA 请求获得了一些 CCTV 视频。我想将完整版本以及使用 Final Cut Pro 编辑的版本发布到 YouTube 上。但是,Handbrake、Quicktime、Final Cut Pro 和 YouTube 都无法打开原始 .avi 文件。:-(

ffmpeg -i对于 avi 输入 #0 (没有音频部分):

  Duration: 00:48:48.73, start: 0.000000, bitrate: 2497 kb/s
    Stream #0:0: Video: h264 (Main) (V264 / 0x34363256), yuv420p, 1280x960, 2495 kb/s, 9.99 fps, 9.99 tbr, 9.99 tbn, 19.98 tbc

Handbrake 的日志显示了这一点,然后才放弃“未找到有效来源”(请注意与 tbr 的差异ffmpeg -i):

  Duration: 00:48:48.72, start: 0.000000, bitrate: 2497 kb/s
    Stream #0.0: Video: V264 / 0x34363256, 1280x960, 10 fps, 29.97 tbr, 9.99 tbn
[13:54:47] scan: decoding previews for title 1
[13:55:28] scan: could not get a decoded picture
[13:55:38] scan: could not get a decoded picture
[13:55:43] scan: could not get a decoded picture
[13:55:49] scan: could not get a decoded picture
[13:55:54] scan: could not get a decoded picture
[13:55:58] scan: could not get a decoded picture
[13:56:03] scan: could not get a decoded picture
[13:56:06] scan: could not get a decoded picture
[13:56:07] Warning: Could not read data for preview 9, skipped
[13:56:07] Warning: Could not read data for preview 10, skipped
[13:56:07] libhb: scan thread found 0 valid title(s)
[13:56:07] macgui: ScanDone state received from fHandle

甚高频液晶能够很好地播放它,但我无法让 VLC 将其转码为可用的东西;尝试将其转码为 m4v并将其导入 FCP,当 FCP 尝试将其转换为正常 FPS 时,结果出现了奇怪的卡顿和太空步视频。(编辑:不是 FCP 的错;转码本身有问题。现在也尝试过将 VLC 的转码为 mp4 h264,并将 fps 设置为 @ 30 [除了不设置 fps 和它的转码向导];fps@30 的尝试甚至没有输出任何可播放的内容。><)

我如何将其转换为正常大小/ fps / 编解码器,以便我可以在 FCP 中编辑它并将其上传到 YouTube眼镜

我猜测 ffmpeg 应该能够完成这项工作,但我不确定如何去做。

ETA:现在尝试这个:ffmpeg -i input.avi -r "29.97" -an -sn -c:v libx264 -qp 0 -preset ultrafast -pix_fmt yuv420p -f mp4 -benchmark output.mp4- 在这个阶段不尝试压缩,只是为了让它在 FCP 和 YT 中可行。

ETA2:以上输出可在 VLC 中播放,但不能在 QT 或 FCP 中播放(但尚未让 FCP 将其转码为优化/代理媒体)。在 VLC 中,它确实有 29.97 fps,没有卡顿。大约是原始大小的 11 倍(~11.5GB vs 914MB)oo

再次尝试使用-crf 18 -preset slow而不是 ,qp 0 -preset ultrafast看看是否可以获得更易于管理的大小,而没有明显的质量损失。ffmpeg 文档确实警告说,许多东西与无损不兼容(但 YouTube 兼容)。

ETA3:看起来最后一个成功了。可以在 QuickTime 和 FCP 中查看。现在正在将部分编辑上传到 YT。太棒了!

答案1

以下是最终对我有用的方法:

ffmpeg -i input.avi -r "29.97" -an -sn -c:v libx264 -crf 18 -preset slow -pix_fmt yuv420p -f mp4 -benchmark output.mp4

细节:

ffmpeg version 2.4.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep 28 2014 17:37:55 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Input #0, avi, from 'input.avi':
  Duration: 00:48:48.73, start: 0.000000, bitrate: 2497 kb/s
    Stream #0:0: Video: h264 (Main) (V264 / 0x34363256), yuv420p, 1280x960, 2495 kb/s, 9.99 fps, 9.99 tbr, 9.99 tbn, 19.98 tbc
[libx264 @ 0x7ff583005800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ff583005800] profile High, level 4.0
[libx264 @ 0x7ff583005800] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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=6 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=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x960, q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.1.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=87772 fps= 11 q=-1.0 Lsize= 1800751kB time=00:48:48.59 bitrate=5037.1kbits/s dup=58545 drop=0
video:1799693kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.058756%
bench: utime=18905.661s
bench: maxrss=381239296kB
[libx264 @ 0x7ff583005800] frame I:352   Avg QP:13.93  size:362691
[libx264 @ 0x7ff583005800] frame P:28322 Avg QP:16.87  size: 48853
[libx264 @ 0x7ff583005800] frame B:59098 Avg QP:20.71  size:  5611
[libx264 @ 0x7ff583005800] consecutive B-frames:  2.3% 23.2%  1.5% 73.0%
[libx264 @ 0x7ff583005800] mb I  I16..4: 14.7% 27.1% 58.2%
[libx264 @ 0x7ff583005800] mb P  I16..4:  0.8%  1.1%  1.1%  P16..4: 43.3%  7.4%  6.6%  0.0%  0.0%    skip:39.7%
[libx264 @ 0x7ff583005800] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 18.8%  2.0%  0.8%  direct: 1.6%  skip:76.5%  L0:49.7% L1:46.8% BI: 3.4%
[libx264 @ 0x7ff583005800] 8x8 transform intra:35.1% inter:14.5%
[libx264 @ 0x7ff583005800] direct mvs  spatial:100.0% temporal:0.0%
[libx264 @ 0x7ff583005800] coded y,uvDC,uvAC intra: 87.7% 87.0% 66.9% inter: 15.9% 13.2% 7.3%
[libx264 @ 0x7ff583005800] i16 v,h,dc,p: 10%  9% 19% 63%
[libx264 @ 0x7ff583005800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 17% 16%  6%  7%  7% 10%  8% 13%
[libx264 @ 0x7ff583005800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12%  9%  8%  9% 11% 10% 12% 11% 18%
[libx264 @ 0x7ff583005800] i8c dc,h,v,p: 52% 17% 20% 10%
[libx264 @ 0x7ff583005800] Weighted P-Frames: Y:0.1% UV:0.0%
[libx264 @ 0x7ff583005800] ref P L0: 82.7%  3.9%  6.2%  5.1%  1.7%  0.4%  0.0%
[libx264 @ 0x7ff583005800] ref B L0: 93.4%  4.4%  1.9%  0.3%
[libx264 @ 0x7ff583005800] ref B L1: 97.6%  2.4%
[libx264 @ 0x7ff583005800] kb/s:5034.07

相关内容