Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5390 closed defect (fixed)

Nvenc Based HEVC Encoding Compability Fix

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



Nvidia Nvenc bassed HEVC encoding need Access Unit Delimeters based on HEVC specification:

Access Unit Delimiter, which is mandatory.
ITU-T H.222.0 Amendment 3 (01/2014)
14 Clause 2.17
2.17 Carriage of HEVC
2.17.1 Constraints for the transport of HEVC
Each HEVC access unit shall contain an access unit delimiter NAL unit;

Currently, nvenc HEVC coding does not enable AUD which causes LG and Sony TVs unable to decode FFmpeg generated MPEGTS streams.

The Fix is:

libavcodec/nvenc.c Line 951:

951: case AV_CODEC_ID_H265:
952: ctx->encode_config.encodeCodecConfig.hevcConfig.hevcVUIParameters.colourMatrix = avctx->colorspace;

Needs to be changed to:

951: case AV_CODEC_ID_H265:
952: ctx->encode_config.encodeCodecConfig.hevcConfig.outputAUD = 1;
953: ctx->encode_config.encodeCodecConfig.hevcConfig.hevcVUIParameters.colourMatrix = avctx->colorspace;

So Access Unit Delimiter for HEVC Encoding is Enabled.
Problem is fixed for Sony and LG TVs in decoding.


Change History (5)

comment:1 by Carl Eugen Hoyos, 6 years ago

Keywords: aud removed
Priority: importantnormal


  • Send your patch made with git format-patch to the development mailing list. This is of course always preferred.
  • Or test current FFmpeg git head, provide the command line that allows to reproduce your issue together with the complete, uncut console output and explain what is wrong with the output file and how we can reproduce the issue. Please do not replace this explanation with hints on how to fix the issue, this is a bug tracker.

comment:2 by smallishzulu, 6 years ago

Hi again,

Used command line:

ffmpeg -i input.ts -s 3840x2160 -r 50 -vcodec nvenc_hevc -preset llhq -vb 25000k -acodec aac -ab 128k -muxrate 30000k -f mpegts output.ts

The output does not generate any error in FFmpeg log. The issue is if you try to play this TS file in LG and Sony TVs, the TS file can not be displayed as there is no AUD in Nvenc HEVC encoding. So it is needed to be enabled by ctx->encode_config.encodeCodecConfig.hevcConfig.outputAUD = 1; in line 952.


in reply to:  2 comment:3 by Carl Eugen Hoyos, 6 years ago

Replying to smallishzulu:

ffmpeg -i input.ts -s 3840x2160 -r 50 -vcodec nvenc_hevc -preset llhq -vb 25000k -acodec aac -ab 128k -muxrate 30000k -f mpegts output.ts

The output does not generate any error in FFmpeg log.

Please provide the log to make this a valid ticket.

comment:4 by Carl Eugen Hoyos, 6 years ago

Resolution: fixed
Status: newclosed

I suspect this was fixed in b3557c79dcd8c3415a7de06d51294ed79e4489bf

comment:5 by smallishzulu, 6 years ago

Yes, it seems Timo saw the report.

Note: See TracTickets for help on using tickets.