ffmpeg字幕的对齐和位置 [英] ffmpeg subtitles alignment and position

查看:1546
本文介绍了ffmpeg字幕的对齐和位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下方法向视频添加字幕:

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"

这将导致:

我正在使用 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"

但是根据行对齐ASS标签文档,只有9个位置. 1:左下,2:右下,3:右下,5:左上,6:顶中,7:右上,9:左中,10:中间,11:右中

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:

推荐答案

找出实现此目的的技巧是添加 Alignment = 0 . 然后,您可以自由使用 MarginV MarginL :

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"

这篇关于ffmpeg字幕的对齐和位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