ffmpeg 在两帧后停止编码

ffmpeg stops encoding after two frames

我有一个使用 VLC Player 3.0.14 从 Reolink IP-Cam 捕获的 HEVC 编码的 4k 视频。我想提取视频的每一帧,但编码仅在两帧后停止。当我尝试转换为另一种视频格式时也会发生这种情况。 这发生在 Windows 和 Ubuntu 上,使用不同的 ffmpeg 版本。

我的命令是:

ffmpeg.exe -i vlc-record-2021-06-07-08h01m03s-rtsp___192.168.178.92_554_h265Preview_01_main-.mp4 output/%05d.jpg

输出为:

ffmpeg version 4.4.1-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.2.0 (Rev1, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a7960bc740] st: 1 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a7960bc740] st: 1 edit list 1 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vlc-record-2021-06-07-08h01m03s-rtsp___192.168.178.92_554_h265Preview_01_main-.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41avc1
    creation_time   : 2021-06-07T06:02:31.000000Z
    playback_requirements: QuickTime 6.0 or greater
    playback_requirements-eng: QuickTime 6.0 or greater
    encoder         : vlc 3.0.14 stream output
    encoder-eng     : vlc 3.0.14 stream output
  Duration: 00:01:27.87, start: 0.000000, bitrate: 3175 kb/s
  Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 63 kb/s (default)
    Metadata:
      creation_time   : 2021-06-07T06:02:31.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv), 3840x2160, 3154 kb/s, 12.51 fps, 12.50 tbr, 1000k tbn, 1000k tbc (default)
    Metadata:
      creation_time   : 2021-06-07T06:02:31.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (hevc (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 000002a7a57f7d80] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'output/%05d.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41avc1
    encoder         : Lavf58.76.100
    playback_requirements: QuickTime 6.0 or greater
    playback_requirements-eng: QuickTime 6.0 or greater
  Stream #0:0(eng): Video: mjpeg, yuvj420p(pc, progressive), 3840x2160, q=2-31, 200 kb/s, 12.50 fps, 12.50 tbn (default)

    Metadata:
      creation_time   : 2021-06-07T06:02:31.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.134.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=    2 fps=0.0 q=6.4 Lsize=N/A time=00:00:00.16 bitrate=N/A speed=0.197x
video:495kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

感谢您的帮助, 迈克

MP4 可能有一个编辑列表,告诉播放器构建虚拟播放时间轴。有时,此时间线可能会遗漏正确解码流所需的帧,或者同步样本 table 可能是错误的。

添加 -ignore_editlist 以在不进行任何编辑的情况下解复用流。

ffmpeg.exe -ignore_editlist 1 -i vlc-record-2021-06-07-08h01m03s-rtsp___192.168.178.92_554_h265Preview_01_main-.mp4 output/%05d.jpg