Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg subtitles alignment and position

I am adding subtitles to a video using:

ffmpeg -i "imput.mp4" -lavfi "subtitles=subtitles.srt:force_style='OutlineColour=&H100000000,BorderStyle=3,Outline=1,Shadow=0,Fontsize=18'" -crf 1 -c:a copy "output.mp4"

Which results in:

No Alignment

I am repositioning this using Alignment :

ffmpeg -i "imput.mp4" -lavfi "subtitles=subtitles.srt:force_style='Alignment=9,OutlineColour=&H100000000,BorderStyle=3,Outline=1,Shadow=0,Fontsize=18'" -crf 1 -c:a copy "output.mp4"

Alignment=9

But according to the Line-Alignment ASS Tags docs, there are only 9 positions. 1: Bottom left, 2: Bottom center, 3: Bottom right, 5: Top left, 6: Top center, 7: Top right, 9: Middle left, 10: Middle center, 11: Middle right

Is there a way to tweak this positioning?

I want the subs to be left-aligned, but lower down. Like this:

result

like image 766
friendlygiraffe Avatar asked Sep 10 '19 10:09

friendlygiraffe


2 Answers

Turns out the trick for doing this is to add Alignment=0. Then you can use MarginV and MarginL freely:

ffmpeg -i "imput.mp4" -lavfi "subtitles=subtitles.srt:force_style='Alignment=0,OutlineColour=&H100000000,BorderStyle=3,Outline=1,Shadow=0,Fontsize=18,MarginL=5,MarginV=25'" -crf 1 -c:a copy "output.mp4"
like image 132
friendlygiraffe Avatar answered Nov 05 '22 12:11

friendlygiraffe


I have tested every alignment and made documentation with my design skills.

enter image description here

like image 9
MBK Avatar answered Nov 05 '22 11:11

MBK