Opened 7 months ago

Last modified 7 months ago

#7069 open defect

H.264 decoder fails and not restores into correct decoding after error

Reported by: xzerth Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: h264
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

FFmpeg transcodes stream and after some error in stream decoder fails and can't restore it's normal operational condition and defects output bitstream (it seems that defect at decoding stage).

How to reproduce:

% ffmpeg -i pipe:0 -b:0 1800k -maxrate:0 2000k -codec:0 libx264 -bufsize:0 1710k -preset:0 faster -streamid 0:101 -map 0:v -f mpegts pipe:1 < squared_cut.ts > outff.ts
ffmpeg version N-90223-g8218249 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
  configuration: --prefix=/usr/local --pkg-config-flags=--static --enable-static --disable-shared --disable-avdevice --enable-runtime-cpudetect --enable-gpl --enable-libx264 --enable-libx265 --enable-libmp3lame --extra-libs=-lpthread
  libavutil      56.  8.100 / 56.  8.100
  libavcodec     58. 13.102 / 58. 13.102
  libavformat    58. 10.100 / 58. 10.100
  libavfilter     7. 12.100 /  7. 12.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
[h264 @ 0x3edf100] SPS unavailable in decode_picture_timing
[h264 @ 0x3edf100] non-existing PPS 0 referenced
[h264 @ 0x3edf100] SPS unavailable in decode_picture_timing
[h264 @ 0x3edf100] non-existing PPS 0 referenced
[h264 @ 0x3edf100] decode_slice_header error
[h264 @ 0x3edf100] no frame!
[h264 @ 0x3edf100] SPS unavailable in decode_picture_timing

...

Input #0, mpegts, from 'pipe:0':
  Duration: N/A, start: 74179.963833, bitrate: N/A
  Program 1070 
    Metadata:
      service_name    : ?07 ??????-24
      service_provider: ?????
    Stream #0:0[0x42f]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x430]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
[h264 @ 0x3ee19c0] co located POCs unavailable
[libx264 @ 0x3ed3b80] using SAR=16/11
[libx264 @ 0x3ed3b80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x3ed3b80] profile High, level 3.0
Output #0, mpegts, to 'pipe:1':
  Metadata:
    encoder         : Lavf58.10.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 720x576 [SAR 16:11 DAR 20:11], q=-1--1, 1800 kb/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.13.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 2000000/0/1800000 buffer size: 1710000 vbv_delay: -1
[h264 @ 0x3ee19c0] Found reference and non-reference fields in the same frame, which is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x3ee19c0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[h264 @ 0x3ee19c0] decode_slice_header error
[h264 @ 0x4458100] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x4458100] Missing reference picture, default is 68916
    Last message repeated 1 times
