Opened 4 years ago

Closed 4 years ago

#5344 closed defect (fixed)

H.265 decoding errors (works well with HEVC reference decoder)

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

Description

I've got a specific H.265 elementary stream file (see attachment) that can be decoded without any problems with the HEVC reference decoder from https://hevc.hhi.fraunhofer.de/. But when decoding with a current version of FFmpeg, frames 51 - 60 show massive decoding errors (picture almost completely gray). I'm using Zeranoe ffmpeg-20160316-git-d0a9114-win64-static but I could also reproduce with the released 2.8.6 version.

How to reproduce:

% ffmpeg -i snap1920_1080_I30_2500kBit_Flur_2default.265 snap1920_1080_I30_2500kBit_Flur_2default.yuv

Attachments (1)

snap1920_1080_I30_2500kBit_Flur_2default.265 (1.6 MB) - added by brausch 4 years ago.

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by brausch

comment:1 Changed 4 years ago by cehoyos

  • Component changed from ffmpeg to avcodec
  • Keywords hevc added
  • Reproduced by developer set
  • Status changed from new to open

For future tickets: Please always provide the failing command line together with the complete, uncut console output.

$ ffmpeg -i snap1920_1080_I30_2500kBit_Flur_2default.265 out.yuv
ffmpeg version N-79065-g7d9e064 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.103 / 57. 28.103
  libavformat    57. 28.102 / 57. 28.102
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, hevc, from 'snap1920_1080_I30_2500kBit_Flur_2default.265':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1200k tbn, 30 tbc
Output #0, rawvideo, to 'out.yuv':
  Metadata:
    encoder         : Lavf57.28.102
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.28.103 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[hevc @ 0x33388e0] No start code is found.
[hevc @ 0x33388e0] Error splitting the input into NAL units.
[hevc @ 0x3348de0] Could not find ref with POC 49
Error while decoding stream #0:0: Invalid data found when processing input
frame=  159 fps=0.0 q=-0.0 Lsize=  482962kB time=00:00:05.30 bitrate=746496.0kbits/s dup=1 drop=0 speed=9.19x
video:482962kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

comment:2 Changed 4 years ago by jkqxz

The failure here is because there is a large section of zeroes in the middle of the file (between frames 49 and 50):

0006b080  08 ab 3f 15 80 04 d7 8f  06 4c af 00 00 00 00 00  |..?......L......|
0006b090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
0006b6e0  00 00 00 00 00 00 00 00  00 00 00 01 02 01 f2 e1  |................|
0006b6f0  f0 9c 4b c1 58 e7 c3 eb  ab 18 84 6d 0e 2f 01 3f  |..K.X......m./.?|

This is not invalid (a NAL unit can be preceded by arbitrarily many leading_zero_8bits or followed by arbitrarily many trailing_zero_8bits), but few streams make use of this "feature" so the decoder has not bothered to support it. The stream plays correctly on the current decoder if you remove all but three of the zero bytes.

comment:4 Changed 4 years ago by cehoyos

  • Analyzed by developer set

comment:5 Changed 4 years ago by brausch

Thank you very much for your fast response (and sorry for the missing information).

I don't agree with you about the popularity of this behavior because both the Intel Quick Sync encoder and the current Ambarella chip generations produce such streams with a bunch of zeroes in it.

Will your patch be part of one of the upcoming FFmpeg releases?

comment:6 Changed 4 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Fixed by Mark Thompson in fbec157ea08f61063847bbe0dba28525e6283ff5
Thank you for the sample!

Note: See TracTickets for help on using tickets.