How to Sync Subtitles with Audio in mpv?
Achieving perfect synchronization between subtitles and audio in the mpv media player is a straightforward process that can be done entirely via quick keyboard shortcuts or precise configuration settings. Whether your subtitle file is lagging behind or appearing too early, mpv allows you to shift the text timing on the fly in 100-millisecond increments. This guide covers the essential hotkeys for real-time adjustments and explains how to make permanent or ultra-precise timing changes so you can enjoy a seamless viewing experience.
Essential Keyboard Shortcuts for Real-Time Sync
The fastest way to fix out-of-sync subtitles while a video is playing is by using mpv’s built-in hotkeys. These keys shift the subtitle timing forward or backward relative to the audio track.
- Delay Subtitles (Shift Text Backward): Press the
zkey. This delays the subtitles by 100 milliseconds (\(0.1\) seconds) per press, which is useful if the text is appearing before the actor speaks. - Advance Subtitles (Shift Text Forward): Press the
xkey. This moves the subtitles ahead by 100 milliseconds per press, which is ideal if the text is appearing after the audio has already played.
Whenever you press these keys, an On-Screen Display (OSD) message
will appear in the top-left corner of the video window, showing the
total current delay (e.g., Sub delay: 200ms or
Sub delay: -300ms).
Exact Subtitle Adjustments via Command Line
If you already know the exact time discrepancy before opening your media file, you can launch mpv from your terminal or command prompt with a specific delay parameter.
Use the --sub-delay option followed by the desired time
offset in seconds:
mpv --sub-delay=2.5 video.mpk- A positive value (e.g.,
2.5) delays the subtitles by 2.5 seconds. - A negative value (e.g.,
-1.5) advances the subtitles by 1.5 seconds.
Making Subtitle Adjustments Permanent
If you find that you consistently need to adjust subtitles for a
specific file, or if you want a default delay applied to all videos, you
can modify mpv’s configuration file (mpv.conf).
- Locate your
mpv.conffile (typically found in~/.config/mpv/on Linux/macOS or%APPDATA%\mpv\on Windows). - Open the file in a text editor.
- Add the following line to set a permanent default delay (replace
0.5with your preferred number of seconds):
sub-delay=0.5
For files where the timing drifts progressively over time rather than
staying at a constant delay, you may need to adjust the subtitle frame
rate instead. This can be toggled in real-time by pressing
Ctrl+[ and
Ctrl+] to scale the subtitle speed up or
down.