Opened 4 years ago

Last modified 4 years ago

#8781 open defect

H.264 Decoding Fails on Raw Annex B Streams from VideoToolbox

Reported by: David Goodman Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: d3d11va
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
ffmpeg can successfully decode my stream of H264 Annex B NALs without a container (generated with VideoToolbox on an iOS device) using the x264 decoder, or even "-hwaccel cuda" on my Nvidia GPU, but fails when using d3d11va.

The bug seems to be in the d3d11va_validate_output() function in dxva2.c. I haven't been able to trace it down completely and create a proper fix yet, but I was able get decoding to work for my own use cases with a hacky workaround here: https://github.com/LIV/FFmpeg/commit/35e8d409085d225d7cbd4553b59bd40a8a6b9716. I'm forcing ffmpeg to use DXVA2_ModeH264_E regardless of the input stream, so this obviously isn't a proper solution.

How to reproduce:

% ffmpeg -hwaccel d3d11va -i h264_annexb_1440x1280.h264 output.mp4
'''ffmpeg version:'''
4.2.2 and 20200628-4cfcfb3
'''built on:'''
Downloaded from ffmpeg.zeranoe.com/builds, and was able to reproduce with self-built 4.2.2 on Windows 10 1909.

Note that the white bottom half of my sample video is normal (it's an alpha channel).

Attachments (1)

ffmpeg-20200708-141619.log (562.2 KB ) - added by David Goodman 4 years ago.
Output log generated with -report

Download all attachments as: .zip

Change History (5)

by David Goodman, 4 years ago

Attachment: ffmpeg-20200708-141619.log added

Output log generated with -report

comment:1 by David Goodman, 4 years ago

I'm having trouble with the VideoLAN File Uploader, so here's a Google Drive link for a sample clip that makes causes the issue -- hope this is acceptable: https://drive.google.com/file/d/1iUWPFUE7ODLucp0dNIJGZKWTiwTcCZja/view?usp=sharing

comment:2 by Balling, 4 years ago

Status: newopen

Unfortunately, we do not have h265_annexbtomp4 or even h264_annexbtomp4 but it is there https://github.com/ireader/media-server/commit/76e62c806aaa5e1f97c626a52df0b03c2b2b47b1 (and other commits). After that we can tell whether this file is corrupted or not. Just saying.

comment:3 by Elon Musk, 4 years ago

File is invalid.

in reply to:  3 comment:4 by Balling, 4 years ago

Replying to richardpl:

File is invalid.

But we are not able to restore from Annex B back, are not we??

P.S. Looks like we can after all, sorry ;)

Last edited 4 years ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.