encoding - ffmpeg:将 h264 视频传输到一系列 jpg 失败

标签 encoding ffmpeg h.264 decoding

我和一个合作伙伴正在尝试使用带有以下命令行的 ffmpeg 将 h264 视频传输到一系列图像:

ffmpeg -i input.h264 -qscale:v 2 output_%03d.jpg

input.h264在vlc上可以完美播放,但是ffmpeg生成的图片就是全黑。控制台中的消息如下:
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[h264 @ 0x562ab2afd9e0] error while decoding MB 54 2, bytestream -16
[h264 @ 0x562ab2afd9e0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2afd9e0] error while decoding MB 2 9, bytestream 6907
[h264 @ 0x562ab2afd9e0] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
[h264 @ 0x562ab2afd9e0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2afd9e0] error while decoding MB 27 0, bytestream 5564
[h264 @ 0x562ab2afd9e0] deblocking filter parameters 7 13 out of range
[h264 @ 0x562ab2afd9e0] decode_slice_header error
[h264 @ 0x562ab2afd9e0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab2afd9e0] deblocking filter parameters 7 -14 out of range
[h264 @ 0x562ab2afd9e0] decode_slice_header error
[h264 @ 0x562ab2afd9e0] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
[h264 @ 0x562ab2afd9e0] deblocking filter parameters -7 0 out of range
[h264 @ 0x562ab2afd9e0] decode_slice_header error
[h264 @ 0x562ab2afd9e0] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
[h264 @ 0x562ab2afd9e0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2afd9e0] error while decoding MB 9 0, bytestream 6647
[h264 @ 0x562ab2afd9e0] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
[h264 @ 0x562ab2afd9e0] top block unavailable for requested intra mode
[h264 @ 0x562ab2afd9e0] error while decoding MB 16 9, bytestream 6182
[h264 @ 0x562ab2afd9e0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2afd9e0] error while decoding MB 6 18, bytestream 7043
[h264 @ 0x562ab2afd9e0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab2afc8c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, h264, from 'temp_file.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, progressive), 1280x720, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[h264 @ 0x562ab2b2f900] error while decoding MB 54 2, bytestream -16
[h264 @ 0x562ab2b2f900] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2b2f900] error while decoding MB 2 9, bytestream 6907
[h264 @ 0x562ab2b2f900] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
[h264 @ 0x562ab2b01080] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2b01080] error while decoding MB 27 0, bytestream 5564
[h264 @ 0x562ab2b01080] deblocking filter parameters 7 13 out of range
[h264 @ 0x562ab2b01080] decode_slice_header error
[h264 @ 0x562ab2b01080] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab2c49240] deblocking filter parameters 7 -14 out of range
[h264 @ 0x562ab2c49240] decode_slice_header error
[h264 @ 0x562ab2c49240] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
Output #0, image2, to 'output_%03d.jpg':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.107.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[h264 @ 0x562ab2b7fec0] deblocking filter parameters -7 0 out of range
[h264 @ 0x562ab2b7fec0] decode_slice_header error
[h264 @ 0x562ab2b7fec0] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
[h264 @ 0x562ab2c15240] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c15240] error while decoding MB 9 0, bytestream 6647
[h264 @ 0x562ab2c15240] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
[h264 @ 0x562ab2c315a0] top block unavailable for requested intra mode
[h264 @ 0x562ab2c315a0] error while decoding MB 16 9, bytestream 6182
[h264 @ 0x562ab2c315a0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c315a0] error while decoding MB 6 18, bytestream 7043
[h264 @ 0x562ab2c315a0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab2c447a0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c447a0] error while decoding MB 12 9, bytestream 6863
[h264 @ 0x562ab2c447a0] concealing 1342 DC, 1342 AC, 1342 MV errors in P frame
[h264 @ 0x562ab2bb9180] top block unavailable for requested intra mode
[h264 @ 0x562ab2bb9180] error while decoding MB 29 18, bytestream 6611
[h264 @ 0x562ab2bb9180] concealing 1405 DC, 1405 AC, 1405 MV errors in P frame
[h264 @ 0x562ab2bd54e0] top block unavailable for requested intra mode
[h264 @ 0x562ab2bd54e0] error while decoding MB 25 9, bytestream 6051
[h264 @ 0x562ab2bd54e0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2bd54e0] error while decoding MB 70 18, bytestream 5088
[h264 @ 0x562ab2bd54e0] concealing 1419 DC, 1419 AC, 1419 MV errors in P frame
[h264 @ 0x562ab2bf1840] top block unavailable for requested intra mode
[h264 @ 0x562ab2bf1840] error while decoding MB 14 9, bytestream 6071
[h264 @ 0x562ab2bf1840] deblocking filter parameters -9 0 out of range
[h264 @ 0x562ab2bf1840] decode_slice_header error
[h264 @ 0x562ab2bf1840] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab318e0a0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab318e0a0] error while decoding MB 54 9, bytestream 4422
[h264 @ 0x562ab318e0a0] concealing 1256 DC, 1256 AC, 1256 MV errors in P frame
[h264 @ 0x562ab31aa020] top block unavailable for requested intra mode -1
[h264 @ 0x562ab31aa020] error while decoding MB 22 9, bytestream 5862
[h264 @ 0x562ab31aa020] concealing 1335 DC, 1335 AC, 1335 MV errors in P frame
[h264 @ 0x562ab2d5a8c0] deblocking filter parameters 7 -4 out of range
[h264 @ 0x562ab2d5a8c0] decode_slice_header error
[h264 @ 0x562ab2d5a8c0] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
[h264 @ 0x562ab2b2f900] concealing 1319 DC, 1319 AC, 1319 MV errors in P frame
[h264 @ 0x562ab2b01080] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2b01080] error while decoding MB 16 9, bytestream 6218
[h264 @ 0x562ab2b01080] concealing 1416 DC, 1416 AC, 1416 MV errors in P frame
[h264 @ 0x562ab2c49240] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c49240] error while decoding MB 12 0, bytestream 6854
[h264 @ 0x562ab2c49240] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c49240] error while decoding MB 2 9, bytestream 7092
[h264 @ 0x562ab2c49240] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab2b7fec0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2b7fec0] error while decoding MB 59 0, bytestream 4955
[h264 @ 0x562ab2b7fec0] deblocking filter parameters 7 15 out of range
[h264 @ 0x562ab2b7fec0] decode_slice_header error
[h264 @ 0x562ab2b7fec0] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
[h264 @ 0x562ab2c15240] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c15240] error while decoding MB 34 0, bytestream 5338
[h264 @ 0x562ab2c15240] deblocking filter parameters 7 13 out of range
[h264 @ 0x562ab2c15240] decode_slice_header error
[h264 @ 0x562ab2c15240] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x562ab2c315a0] concealing 1344 DC, 1344 AC, 1344 MV errors in P frame
[h264 @ 0x562ab2c447a0] top block unavailable for requested intra mode -1
[h264 @ 0x562ab2c447a0] error while decoding MB 49 9, bytestream 4992
[h264 @ 0x562ab2c447a0] concealing 1228 DC, 1228 AC, 1228 MV errors in P frame
frame=   21 fps=0.0 q=2.0 Lsize=N/A time=00:00:00.70 bitrate=N/A speed=1.31x    
video:601kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

