HEVC in a container (mp4) doesn't get decoded

Hi all!

I encoded a series of pictures as a raw x265 bitstream, named “output.hevc”. When I use NvDecoder (provided in the samples), I can decode the video just fine.

However, when I place “output.hevc” in a container, named “output.mp4”, it doesn’t decode anything.

Provided sample used: AppDecD3D, from Video SDK 8.1.

Things I’ve checked:

  • I used the provided FFmpegDemuxer.h and demuxed the first two frames of both files. The data that has been read is similar for both files, although not entirely the same.
  • Tested on two separate systems (Win 10, i7 4770K, GTX 1050Ti and Win 10, i7 8770, GTX 1080).
  • While running in a debugger, FFmpegDemux reports that codec AV_CODEC_ID_HEVC has been detected, and passes cudaVideoCodec_HEVC to the NvDecoder.
  • Obviously, I verified that both files play just fine using VLC and ffplay
  • FFmpeg DLLs are provided in the samples, so I just used those (avcodec-57.dll, avformat-57.dll, ...)

I have included a .zip file with my videos,and the results of av_read_frame() for frames 0 and 1 for both files. It can be found at this url: https://www.dropbox.com/s/b0k54mme2s2xmu1/NVDEC_x265ContainerIssue.zip?dl=0

The differences in the frame data are enough to break decoding. It looks like the ffmpeg demuxer is failing. My NVDec application has its own MP4 demuxer and demuxes and decodes your MP4 correctly.

Our investigation indicates this is an issue with FFmpeg demuxer. NVIDIA Video Codec SDK samples use the same demuxer. If not done already, we think this issue should be posted on FFmpeg forum.