FFmpeg/usage

drawtext

% ffmpeg -f lavfi -i "color=c=blue:s=480x320:r=24,drawtext=text=FOO:fontcolor=yellow:fontsize=(h/5):x=(w-text_w)/2:y=(h-text_h)/2" -t 10s test.mp4

% ffmpeg -i (映像ファイル) -filter_complex "drawtext=text=FOO:fontcolor=yellow:fontsize=(h/5):x=(w-text_w)/2:y=(h-text_h)/2" -t 10s test.mp4

  • text=FOO
  • fontcolor=yellow
  • fontsize=(h/5)
  • fontfile=KaiseiDecol-Regular.ttf
  • x=(w-text_w)/2
  • y=(h-text_h)/2

参考

  • ffmpegで動画上にテキストを描画する
    • https://qiita.com/niusounds/items/797fe0743a9d59681446

      ffmpeg -y -i input.mp4 -filter_complex "drawtext=fontfile=/path/to/fontfile:text=My Text:x=(w-text_w)/2:y=(h-text_h-line_h)/2:box=1:enable='between(t,2,5)' [subtitles]; [subtitles][0:v] blend=all_expr='A * (if(between(T, 2, 3), (T-2), if(between(T, 4, 5), (5-T), 1))) + B * (1 - (if(between(T, 2, 3), (T-2), if(between(T, 4, 5), (5-T), 1))))' [out]" -map [out] -map 0:a output.mp4