[h264 @ 0x4134540] reference picture missing during reorder
[h264 @ 0x4134540] Missing reference picture, default is 68917
[h264 @ 0x40e3c80] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x40e3c80] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x41c0580] chroma_log2_weight_denom 12 is out of rangetrate=1769.3kbits/s speed=20.2x    
[h264 @ 0x41c0580] Reference 4 >= 2
[h264 @ 0x41c0580] error while decoding MB 3 1, bytestream 906
[h264 @ 0x41a1300] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x41a1300] top block unavailable for requested intra mode -1
[h264 @ 0x41a1300] error while decoding MB 11 0, bytestream 994
[h264 @ 0x4115dc0] chroma_log2_weight_denom 14 is out of range
[h264 @ 0x4115dc0] cabac_init_idc 4 overflow
[h264 @ 0x4115dc0] decode_slice_header error
[h264 @ 0x4115dc0] no frame!
[h264 @ 0x4189680] mmco: unref short failure
[h264 @ 0x4189680] number of reference frames (0+4) exceeds max (3; probably corrupt input), discarding one
[h264 @ 0x40e1800] mmco: unref short failure
[h264 @ 0x3f7fa80] mmco: unref short failure
[h264 @ 0x3f75740] cabac_init_idc 32 overflow
[h264 @ 0x3f75740] decode_slice_header error
[h264 @ 0x3f75740] no frame!
[h264 @ 0x4458100] cabac_init_idc 32 overflow
[h264 @ 0x4458100] decode_slice_header error
[h264 @ 0x4458100] no frame!
[h264 @ 0x4134540] deblocking_filter_idc 32 out of range
[h264 @ 0x4134540] decode_slice_header error
[h264 @ 0x4134540] no frame!
[h264 @ 0x41c0580] deblocking_filter_idc 32 out of range
[h264 @ 0x41c0580] decode_slice_header error
[h264 @ 0x41c0580] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x41a1300] deblocking_filter_idc 32 out of range
[h264 @ 0x41a1300] decode_slice_header error
[h264 @ 0x41a1300] no frame!
[h264 @ 0x4115dc0] deblocking_filter_idc 32 out of range
[h264 @ 0x4115dc0] decode_slice_header error
[h264 @ 0x4115dc0] no frame!
[h264 @ 0x4265600] cabac_init_idc 19 overflow
[h264 @ 0x4265600] decode_slice_header error
[h264 @ 0x4265600] no frame!
[h264 @ 0x4189680] cabac_init_idc 31 overflow
[h264 @ 0x4189680] decode_slice_header error
[h264 @ 0x4189680] no frame!
[h264 @ 0x40dcec0] cabac_init_idc 32 overflow
[h264 @ 0x40dcec0] decode_slice_header error
[h264 @ 0x40dcec0] no frame!
[h264 @ 0x40e1800] cabac_init_idc 32 overflow
[h264 @ 0x40e1800] decode_slice_header error
[h264 @ 0x40e1800] no frame!
Past duration 0.999992 too large
[h264 @ 0x3ee19c0] deblocking_filter_idc 32 out of range
[h264 @ 0x3ee19c0] decode_slice_header error
[h264 @ 0x3ee19c0] no frame!
[h264 @ 0x411a4c0] deblocking_filter_idc 32 out of range
[h264 @ 0x411a4c0] decode_slice_header error
[h264 @ 0x411a4c0] no frame!
Past duration 0.999992 too large
[h264 @ 0x40e3c80] deblocking_filter_idc 32 out of range
[h264 @ 0x40e3c80] decode_slice_header error
[h264 @ 0x40e3c80] no frame!
[h264 @ 0x3f4f640] deblocking_filter_idc 32 out of range
[h264 @ 0x3f4f640] decode_slice_header error
[h264 @ 0x3f4f640] no frame!
Past duration 0.999992 too large
[h264 @ 0x424a480] cabac_init_idc 19 overflow
[h264 @ 0x424a480] decode_slice_header error
[h264 @ 0x424a480] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x3f7fa80] cabac_init_idc 31 overflow
[h264 @ 0x3f7fa80] decode_slice_header error
[h264 @ 0x3f7fa80] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x3f75740] cabac_init_idc 32 overflow
[h264 @ 0x3f75740] decode_slice_header error
[h264 @ 0x3f75740] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x4458100] cabac_init_idc 32 overflow
[h264 @ 0x4458100] decode_slice_header error
[h264 @ 0x4458100] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x4134540] deblocking_filter_idc 32 out of range
[h264 @ 0x4134540] decode_slice_header error
[h264 @ 0x4134540] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x41c0580] deblocking_filter_idc 32 out of range
[h264 @ 0x41c0580] decode_slice_header error
[h264 @ 0x41c0580] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x41a1300] deblocking_filter_idc 32 out of range
[h264 @ 0x41a1300] decode_slice_header error
[h264 @ 0x41a1300] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x4115dc0] deblocking_filter_idc 32 out of range
[h264 @ 0x4115dc0] decode_slice_header error
[h264 @ 0x4115dc0] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 14 times
[h264 @ 0x4134540] left block unavailable for requested intra modee=1916.3kbits/s dup=0 drop=1 speed=  21x    
[h264 @ 0x4134540] error while decoding MB 0 22, bytestream 1448
[h264 @ 0x41c0580] reference picture missing during reorder
[h264 @ 0x41c0580] Missing reference picture, default is 87632
[h264 @ 0x41a1300] reference picture missing during reorder
[h264 @ 0x41a1300] Missing reference picture, default is 87625
[h264 @ 0x4265600] Reference 5 >= 2
[h264 @ 0x4265600] error while decoding MB 10 1, bytestream 6374
[h264 @ 0x4189680] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x4189680] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x4189680] deblocking filter parameters -15 -1 out of range
[h264 @ 0x4189680] decode_slice_header error
[h264 @ 0x40dcec0] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x4115dc0] Reference 4 >= 2
[h264 @ 0x4115dc0] error while decoding MB 29 24, bytestream 2090
[h264 @ 0x40e1800] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x40e1800] deblocking_filter_idc 7 out of range
[h264 @ 0x40e1800] decode_slice_header error
[h264 @ 0x3ee19c0] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x3ee19c0] cabac_init_idc 23 overflow
[h264 @ 0x3ee19c0] decode_slice_header error
[NULL @ 0x3edf100] chroma_log2_weight_denom 9 is out of range
[h264 @ 0x411a4c0] Found reference and non-reference fields in the same frame, which is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x411a4c0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[h264 @ 0x411a4c0] decode_slice_header error
[h264 @ 0x40e3c80] chroma_log2_weight_denom 9 is out of range
[h264 @ 0x40e3c80] deblocking_filter_idc 14 out of range
[h264 @ 0x40e3c80] decode_slice_header error
[h264 @ 0x424a480] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x3f4f640] Reference 3 >= 2
[h264 @ 0x3f4f640] error while decoding MB 13 0, bytestream 6678
[h264 @ 0x424a480] top block unavailable for requested intra mode -1
[h264 @ 0x424a480] error while decoding MB 23 1, bytestream 5806
[h264 @ 0x3f7fa80] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x3f75740] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x3f7fa80] Reference 3 >= 2
[h264 @ 0x3f7fa80] error while decoding MB 5 2, bytestream 3282
[h264 @ 0x3f75740] Reference 3 >= 2
[h264 @ 0x3f75740] error while decoding MB 30 3, bytestream 3331
[h264 @ 0x4458100] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x4458100] cabac_init_idc 5 overflow
[h264 @ 0x4458100] decode_slice_header error
[h264 @ 0x4458100] no frame!
[h264 @ 0x4134540] chroma_log2_weight_denom 12 is out of range
[h264 @ 0x4134540] Reference 7 >= 2
[h264 @ 0x4134540] error while decoding MB 12 1, bytestream 3130
[h264 @ 0x41c0580] Found reference and non-reference fields in the same frame, which is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x41c0580] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[h264 @ 0x41c0580] decode_slice_header error
[NULL @ 0x3edf100] chroma_log2_weight_denom 9 is out of range
[h264 @ 0x41a1300] chroma_log2_weight_denom 9 is out of range
[h264 @ 0x41a1300] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x41a1300] Missing reference picture, default is 87869
    Last message repeated 1 times
