-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alpha support (YUVA) for hevc codec? #571
Comments
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? |
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.
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. The above is based on my incomplete understanding. |
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. |
I would need such type of support in my project, as I am embedding transparent videos within a web page, and to support Safari, the only encoder that seems to work so far with alpha channels is hevc_videotoolbox, but this one is only available on M1/2 chips, nd so cannot be encoded on a server |
NVEnc 7.61 adds experimental YUVA420 support for HEVC which could be enabled by “--output-csp yuva420”. The input needs to have alpha channel to use this feature, and is limited to HEVC 8bit yuva420. Unfortunately I were not test to the decode the output, ffmpeg on Windows or Linux does not seem to support HEVC alpha channel decoding. I would appreciate it if you would have a test and check whether it can be decoded properly. |
In fact, I'm stuck at the step of creating the valid input file. movie-hevc.movBut nvencc doesn't consider it a correct video with alpha channel:
If only hevc files with alpha produced by nvidia's encoder can be recognized correctly, it becomes a chicken or egg problem. At the moment, I don't think this solution is compatible with the macOS one. |
Unfortunately, both software decoder (by libavcodec) or hardware decoder of NVEnc does not support HEVC alpha channel. Therefore, input files needs to be in other format, so I was testing using ProRes YUVA444 input file and huffyuv rgba input files. I got sample file from UsingHEVCVideoWithAlpha.zip which can be downloaded from this url. There was a ProRes 4444 sample file "HEVC-Videos-With-Alpha-Exports\Resources\puppets_with_alpha_prores.mov". It can be encoded by
Also, I also tested other input format like below (only for test purpose).
|
Thank you for sharing the information of Davinci Resolve. I have improved muxer handling in NVEnc 7.62, although the file cannot be rendered (as I'm using Windows version), now other alpha modes can be shown. Would you please have a try? |
Thank you so much for sharing the validation process using the web server. It really helps me much, as I can now check using my iPhone! I was able to find out the bug of handling alpha channel which has caused the width error of alpha channel, NVEnc 7.63 shall fix this, and I think we are now able to get proper playback now. Below is a check on Safari (iOS). |
Thank you for your tests!
NVEnc 7.64 adds option to change alpha channel mode (--alpha-channel-mode). By adding Also, NVEnc 7.64 fixed wrong alpha channel related headers. Will you please have a try on macOS version?
Thank you, I think NVEnc 7.64 will be last try, as I'm not being able to come up of other points to be improved. |
Thank you for confirming, it's nice that we are now able to have proper playback in Safari on both macOS and iOS. About the testing Chrome on macOS, it's strange that it behaves different depending on colors, but I also think it might be more of Chrome compatibility issue. I'll close the issue as I think we have achieved to get HEVC + alpha layer using NVENC hw encode. Please reopen or create a new issue if you get any other problems. Thanks again for your request, and many cooperation to create and refine this feature. |
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.
The text was updated successfully, but these errors were encountered: