rigaya / NVEnc

NVENCによる高速エンコードの性能実験
https://rigaya34589.blog.fc2.com/blog-category-17.html
Other
1.03k stars 108 forks source link

Alpha support (YUVA) for hevc codec? #571

Open qwe7989199 opened 3 months ago

qwe7989199 commented 3 months ago

It seems that NVIDIA's official SDK explicitly supports hevc hardware encoding with an alpha channel in the following note.

Although the applications for this technique are very limited.
Could you consider adding this feature in future version of nvenc.

rigaya commented 3 months ago

I'm sorry, but I'm not sure what kind of use case we have for supporting alpha channel.

I know it would be useful in a video editor software, but NVEncC is mainly a transcoder. Also, does video players support this alpha channel in HEVC?

qwe7989199 commented 3 months ago

In fact on the production side, HEVC with alpha channel has been limited to Apple devices in recent years. FFmpeg on macOS can call the videotoolbox hardware encoder for transparent HEVC output, and there is some application like this.

~And by browsing this page with my Windows PC, I confirmed that at least Chrome can render HEVC with alpha correctly. This is the sample file.~

Sorry for providing wrong information. It's playable only for macOS.

Probably the most significant point of adding this feature is to make windows also have a way to output transparent HEVC.

On the application side, I think the biggest significance may be that when used in conjunction with lossless YUV444, it is possible to store image sequences containing alpha channel in a more efficient way. For example, compared to ProRes4444XQ (which is an Apple exclusive and can't be hw-decoded), HEVC is much smaller and more compatible with other platforms.

The above is based on my incomplete understanding. This feature is "better to have", and in fact few people care.

rigaya commented 3 months ago

On Windows, ffmpeg seems to not being able to decode the alpha channel even with sw decode, and therefore its use will be greatly limited on a Windows environment.

I'll consider to add this feature in the future, but the functionality will be limited, for example, I think the filters will not be supported when using alpha channel encoding.