[h264 @ 0x41a1300] Reference 3 >= 2
[h264 @ 0x41a1300] error while decoding MB 4 1, bytestream 9567
[h264 @ 0x4115dc0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x4265600] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x4265600] Reference 4 >= 2
[h264 @ 0x4265600] error while decoding MB 1 1, bytestream 4895
[h264 @ 0x4115dc0] Reference 3 >= 2
[h264 @ 0x4115dc0] error while decoding MB 22 2, bytestream 6051
[h264 @ 0x4189680] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x40dcec0] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x40e1800] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x40e1800] deblocking_filter_idc 24 out of range
[h264 @ 0x40e1800] decode_slice_header error
[h264 @ 0x40e1800] no frame!
[h264 @ 0x40dcec0] Reference 2 >= 2
[h264 @ 0x40dcec0] error while decoding MB 29 3, bytestream 3004
[h264 @ 0x3ee19c0] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x3ee19c0] deblocking_filter_idc 4 out of range
[h264 @ 0x3ee19c0] decode_slice_header error
[h264 @ 0x3ee19c0] no frame!
[NULL @ 0x3edf100] chroma_log2_weight_denom 8 is out of range
[h264 @ 0x411a4c0] reference picture missing during reorder
[h264 @ 0x411a4c0] Missing reference picture, default is 87876
[h264 @ 0x411a4c0] Reference 2 >= 2
[h264 @ 0x411a4c0] error while decoding MB 3 0, bytestream 12754
[h264 @ 0x40e3c80] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x40e3c80] chroma_log2_weight_denom 8 is out of range
[h264 @ 0x40e3c80] deblocking_filter_idc 9 out of range
[h264 @ 0x40e3c80] decode_slice_header error
[h264 @ 0x3f4f640] deblocking filter parameters 0 -7 out of range
[h264 @ 0x3f4f640] decode_slice_header error
[h264 @ 0x424a480] deblocking_filter_idc 18 out of range
[h264 @ 0x424a480] decode_slice_header error
[h264 @ 0x3f7fa80] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x3f7fa80] Reference 2 >= 2
[h264 @ 0x3f7fa80] error while decoding MB 18 0, bytestream 2874
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x3f75740] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x3f75740] Reference 2 >= 2
[h264 @ 0x3f75740] error while decoding MB 1 1, bytestream 2862
[h264 @ 0x4458100] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x4458100] cabac_init_idc 6 overflow
[h264 @ 0x4458100] decode_slice_header error
[h264 @ 0x4458100] no frame!
[h264 @ 0x4134540] chroma_log2_weight_denom 10 is out of range
[h264 @ 0x4134540] deblocking filter parameters -4 13 out of range
[h264 @ 0x4134540] decode_slice_header error
[h264 @ 0x4134540] no frame!
[NULL @ 0x3edf100] chroma_log2_weight_denom 8 is out of range
[h264 @ 0x41c0580] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x41c0580] Missing reference picture, default is 87876
    Last message repeated 1 times
