ffmpegnvidiawatermarkhardware-accelerationvideo-watermarking

Watermark video by ffmpeg and hardware accelerator


I use a p4000 card and ffmpeg with all requirements (driver , toolkit , cuda compile) I want to put watermark on the video by this command

./bin/ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input.mp4 -i input.png -filter_complex "overlay=10:10" -c:v h264_nvenc output.mp4

but I encounter this error

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 #1:0

Thanks for the advice


Solution

  • -hwaccel cuvid
    

    Mean that decoded frame will go to hw encoder directly (not copy in system memory), so at this time it's impossible to add filters to decoded frame. Try remove -hwaccel cuvid, but speed will be slow. https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDACUVIDNVDEC