I can overlay a picture to the video stream with the following command:
ffmpeg -thread_queue_size 1024 -i udp_source -i watermark.png -filter_complex "[0:v]scale=1920:1080,yadif=0 [base]; [base][1:v] overlay=main_w-overlay_w-10:10 [marked]" -map "[marked]" -vcodec h264_nvenc -acodec libfdk_aac -ab 192k -ar 48000 -f flv rtmp_output
But if I made a hardware decoding with deinterlacing and resizing at the GPU with the following command:
ffmpeg -thread_queue_size 1024 -hwaccel cuvid -c:v mpeg2_cuvid -deint 2 -drop_second_field 1 -vsync 0 -i udp_source -i watermark.png -filter_complex "[0:v]scale_npp=1920:1080 [base]; [base][1:v] overlay=main_w-overlay_w-10:10 [marked]" -map "[marked]" -vcodec h264_nvenc -acodec libfdk_aac -ab 192k -ar 48000 -f flv rtmp_output
I got the following error:
Error while decoding stream #0:1: Invalid data found when processing input
Impossible to convert between the formats supported by the filter 'Parsed_scale_npp_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #1:0
As I understand we can't overlay the picture to the video via NVIDIA. I added the "hwdownload" filter in the command to copy data to CPU:
ffmpeg -thread_queue_size 1024 -hwaccel cuvid -c:v mpeg2_cuvid -deint 2 -drop_second_field 1 -vsync 0 -i "udp://226.58.24.4:2000?overrun_nonfatal=1" -i /home/anis/logo/2mbps.png -filter_complex "[0:v]scale_npp=1920:1080,hwdownload [base]; [base][1:v] overlay=main_w-overlay_w-10:10 [marked]" -map "[marked]" -vcodec h264_nvenc -aspect 16:9 -b:v 1808k -minrate 1808k -maxrate 1808k -bufsize 904k -g 100 -no-scenecut 1 -forced-idr 0 -preset:v medium -vprofile main -level 4.1 -map 0:#0x091d -acodec libfdk_aac -ab 192k -ar 48000 -f flv rtmp://10.150.12.104/virginandtv/abr2k_test
After this I got the following error:
[udp @ 0x39abda0] Circular buffer overrun. Surviving due to overrun_nonfatal option
I tried to increase a fifo size up to 1M, but this issue still exists.
Is it possible to overlay a picture directly on NVIDIA card?