我正在尝试运行以下命令,它应该在视频中添加水印和滚动文本
G:/ffmpeg/bin/ffmpeg.exe -y -v error -i G:/hls/test3.mp4 -i G:/hls/logo.png -filter_complex overlay=x=10:y=10 -vcodec libx264 -acodec copy -filter:v drawtext="text='hello':x=50+n*2:y=50" G:/hls/output/test3.mp4
我收到以下错误。
Filtergraph 'drawtext=text='hello':x=50+n*2:y=50' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph.
-vf/-af/-filter and -filter_complex cannot be used together for the same stream.
我怎样才能实现这两点?
答案1
抱歉,我已经仔细阅读了您的帖子,所以现在才知道。请尝试此命令:
G:/ffmpeg/bin/ffmpeg.exe -y -v error -i G:/hls/test3.mp4 -i G:/hls/logo.png -filter_complex overlay=x=10:y=10,drawtext=fontfile=/Windows/Fonts/DejaVuSans.ttf:fontcolor=white:fontsize=38:text='hello':x=50+n*2:y=50" -vcodec libx264 -acodec copy G:/hls/output/test3.mp4
这个对我来说非常有效。