0

I'm attempting to produce a 4K live stream for YouTube.

I'm capturing 2160p30 frames from a BlackMagic Design DeckLink Mini Recorder. I'm passing those frames to ffmpeg in their raw 8-bit 4:2:2 format. I'm able to achieve 30 fps encoding (~16kbits/s and q= in the high 20s to low 30s) with my current parameters which are:

ffmpeg -threads:v 2 -threads:a 8 -filter_threads 2
-f rawvideo -framerate 30 -pixel_format uyvy422 -video_size 3840x2160 -i \\.\pipe\videopipe
-f s16le -ac 2 -ar 44100 -i \\.\pipe\audiopipe
-r 30 -g 60 -c:v h264_nvenc -pix_fmt yuv420p -preset fast -profile main
-b:v 16000K -maxrate 24000k -bufsize 6000k
-f flv "rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx"

My dilemma is that once I introduce an overlay graphic, my encoding fps drops to 28 at best, which leads me to believe I'm barely achieving the 30 fps without the overlay. I'm only adding these parameters to include the overlay:

-i logo.png

-filter_complex "overlay=100:100"

I further diminish the encoding fps (20 fps max) when I introduce a dynamic overlay which I feed to ffmpeg through an additional pipe.

My questions are:

  1. Is there a better set a parameters I could be using to encode the 4K stream?
  2. Is there a better way to include the overlay?
  • 1
    NVENC H.264 has low latency presets too. See ffmpeg -h encoder=h264_nvenc. I don't know how to optimize the performance of adding an overlay though. – slhck Apr 1 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.