[FFmpeg-user] 4K RGB->YUV realtime conversion.

Anders Degerberg anders at europasound.se
Mon Mar 8 16:19:46 EET 2021


Hi,

I've come across a problem I really can't figure out when trying to stream
realtime a RGB 10-bit Decklink input, as YUV444 10-bit HEVC in 25fps.
 In a 1920x1080 resolution on the Decklink input, it all works very well,
using hevc_nvenc codec on a Nvidia GPU. Auto_scaler kicks in converting the
correctly identified 'gbrp10le' input format to 'yuv44416le' for hevc_nvenc.
But doing the same in 4K resolution causes input buffer overruns, only
capable of about 20 fps. When watching CPU usage, there's only real load on
one of the 32 threads, and that load is maxing out at 99%. CPU frequency is
close to 4GHz on the AMD CPU.
If I then switch the Decklink input to YUV instead, 4K works fine, so the
hevc encoding on the gpu or streaming protocol is not the bottleneck.
 This makes me think the problem lies with the auto_scaler RGB->YUV not
keeping up with 4096x2160 pixels. This RGB->YUV conversion is done in
libswscale I understand. I've tried to use -filter_threads and -threads to
increase thread usage of the swscale, but it still seems to use only one
thread.

 Any suggestions how I can do this 4K RGB 10-bit->YUV444 10-bit colorspace
conversion in ffmpeg in realtime?

I've tried to hwupload to the gpu to be able to use scale_npp, but
auto_scaler kicks in before I have the chance to send the RGB data to the
-vf filters.

I've also tried to build with a patch for multi-thread swscale found here:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/C1125BD979E9AE41908DC4913CBFACBB67A31216@IRSMSX103.ger.corp.intel.com/
But this patch doesn't seem to make a difference for the rgb2yuv colorspace
conversions, it's probably only affective for image up/downscaling?

Kind regards
Anders


More information about the ffmpeg-user mailing list