how text align center, right , left positions with drawtext with multi line as input.
"Hello \n world"
how text align center, right , left positions with drawtext with multi line as input.
"Hello \n world"
FFMPEG doesn't seem to support Alignment in the drawtext command, we need to manually do so. i had the same issue, but to solve that i took a different approach, you can follow the same steps.
i hope these steps help.
I can think of two methods for text alignment in drawtext:
Neither method is ideal.
Using ASS subtitles could be a better solution.
\an
tag) controls the general text alignment and placement.\pos
override tag allows more precise placement.The behavior of \pos
changes depending on the Alignment. See the \pos
tag documentation for examples.
Once you create the ASS file, such as with Aegisub, you can add the subtitles with ffmpeg
.
ffmpeg -i input.mkv -i subs.ass -map 0 -map 1 -c copy output.mkv
Using the subtitles filter:
ffmpeg -i input.mkv -vf "subtitles=subs.ass" -c:a copy output.mkv