admin管理员组

文章数量:1594978

解决字体问题Could not load font "FreeSerif.ttf":cannot opencv resource

[root@localhost test]# ffmpeg -i 123.mp4 -vf "drawtext=fontsize=100:fontfile=FreeSerif.ttf:text='Hello World':x=20:y=20" output02.mp4

报错

[Parsed_drawtext_0 @ 0x12006fff0] Could not load font "FreeSerif.ttf": cannot open resource

[AVFilterGraph @ 0x12006f010] Error initializing filter 'drawtext' with args 'fontsize=100:fontfile=FreeSerif.ttf:text=Hello World:x=20:y=20'

Error opening filters!

去官网下载字体

http://font.downloadatoz/download,33689,freeserif.html

解压后

查看字体文件当前位置

[root@localhost freeserif-1333163334]# pwd
/root/桌面/ffmpeg/freeserif-1333163334

添加字体水印

ffmpeg -i 123.mp4 -vf "drawtext=fontsize=100:fontfile=/root/桌面/ffmpeg/freeserif-1333163334/FreeSerif.ttf:text='Hello World':fontcolor=red:box=1:boxcolor=yellow:x=20:y=20"  -strict -2  output5.mp4

播放

[root@localhost test]# ffplay output5.mp4 

本文标签: 水印字体视频loadffmpeg