但是,这个命令在互联网上的随机 h264 视频上运行得非常好,所以我猜我们的 h264 视频可能有问题,但奇怪的是它可以被 vlc 播放器播放得很好......

知道问题可能是什么吗?任何帮助将不胜感激!

最佳答案

您的文件的开头似乎已损坏。它是如何产生的?尝试

ffplay -flags output_corrupt input.h264

另请参阅 similar case .

关于encoding - ffmpeg:将 h264 视频传输到一系列 jpg 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50951260/

相关文章:

java - 在 SCALA 中使用动态值进行 Base64 JAVA 编码 - GATLING

php - 使用 Internet Explorer %u20AC 到 € 的 UTF-8 编码

python - 统一码解密

python - 如何使用 discord.py 在音乐机器人上获得最佳音频质量?

ios - 在 iOS 上解码编码为 H.264 的单帧

ruby - 在 Ruby 中,如何对这个奇怪的字符进行 UTF-8 编码?

android - FFmpeg - 在多个调用中将帧添加到 MP4

video - 转码为 webm 时的 Ffmpeg 性能问题

ffmpeg - 如何在 Ubuntu 12.04 上使用 FFMPEG 将 h264 转码为 h265?

android - 要通过 libstagefright 在 android 中使用 HW 解码器,在元数据中为 kKeyAVCC 设置什么以进行帧基础解码而不是 MP4 播放?