[h264 @ 0x41c0580] Reference 2 >= 2
[h264 @ 0x41c0580] error while decoding MB 1 0, bytestream 13413
[h264 @ 0x41a1300] chroma_log2_weight_denom 8 is out of range
[h264 @ 0x41a1300] deblocking filter parameters -1 -10 out of range
[h264 @ 0x41a1300] decode_slice_header error
[h264 @ 0x4265600] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x4265600] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x411a4c0] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x411a4c0] Missing reference picture, default is 87660
    Last message repeated 1 times
[h264 @ 0x40e3c80] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x40e3c80] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x40e3c80] reference picture missing during reorder
[h264 @ 0x40e3c80] Missing reference picture, default is 87661
[h264 @ 0x424a480] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x424a480] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x4265600] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x4265600] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x424a480] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x424a480] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x4265600] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x4265600] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one

....

[h264 @ 0x4265600] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x424a480] mmco: unref short failure
    Last message repeated 1 times

.... and so on until the end of dump (if it's continuous stream, it's not restored to normal)

[h264 @ 0x424a480] number of reference frames (1+4) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x424a480] error while decoding MB 29 29, bytestream -18
frame=12188 fps=514 q=-1.0 Lsize=  116454kB time=00:08:18.08 bitrate=1915.3kbits/s dup=0 drop=1 speed=  21x    
video:106609kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.234699%
[libx264 @ 0x3ed3b80] frame I:64    Avg QP:13.52  size: 60899
[libx264 @ 0x3ed3b80] frame P:3691  Avg QP:16.04  size: 19640
[libx264 @ 0x3ed3b80] frame B:8433  Avg QP:19.73  size:  3887
[libx264 @ 0x3ed3b80] consecutive B-frames:  2.4% 15.2%  2.2% 80.1%
[libx264 @ 0x3ed3b80] mb I  I16..4: 20.6% 25.2% 54.2%
[libx264 @ 0x3ed3b80] mb P  I16..4:  8.1% 14.7%  6.6%  P16..4: 28.8% 14.0%  8.7%  0.0%  0.0%    skip:19.0%
[libx264 @ 0x3ed3b80] mb B  I16..4:  1.9%  4.3%  0.5%  B16..8: 19.3%  7.0%  0.9%  direct: 9.3%  skip:56.9%  L0:41.5% L1:38.3% BI:20.2%
[libx264 @ 0x3ed3b80] 8x8 transform intra:53.8% inter:41.6%
[libx264 @ 0x3ed3b80] coded y,uvDC,uvAC intra: 66.9% 62.5% 22.5% inter: 17.3% 18.9% 2.2%
[libx264 @ 0x3ed3b80] i16 v,h,dc,p: 43% 31% 19%  7%
[libx264 @ 0x3ed3b80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 26% 29%  2%  2%  2%  2%  3%  3%
[libx264 @ 0x3ed3b80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 29% 15%  3%  4%  5%  4%  5%  4%
[libx264 @ 0x3ed3b80] i8c dc,h,v,p: 48% 23% 25%  3%
[libx264 @ 0x3ed3b80] Weighted P-Frames: Y:0.5% UV:0.3%
[libx264 @ 0x3ed3b80] ref P L0: 79.4% 20.6%
[libx264 @ 0x3ed3b80] ref B L0: 80.7% 19.3%
[libx264 @ 0x3ed3b80] ref B L1: 96.8%  3.2%
[libx264 @ 0x3ed3b80] kb/s:1756.66

And here is the interesting part. There is a little manipulations with this dump, after which ffmpeg transcodes it more stable.

dd if=/root/squared_cut.ts of=/tmp/bad_tail.ts bs=188 skip=1034300

dd if=/tmp/bad_tail.ts of=/tmp/c2.ts bs=188 count=3883 && dd if=/tmp/cut.ts of=/tmp/c3.ts bs=188 skip=5113 && cat /tmp/c2.ts /tmp/c3.ts > /tmp/good_cut.ts

So after this manipulations we get good_cut.ts dump which transcodes fine - at least decoder not fails unrecoverably.
Sorry the dump quite huge, because I'm not sure which part of it actually lead to bug. So I uploaded it on yandex.disk and turn on access by link: https://yadi.sk/d/9Vs8ijw93T7TdX

Attachments (1)

squared_cut.ts (2.4 MB) - added by cehoyos 7 months ago.

Change History (3)

comment:1 Changed 7 months ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords h264 added
  • Reproduced by developer set
  • Status changed from new to open

Not a regression afaict.

comment:2 Changed 7 months ago by xzerth

The bug definitely reproduces since ffmpeg 2.6.9

Changed 7 months ago by cehoyos

Note: See TracTickets for help on using tickets.