问题
I am wanting to use Google Fonts in my ffmpeg video creations for text. Here is what I have and it's not working at all.
$font = "//fonts.googleapis.com/css?family=Aclonica";
$cmd .= "drawtext=enable='between(t,".$fi.",".$li.")':fontfile=".$font.":fontsize=".$fontsize.":fontcolor=".$color.":x=(w-text_w)/2:y=(h/2)+".$n.":text='".$arr[$j]."',";
Of course, this works with .ttf fonts but I really want to use Google Fonts.
I have also tried $font = "https://fonts.googleapis.com/css?family=Aclonica"
that does not work either.
I have a feeling that ffmpeg does not use woff2 fonts but I have seen a site that does this I just can't say 100% for sure that they use Google Fonts in the creation, but they do use them in the selection of the font which leads me to believe they use them in the creation of the video.
回答1:
As discussed in the comments, ffmpeg can not handle a font that is passed by URL but rather expects a locally reachable file with the font.
来源:https://stackoverflow.com/questions/60581054/use-google-fonts-in-ffmpeg-fontfile