How to Change FFmpeg Burned Subtitle Position
Burning subtitles directly into a video (hardsubbing) is a reliable
way to ensure they display correctly on any media player. This guide
explains how to change the vertical alignment and position of these
subtitles using FFmpeg’s subtitles filter and the
force_style parameter. You will learn how to adjust
vertical margins and change text alignment for both SRT and ASS subtitle
formats.
The force_style Option
When burning subtitles using the subtitles filter,
FFmpeg allows you to override the subtitle styles using SubStation Alpha
(ASS) style properties. To change the vertical position, you will
primarily use the MarginV and Alignment
properties.
MarginV: Sets the vertical margin between the subtitle text and the bottom/top of the video frame in pixels.Alignment: Sets the text alignment using a numeric grid system.
Method 1: Adjusting the Vertical Margin (Moving Subtitles Up or Down)
To move bottom-aligned subtitles higher up the screen, increase the
MarginV value. The default value is usually around 10 to 15
pixels.
Run the following command to lift the subtitles 80 pixels from the bottom of the screen:
ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='MarginV=80'" output.mp4To move the subtitles even higher, simply increase the
MarginV value:
ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='MarginV=150'" output.mp4Method 2: Changing the Vertical Alignment (Top, Middle, Bottom)
To position subtitles at the top or center of the screen, you must
change the Alignment property. The alignment numbers are
based on the standard numpad layout:
- Bottom positions:
1(Left),2(Centered),3(Right) - Top positions:
5(Left),6(Centered),7(Right) - Middle positions:
9(Left),10(Centered),11(Right)
Burn Subtitles at the Top of the Video
To place the subtitles at the top-center of the video, set
Alignment=6. When alignment is set to the top, the
MarginV value controls the distance from the top
edge of the video frame.
ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='Alignment=6,MarginV=40'" output.mp4Burn Subtitles in the Exact Middle of the Video
To place the subtitles in the vertical center of the frame, set
Alignment=10:
ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='Alignment=10'" output.mp4Styling SRT vs. ASS Subtitles
- SRT Files: The commands shown above work perfectly
with
.srtfiles. FFmpeg converts the SRT styles on the fly using yourforce_styleinputs. - ASS Files: If you are using
.assfiles, the styling and positioning are usually embedded directly within the file itself. While you can still override them usingforce_style, it is often easier to open the.assfile in a text editor (or subtitle editor like Aegisub) and modify theMarginVandAlignmentvalues in the style headers.