ffmpeg:将h264视频传送到一系列jpg失败

时间:2018-06-20 14:59:27

标签: 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

但是,此命令在Internet上的随机h264视频上可以很好地工作,因此我想我们的h264视频可能存在问题,但是很奇怪的是vlc播放器可以正常播放... < / p>

任何想法可能是什么问题?任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

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

ffplay -flags output_corrupt input.h264

另请参阅此similar case