在左上角添加水印fengyuzaitu
ffmpegd.exe -i video.mp4 -vf drawtext=fontfile=arial.ttf:text=fengyuzaitu output.mp4
居中添加水印fengyuzaitu
ffmpegd.exe -i video.mp4 -vf drawtext=fontfile=arial.ttf:x=w/2:y=h/2:text=fengyuzaitu output.mp4
指定水印颜色和宽度
ffmpegd.exe -i video.mp4 -vf drawtext=fontfile=arial.ttf:x=w/2:y=h/2:fontsize=24:fontcolor=yellow:text=fengyuzaitu output.mp4
添加当前时间戳
ffmpegd.exe -i video.mp4 -vf drawtext="fontfile=arial.ttf:text='%{localtime\:%H\\\:%M\\\:%S}'" output.mp4
遇到问题
[Parsed_drawtext_0 @ 0000015FE818EE80] Cannot find a valid font for the family Sans
[AVFilterGraph @ 0000015FE6473A80] Error initializing filter 'drawtext' with args 'fontfile=arial.ttf:text=fengyuzaitu'
Error reinitializing filters!
Failed to inject frame into filter network: No such file or directory
Error while processing the decoded data for stream #0:1
解决
拷贝C:\Windows\Fonts目录下需要的字体到程序执行的目录下