Problems with hwaccel / cuda / Logo Overlay and drawtext

Hi,

I work for a company that makes car seats. Accordingly, we are also involved in crash tests, crash simulations etc.

We want to encode a high-resolution 4K video with our logo and a draw text.

Here’s how I’ve tried so far:
ffmpeg -y -hwaccel cuvid -hwaccel_output_format nv12 -i /home/crashtest/test1.mp4 -i /home/logos/main.png -bufsize 1048576k -c:v hevc_nvenc -filter_complex “hwdownload,drawtext=text=’%{eif:trunc(($duration-t)/3600):d}:%{eif:trunc(mod($duration-t,3600)/60):d:2}:%{eif:mod(($duration-t),60):d:2}’:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:x=40:y=main_h-40:fontsize=40:fontcolor=white@0.7:borderw=2:bordercolor=black@0.3:box=0,drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf:text=’#Test 1’:x=(main_w-text_w-30):y=20:fontsize=40:fontcolor=white@0.7:borderw=1:bordercolor=black@0.3:box=0,hwupload” -f mp4 -y /home/tst/1.mp4

The Video is without Audio.`

This error message is output:
tream mapping:
Stream #0:0 (hevc) -> hwdownload (graph 0)
hwupload (graph 0) -> Stream #0:0 (hevc_nvenc)
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter ‘graph 0 input from stream 0: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 #0:0

Maybe someone can help me out here.
I have already tried some flags, etc., but I am not getting anywhere.
Unfortunately, due to our internal regulations, I cannot provide a sample, as it is kept confidential.

Best Regards

I solved it on my own.

For your Interest here my Solution:

  	ffmpeg -y  -init_hw_device cuda=cuda -filter_hw_device cuda -hwaccel cuda -hwaccel_output_format cuda -i "$f" -i /home/tst/logos/logo.png -flags -global_header -filter_complex "[0:v]hwdownload,format=p010le,overlay=120:80,drawtext=text='%{eif\:trunc(($duration-t)/3600)\:d}\:%{eif\:trunc(mod($duration-t,3600)/60)\:d\:2}\:%{eif\:mod(($duration-t),60)\:d\:2}':fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:x=40:y=main_h-40:fontsize=40:fontcolor=white@0.7:borderw=2:bordercolor=black@0.3:box=0,drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf:text='#$f':x=(main_w-text_w-30):y=20:fontsize=40:fontcolor=white@0.7:borderw=1:bordercolor=black@0.3:box=0,hwupload_cuda" -c:v hevc_nvenc -profile:v main10 -preset slow -crf 15 -format yuv420p10le -f mp4-y /home/tst/test1.mp4

Just for fun i testet also the Re-Encoding of a Movie…

ffmpeg -y  -init_hw_device cuda=cuda -filter_hw_device cuda -hwaccel cuda -hwaccel_output_format cuda -i "$f" -i /home/tst/logos/logo.png -flags -global_header -filter_complex "[0:v]hwdownload,format=p010le,overlay=120:80,drawtext=text='%{eif\:trunc(($duration-t)/3600)\:d}\:%{eif\:trunc(mod($duration-t,3600)/60)\:d\:2}\:%{eif\:mod(($duration-t),60)\:d\:2}':fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:x=40:y=main_h-40:fontsize=40:fontcolor=white@0.7:borderw=2:bordercolor=black@0.3:box=0,drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf:text='#$f':x=(main_w-text_w-30):y=20:fontsize=40:fontcolor=white@0.7:borderw=1:bordercolor=black@0.3:box=0,hwupload_cuda" -c:v hevc_nvenc -profile:v main10 -preset slow -crf 15 -format yuv420p10le  -map 0:m:language:ger -c:a libfdk_aac -ar:a 48000 -channel_layout:a 5.1 -ab:a 640k -sn -f mp4-y /home/tst/movie.mp4
1 Like