Opened 11 years ago

Last modified 11 years ago

#2778 new defect

Corrupt image when transcoding H264 stream to JPEG using IB-CAM2002

Reported by: imavra Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When using the options "-i rtsp://192.168.0.220:554/stream1/ -an -r 1 -s 1280x1024 -y video.jpg" to transcode and image from a camera sream (what ZoneMinder does to record CCTV), the image ends up corrupt. When directly copying the stream to a file, however, the video can be played back normally with no sign of corruption. ffplay, however, core dumps when attempting to play the stream. Attached is an example of the corrupt image plus a raw stream.

How to reproduce:

functor@ichigo:~$ ./bin/ffmpeg -i rtsp://192.168.0.220:554/stream1/ -an -r 1 -s 1280x1024 -y video.jpg
ffmpeg version git-2013-07-09-c5a1b18 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul 11 2013 12:32:50 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/functor/ffmpeg_build --extra-cflags=-I/home/functor/ffmpeg_build/include --extra-ldflags=-L/home/functor/ffmpeg_buil               d/lib --bindir=/home/functor/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-li               btheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 11.101 / 55. 11.101
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 0xb1f2360] RTP: missed 14 packets
[h264 @ 0xb1f2360] corrupted macroblock 40 51 (total_coeff=-1)
[h264 @ 0xb1f2360] error while decoding MB 40 51
[h264 @ 0xb1f2360] concealing 1049 DC, 1049 AC, 1049 MV errors in I frame
Input #0, rtsp, from 'rtsp://192.168.0.220:554/stream1/':
  Metadata:
    title           : Test
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x1024, 90k tbr, 90k tbn, 180k tbc
Output #0, image2, to 'video.jpg':
  Metadata:
    title           : Test
    encoder         : Lavf55.11.101
    Stream #0:0: Video: mjpeg, yuvj420p, 1280x1024, q=2-31, 200 kb/s, 90k tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
[h264 @ 0xb3e4a40] corrupted macroblock 40 51 (total_coeff=-1)
[h264 @ 0xb3e4a40] error while decoding MB 40 51
[h264 @ 0xb3e4a40] concealing 1049 DC, 1049 AC, 1049 MV errors in I frame
functor@ichigo:~/bin$ ./ffplay rtsp://192.168.0.220:554/stream1/
ffplay version git-2013-07-09-c5a1b18 Copyright (c) 2003-2013 the FFmpeg developers
  built on Jul 11 2013 12:32:50 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/functor/ffmpeg_build --extra-cflags=-I/home/functor/ffmpeg_build/include --extra-ldflags=-L/home/functor/ffmpeg_build/lib --bindir=/home/functor/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 11.101 / 55. 11.101
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, rtsp, from 'rtsp://192.168.0.220:554/stream1/':0B f=0/0   
  Metadata:
    title           : Test
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x1024, 90k tbr, 90k tbn, 180k tbc
Segmentation fault (core dumped)   0KB vq=   67KB sq=    0B f=0/0

Attachments (4)

video.jpg (54.7 KB ) - added by imavra 11 years ago.
Corrupt image
video.mp4 (318.7 KB ) - added by imavra 11 years ago.
Example "vcodec copy" stream
mjpeg.zip (1.0 MB ) - added by imavra 11 years ago.
13 continuus transcodings, half corrupt
config.log (220.5 KB ) - added by Rafa Lopez 11 years ago.
config.log 2.0.1

Download all attachments as: .zip

Change History (8)

by imavra, 11 years ago

Attachment: video.jpg added

Corrupt image

by imavra, 11 years ago

Attachment: video.mp4 added

Example "vcodec copy" stream

comment:1 by imavra, 11 years ago

After futher investigation, it seems this doesn't "always" happen, if you rerun the command a few times it stops producing corrupt jpegs - which is quite strange.

comment:2 by imavra, 11 years ago

Example of 13 continuus mjpeg transcodings:

