#author("2024-10-12T14:23:20+00:00","default:yoya","yoya")
#author("2024-10-12T17:11:10+00:00","default:yoya","yoya")
[[FFmpeg/usage]]

* drawtext [#q73f61d7]

>
% 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
- box=1:boxcolor=black@0.7

>
-qscale:v 2 

* 参考 [#peae21da]

- 文字を描写する drawtext
--  https://nico-lab.net/drawtext_with_ffmpeg/


- 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