[Libav-user] Wrong decoding of H.264 file

Info || Non-Lethal Applications info at non-lethal-applications.com
Thu Jun 1 15:50:44 EEST 2017

Hi guys,

Users of our software reported that certain H.264 files show green lines in the middle of the image.
Here’s the output of av_dump_format:

    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2017-05-23T06:14:36.000000Z
    timecode        : 00:59:52:00
  Duration: 00:43:19.64, start: 0.000000, bitrate: 1838 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 250 kb/s (default)
      creation_time   : 2017-05-23T06:14:37.000000Z
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x405, 1578 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47.95 tbc (default)
      creation_time   : 2017-05-23T06:14:37.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : H.264
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
      creation_time   : 2017-05-23T06:48:54.000000Z
      handler_name    : Apple Alias Data Handler
      timecode        : 00:59:52:00

I uploaded a screenshot of how the bug looks here:

https://www.dropbox.com/s/49ri0traypnyhzd/Decoding_ShiftedPlanes.png?dl=0 <https://www.dropbox.com/s/49ri0traypnyhzd/Decoding_ShiftedPlanes.png?dl=0>

The same files work fine in QuickTime and VLC (and also in an older version of our software using swscale instead of our own GPU pixel format converter).

By further evaluating the issue it turns out that the V plane contained in the AVFrame’s->data[2] field apparently doesn’t contain straight V values but something different.
We’re decoding the frames using avcodec_decode_video2. If the output is converted using swscale, everything looks good.
If we only use av_picture_layout, the issue looks like in the screenshot.

The only difference I can spot to other H.264 files looking correct is the “smpte170m/smpte170m/bt709” color space tags where others have only one (bt709).
Does anyone have an explanation for that or can give me some more insight on where to look at?

Any hints are greatly appreciated!
Thanks and best,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170601/04fa72bd/attachment.html>

More information about the Libav-user mailing list