【ffmpeg】問題解決: Could not load font "Arial.ttf": cannot open resource linux font path

【ffmpeg】問題解決: Could not load font “Arial.ttf”: cannot open resource

此為找不到字體的問題,需要修改路徑,

如果是 linux系統,路徑位置在

  • /usr/share/fonts
  • /usr/local/share/fonts
  • ~/. fonts

範例: Sample Code

ffmpeg -i test_video.mp4 -vf “drawtext=fontfile=/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf: text=%{n}: x=50: y=50:  fontsize=100: fontcolor=white” -y ./output_video.mp4
  • 其中 /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf 就是字體路徑的位置

Reference

https://blog.csdn.net/rong11417/article/details/104610077