RTP: missed 46 packets0.0 size=N/A time=00:00:03.00 bitrate=N/A dup=0 drop=23
[h264 @ 0xb06e7c0] concealing 1711 DC, 1711 AC, 1711 MV errors in I frame
[h264 @ 0xae73360] RTP: missed 1 packets
[h264 @ 0xb0b3380] Cannot use next picture in error concealment
[h264 @ 0xb0b3380] concealing 1464 DC, 1464 AC, 1464 MV errors in P frame
RTP: missed 25 packets0.0 size=N/A time=00:00:04.00 bitrate=N/A dup=0 drop=32
[h264 @ 0xb0b3380] negative number of zero coeffs at 20 46
[h264 @ 0xb0b3380] error while decoding MB 20 46
[h264 @ 0xb0b3380] concealing 1469 DC, 1469 AC, 1469 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:04.00 bitrate=N/A dup=0 drop=40
[h264 @ 0xb0b3380] corrupted macroblock 39 46 (total_coeff=-1)
[h264 @ 0xb0b3380] error while decoding MB 39 46
[h264 @ 0xb0b3380] concealing 1450 DC, 1450 AC, 1450 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:05.00 bitrate=N/A dup=0 drop=55
[h264 @ 0xb0b3380] Invalid level prefix
[h264 @ 0xb0b3380] error while decoding MB 28 46
[h264 @ 0xb0b3380] concealing 1461 DC, 1461 AC, 1461 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:07.00 bitrate=N/A dup=0 drop=71
[h264 @ 0xb0b3380] corrupted macroblock 25 46 (total_coeff=-1)
[h264 @ 0xb0b3380] error while decoding MB 25 46
[h264 @ 0xb0b3380] concealing 1464 DC, 1464 AC, 1464 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:08.00 bitrate=N/A dup=0 drop=86
[h264 @ 0xb0b3380] out of range intra chroma pred mode at 24 46
[h264 @ 0xb0b3380] error while decoding MB 24 46
[h264 @ 0xb0b3380] concealing 1465 DC, 1465 AC, 1465 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:09.00 bitrate=N/A dup=0 drop=101
[h264 @ 0xb0b3380] out of range intra chroma pred mode at 18 46
[h264 @ 0xb0b3380] error while decoding MB 18 46
[h264 @ 0xb0b3380] concealing 1471 DC, 1471 AC, 1471 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:09.00 bitrate=N/A dup=0 drop=110
[h264 @ 0xb0b3380] corrupted macroblock 24 46 (total_coeff=-1)
[h264 @ 0xb0b3380] error while decoding MB 24 46
[h264 @ 0xb0b3380] concealing 1465 DC, 1465 AC, 1465 MV errors in I frame
RTP: missed 24 packets0.0 size=N/A time=00:00:10.00 bitrate=N/A dup=0 drop=125
[h264 @ 0xb0b3380] corrupted macroblock 25 46 (total_coeff=-1)
[h264 @ 0xb0b3380] error while decoding MB 25 46
[h264 @ 0xb0b3380] concealing 1464 DC, 1464 AC, 1464 MV errors in I frame
frame=   13 fps=1.6 q=0.0 Lsize=N/A time=00:00:13.00 bitrate=N/A dup=0 drop=131
video:1109kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.001937%

Half of them were ok and half of them were corrupt!

by imavra, 11 years ago

Attachment: mjpeg.zip added

13 continuus transcodings, half corrupt

comment:3 by imavra, 11 years ago

When using as the input the copied output (video.mp4), the corruption does not happen, poitning to a problem with RTSP communication.

comment:4 by Rafa Lopez, 11 years ago

I have the same problem. More information:

This error only occurs with versions of ffmpeg compiled by me. With debian repositories versions (lenny, squeze, wheezy, backports, ...) this not occurrs. I compile with:

./configure --prefix=/opt/ffmpeg-2.0.1 --enable-shared

I attach my config.log

by Rafa Lopez, 11 years ago

Attachment: config.log added

config.log 2.0.1

Note: See TracTickets for help on using tickets.