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

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


Hi, see output below:
$ ffmpeg -loglevel verbose -f decklink -raw_format rgb10 -i "DeckLink
8K Pro (1)" -sws_flags bilinear -sws_flags print_info -c:v hevc_nvenc
-an -b:v 30M -f null -

ffmpeg version N-101405-g2570663 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (GCC)
  configuration: --prefix=/home/admin/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags='-I/home/admin/ffmpeg_build/include
-I/home/admin/ffmpeg_build/include/decklink -I/usr/local/cuda/include'
--extra-ldflags='-L/home/admin/ffmpeg_build/lib
-L/home/admin/ffmpeg_build/include/decklink -L/usr/local/cuda/lib64'
--extra-libs=-lpthread --extra-libs=-lm --bindir=/home/admin/bin
--enable-gpl --enable-libfdk_aac --enable-libfreetype
--enable-libmp3lame --enable-libx264 --enable-libx265 --enable-nonfree
--enable-libsrt --enable-decklink --enable-nvenc --enable-cuda
--enable-libnpp --enable-pthreads
  libavutil      56. 67.100 / 56. 67.100
  libavcodec     58.129.100 / 58.129.100
  libavformat    58. 71.100 / 58. 71.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.109.100 /  7.109.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[decklink @ 0x4677940] Autodetected the input mode
[decklink @ 0x4677940] Found Decklink mode 4096 x 2160 with rate 25.00
[decklink @ 0x4677940] Using 2 input audio channels
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, decklink, from 'DeckLink 8K Pro (1)':
  Duration: N/A, start: 0.000000, bitrate: 6637056 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
  Stream #0:1: Video: r210, 1 reference frame, gbrp10le(progressive),
4096x2160, 6635520 kb/s, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:1 -> #0:0 (r210 (native) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:1 @ 0x46e06c0] w:4096 h:2160
pixfmt:gbrp10le tb:1/1000000 fr:25000/1000 sar:0/1
[auto_scaler_0 @ 0x46e2b00] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x46e0cc0] auto-inserting filter 'auto_scaler_0' between the
filter 'Parsed_null_0' and the filter 'format'
SwScaler: reducing / aligning filtersize 1 -> 4
    Last message repeated 1 times
SwScaler: reducing / aligning filtersize 1 -> 1
    Last message repeated 1 times
[swscaler @ 0x46e4540] bicubic scaler, from gbrp10le to yuv444p16le using MMXEXT
[swscaler @ 0x46e4540] 4096x2160 -> 4096x2160
[auto_scaler_0 @ 0x46e2b00] w:4096 h:2160 fmt:gbrp10le sar:0/1 ->
w:4096 h:2160 fmt:yuv444p16le sar:0/1 flags:0x4
[hevc_nvenc @ 0x46b7f40] Loaded Nvenc version 11.0
[hevc_nvenc @ 0x46b7f40] Nvenc initialized successfully
[hevc_nvenc @ 0x46b7f40] 1 CUDA capable devices found
[hevc_nvenc @ 0x46b7f40] [ GPU #0 - < TITAN X (Pascal) > has Compute SM 6.1 ]
[hevc_nvenc @ 0x46b7f40] supports NVENC
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.71.100
  Stream #0:0: Video: hevc (Rext), 1 reference frame, yuv444p16le(tv,
progressive), 4096x2160 (0x0), q=2-31, 30000 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc58.129.100 hevc_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/30000000 buffer size: 60000000
vbv_delay: N/A
[decklink @ 0x4677940] Decklink input buffer overrun!bitrate=N/A speed= 0.6x
    Last message repeated 9 times
[decklink @ 0x4677940] Decklink input buffer overrun!bitrate=N/A speed=0.615x
    Last message repeated 14 times


Den mån 8 mars 2021 kl 20:35 skrev Dennis Mungai <dmngaie at gmail.com>:
>
> On Mon, 8 Mar 2021 at 17:49, Anders Degerberg <anders at europasound.se> wrote:
>
> > 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
> >
> >
>
> Hello there,
>
> What is your exact ffmpeg command, and output?
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list