FFmpeg add watermark

Add a watermark in the upper left corner fengyuzaitu
ffmpegd.exe -i video.mp4 -vf drawtext = fontfile = arial.ttf: text = fengyuzaitu output.mp4


Add watermark center fengyuzaitu
ffmpegd.exe video.mp4 -vf DrawText = -i = Arial.ttf fontfile: X = W / 2: Y = H / 2: text = fengyuzaitu output.mp4


Specifies the watermarking color and width
ffmpegd.exe -i video.mp4 -vf drawtext = fontfile = arial.ttf: x = w / 2: y = h / 2: fontsize = 24: fontcolor = yellow: text = fengyuzaitu output.mp4


Add current timestamp
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


Solve
copy C: \ required under the Windows \ Fonts Fonts directory to the directory of program execution


Guess you like

Origin blog.51cto.com/fengyuzaitu/2448767