I've been working on Streaming real-time video using hardware accelerated h.264 encoding, decoding and I've been able to make it work using Windows Media Foundation .
I've compressed the frames from RGB to NV12 format using d3d11 Video Processor and encoded to h.264 using Hardware MFT.
The Only problem I have now is that after decoding and rendering the video, aliasing and halo effect appear on the screen along with the text.
The Images down below shows my problem.
After some research, I came across H.264/AVC 444 in which Microsoft solved this by introducing full-screen AVC 444 mode with RDP 10.
In AVC 444 mode, we can get 4:4:4 quality text with 4:2:0 hardware encoders / decoders by improving the frame throughput significantly.
Introducing the AVC 444 mode The main challenge to use AVC/H.264 as the one and only Codec in Remote Desktop scenarios is that text shows a halo effect with typical implementations of AVC/H.264. This is caused by the color conversion process that happens as part of the compression which throws away some of the chrominance information, as represented in the 4:2:0 format. To the human eye the lack of chrominance information is not as apparent with video content, however with Remote Desktop scenarios, where mostly text is used, it is something that is noticeable and users will perceive this as blurry. The AVC/H.264 standard defines the capability to use 4:4:4 format which doesn’t lose the chrominance during conversion, however typically this isn’t part of most AVC/H.264 hardware encoder and decoder implementations and thus provides a challenge. To show the difference between 4:4:4 and 4:2:0 please see the following image which shows easily noticeable differences:
I tried to achieve the same in Media Foundation but unable find any resource to crack that yet.
I have figured out that color conversion to NV12 is the reason behind this problem and I've been trying to solve it, I have also tried YUV 444 but unable to find a hardware MFT that supports it. I was not able to encode any other color format except NV12 using Hardware MFT
Is there any way to overcome this problem?Any help would be appreciated.
You could use a Screen capture optimized codec: https://docs.microsoft.com/en-us/windows/win32/medfound/usingthewindowsmediavideo9screencodec
NVIDIA supports 4:4:4 hardware assisted on a wide variety of cards: https://developer.nvidia.com/video-encode-decode-gpu-support-matrix
Scale your screen from 1920x1080 to 3840x2160 convert to NV12 (4:2:0) compress to H.264 and do the reverse on the receiver. The upscaling and the subsequent 4:2:0 conversion should retain the full color resolution. This sounds wasteful but if it is done on hardware it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With