ffmpeg和硬件加速器的水印视频

Watermark video by ffmpeg and hardware accelerator

我使用 p4000 卡和 ffmpeg 满足所有要求(驱动程序、工具包、cuda 编译) 我想通过这个命令给视频加水印

./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

但是我遇到了这个错误

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

感谢您的建议

-hwaccel cuvid

意味着解码帧将直接进入硬件编码器(而不是在系统内存中复制),因此此时无法向解码帧添加过滤器。尝试删除 -hwaccel cuvid,但速度会很慢。 https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDACUVIDNVDEC