Also tried to write HEVC + alpha channel video using native C++ code. But no luck.
I tried to use
Video_Codec_SDK_12.1.14/Samples/AppEncode/AppEncDec
with this main changes:
NV_ENC_BUFFER_FORMAT eFormat = NV_ENC_BUFFER_FORMAT_ARGB;
…
NV_ENC_CONFIG *pConfig = initializeParams.encodeConfig;
pConfig->rcParams.alphaLayerBitrateRatio = 3;
pConfig->encodeCodecConfig.hevcConfig.enableAlphaLayerEncoding = 1;
But it writes video, which ffmpeg reads with a lot of errors:
Last message repeated 1 times
[hevc @ 0x5603d1b5fd80] missing picture in access unit with size 51
[hevc @ 0x5603d1b5fd80] missing picture in access unit with size 49
Last message repeated 1 times
[hevc @ 0x5603d1b5fd80] missing picture in access unit with size 51
[hevc @ 0x5603d1b5fd80] missing picture in access unit with size 49
Last message repeated 1 times
[hevc @ 0x5603d1b5fd80] missing picture in access unit with size 51
[hevc @ 0x5603d1b5fd80] missing picture in access unit with size 49
Last message repeated 1 times
Input #0, mpegts, from ‘out.mkv’:
Duration: 00:00:16.00, start: 0.000000, bitrate: 66 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: hevc (Main) (HEVC / 0x43564548), yuv420p(tv), 1080x1080 [SAR 1:1 DAR 1:1], 30 fps, 25 tbr, 90k tbn
And without using “alpha features” ffmpeg reads it successfully:
Input #0, mpegts, from ‘out_wo_alpha.mkv’:
Duration: 00:00:16.00, start: 0.000000, bitrate: 66 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: hevc (Main) (HEVC / 0x43564548), yuv420p(tv), 1080x1080 [SAR 1:1 DAR 1:1], 30 fps, 25 tbr, 90k tbn
What exact feature I am missed to turn on? Why video still have pix format yuv420p(tv) even when alpha features enabled?
Sadly I can’t attach full code on this forum, but I can share it if needed.
Any help appreciated.