从 H.264 中挤出 4K+?

从 H.264 中挤出 4K+?

我正在使用 FFMpeg 从静止图像生成感知无损的 H.264 延时视频,其中“无损”意味着我保留了原始照片的 5184 x 3456 分辨率,同时获得了帧间压缩的好处,从而实现了高效存档。

H.264 不应该支持 5184 x 3456,但是当我选择 4.2.0(我认为适合我的佳能 7D JPEG 压缩图像)时,它似乎可以工作,除了以下几点:

  1. 我收到了一些我不完全理解的警告
  2. 有些玩家/NLM 不喜欢生成的视频

我首选的 NLM(例如 DaVinci Resolve)在播放剪辑时会卡住,但在其他方面可以正常工作,这就提出了一个问题:我可以忽略这些警告并继续使用吗?或者,几年后我会发现我的延时剪辑存在缺陷并且不再可用吗?也许我应该改用其他编解码器(例如 H.265)?

这是我正在使用的命令:

ffmpeg -framerate 24 -start_number 142 -i IMG_%04d.JPG -c:v libx264 -preset veryslow -crf 18 -pix_fmt yuv420p output.mp4

输出如下:

ffmpeg version N-86482-gbc40674 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --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. 66.100 / 55. 66.100
  libavcodec     57. 99.100 / 57. 99.100
  libavformat    57. 73.100 / 57. 73.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 92.100 /  6. 92.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, image2, from 'IMG_%04d.JPG':
  Duration: 00:00:36.83, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 5184x3456, 24 tbr, 24 tbn, 24 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 00000000026245e0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0000000000729ae0] frame MB size (324x216) > level limit (36864)
[libx264 @ 0000000000729ae0] DPB size (16 frames, 1119744 mbs) > level limit (2 frames, 184320 mbs)
[libx264 @ 0000000000729ae0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000000729ae0] profile High, level 5.2
[libx264 @ 0000000000729ae0] 264 - core 150 r2833 df79067 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=60 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 'recording_studio_construction_20121031_5609.mp4':
  Metadata:
    encoder         : Lavf57.73.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 5184x3456, q=-1--1, 24 fps, 12288 tbn, 24 tbc
    Metadata:
      encoder         : Lavc57.99.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=  884 fps=0.5 q=-1.0 Lsize=  253252kB time=00:00:36.70 bitrate=56516.8kbits/s speed=0.0214x     x
video:253240kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004778%
[libx264 @ 0000000000729ae0] frame I:4     Avg QP:15.60  size:1304736
[libx264 @ 0000000000729ae0] frame P:178   Avg QP:17.96  size:430397
[libx264 @ 0000000000729ae0] frame B:702   Avg QP:18.48  size:252831
[libx264 @ 0000000000729ae0] consecutive B-frames:  2.6%  2.9%  5.1% 10.0% 19.8% 19.0% 11.9% 22.6%  6.1%
[libx264 @ 0000000000729ae0] mb I  I16..4:  7.5% 86.8%  5.7%
[libx264 @ 0000000000729ae0] mb P  I16..4:  2.1%  4.3%  0.4%  P16..4: 64.4% 13.2% 11.8%  0.0%  0.0%    skip: 3.9%
[libx264 @ 0000000000729ae0] mb B  I16..4:  0.2%  0.5%  0.0%  B16..8: 46.9% 11.4%  1.5%  direct:12.2%  skip:27.3%  L0:62.1% L1:36.0% BI: 1.9%
[libx264 @ 0000000000729ae0] 8x8 transform intra:68.7% inter:61.7%
[libx264 @ 0000000000729ae0] direct mvs  spatial:99.0% temporal:1.0%
[libx264 @ 0000000000729ae0] coded y,uvDC,uvAC intra: 69.4% 57.1% 15.4% inter: 29.5% 29.9% 0.1%
[libx264 @ 0000000000729ae0] i16 v,h,dc,p: 25% 20% 11% 44%
[libx264 @ 0000000000729ae0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7%  7%  6% 12% 15% 12% 15% 12% 14%
[libx264 @ 0000000000729ae0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  6% 12%  3% 12% 15% 12% 14% 11% 15%
[libx264 @ 0000000000729ae0] i8c dc,h,v,p: 28% 40% 22% 10%
[libx264 @ 0000000000729ae0] Weighted P-Frames: Y:18.0% UV:6.2%
[libx264 @ 0000000000729ae0] ref P L0: 27.0%  4.9% 14.1%  8.7%  7.5%  6.8%  5.9%  3.5%  3.3%  3.1%  2.7%  2.9%  2.7%  2.6%  2.6%  1.8%
[libx264 @ 0000000000729ae0] ref B L0: 30.7% 15.7% 12.0%  7.4%  6.2%  5.5%  4.8%  3.2%  3.0%  2.7%  2.5%  2.3%  2.1%  1.4%  0.4%
[libx264 @ 0000000000729ae0] ref B L1: 85.3% 14.7%
[libx264 @ 0000000000729ae0] kb/s:56322.30

任何建议都值得感激。

答案1

FFmpeg 会抱怨生成的比特流不符合任何级别。您可以忽略这一点,因为 ffmpeg 至少会解码其输出。其他软件播放器也是如此。硬件播放器可能会失败。

相关内容