SyncFlow

How Subtitle Sync Works — Timing, Offset, and Drift Explained

Behind every subtitle correction is a simple mathematical relationship between the video's actual timing and the subtitle file's timestamps. Understand how SRT and VTT timestamps are structured, how offset and drift differ mathematically, and how SyncFlow applies corrections in your browser without sending data to any server.

📖 8 min read 🔧 Technical explanation 📅 Updated June 2026

Subtitle Timestamp Basics

Every subtitle cue in an SRT or VTT file has a start time and an end time. These timestamps define when the text appears and disappears during video playback. Synchronization changes these timestamps to align them with the audio.

SRT Timestamp Format

SRT (SubRip) uses the format HH:MM:SS,mmm where hours, minutes, and seconds are separated by colons and milliseconds follow a comma. For example, 00:01:23,456 means 1 minute, 23 seconds, and 456 milliseconds into the video. Internally, this is converted to milliseconds: (1 × 60,000) + (23 × 1,000) + 456 = 83,456 ms.

VTT Timestamp Format

VTT (WebVTT) uses HH:MM:SS.mmm — the only difference from SRT is the decimal point instead of a comma before the milliseconds: 00:01:23.456. SyncFlow handles both formats transparently and converts between them during export.

Milliseconds as the Common Unit

SyncFlow converts all timestamps to milliseconds for computation. This eliminates format differences and enables precise arithmetic. A millisecond is fine enough for frame-accurate synchronization at standard framerates (41.7 ms per frame at 24 fps, 33.4 ms at 30 fps).

How Offset Correction Works

Offset correction is the simplest form of subtitle synchronization. It applies a constant value to every timestamp in the file.

The correction formula is:

corrected_time = original_time + offset_value

For example, if every subtitle appears 2 seconds too late (positive offset), you apply an offset of -2000 ms. Every start and end time in the file has 2000 ms subtracted from it. The result is that every cue appears exactly 2 seconds earlier than before.

The offset value is: offset = should_appear_at - currently_appears_at

  • Positive offset (+3000 ms): Subtitles appear 3 seconds too late. Apply -3000 ms correction.
  • Negative offset (-1500 ms): Subtitles appear 1.5 seconds too early. Apply +1500 ms correction.

Because the correction is uniform, offset adjustment preserves the duration of every cue. If a cue was on screen for 3.5 seconds before correction, it remains on screen for 3.5 seconds after correction — just shifted earlier or later in time.

How Drift Correction Works

Drift correction is more complex because the error is not constant — it grows over time. The correction must scale proportionally, applying a smaller adjustment near the start of the video and a larger adjustment near the end.

Linear drift calibration uses two anchor points:

  • Anchor A — a spoken line near the start of the video. The difference between the subtitle's current time and the correct time at this point defines the drift starting point.
  • Anchor B — a spoken line near the end of the video. The difference at this point defines the drift ending point.

The correction formula for any cue at time t between anchors A and B is:

corrected_time(t) = t + drift_A + ((drift_B - drift_A) × (t - t_A) / (t_B - t_A))

Where:

  • drift_A = correction needed at anchor A
  • drift_B = correction needed at anchor B
  • t_A = current subtitle time at anchor A
  • t_B = current subtitle time at anchor B

The result is a linear interpolation: cues near anchor A receive a correction close to drift_A, cues near anchor B receive a correction close to drift_B, and cues in between receive a proportional blend. This accurately reverses the linear drift caused by a constant framerate mismatch.

For a practical walkthrough with examples, see the subtitle drift correction guide.

Offset vs Drift Comparison

Property Offset Drift
Error pattern Constant across all timestamps Linear — grows proportionally with time
Correction type Additive (single value) Linear interpolation (two anchors)
Formula corrected = original + offset corrected = original + interpolated_drift
Cause Different intro, source master, encoding delay Framerate mismatch (e.g., 23.976 vs 25 fps)
Cue duration preserved Yes — all durations stay the same Yes — durations scale proportionally
SyncFlow tool Offset slider or tap-to-sync Fix Progressive Drift panel

The offset slider and drift calibration are independent. You can apply offset first to get the start correct, then apply drift calibration to fix progressive misalignment. The combined result is corrected = original + offset + interpolated_drift.

Browser-Based Processing

All synchronization operations in SyncFlow run entirely in your browser. When you load an SRT or VTT file, the HTML5 File API reads the file content into memory as a string. SyncFlow's parser converts each cue's timestamps to milliseconds, and the application renders the cues in memory.

When you apply an offset or drift correction, SyncFlow recalculates every timestamp in JavaScript, updates the in-memory cue array, and re-renders the waveform preview and Cues Registry. No data is sent to a server for synchronization operations.

When you export, the corrected timestamps are formatted back into SRT or VTT format and written to a new file through the browser's download mechanism. The original file on your computer is never modified — you download a new corrected copy.

🔒 Data stays local

Offset adjustment, drift calibration, inline editing, waveform preview with cue markers, A-B loop, keyboard shortcuts, undo support, save/load projects, and SRT/VTT export — all work locally in your browser. AI features (transcription and translation) send audio/text through a secure Cloudflare proxy to Groq's API. Audio and text are processed in memory and never stored on any server.

The SyncFlow Correction Pipeline

SyncFlow processes subtitle corrections through a sequential pipeline. Each stage builds on the previous one:

  1. Parse: Read the subtitle file and convert all timestamps to milliseconds. Cues are stored as JavaScript objects with index, start, end, and text properties.
  2. Offset: If an offset value is set, add it to every cue's start and end time. The offset is stored as a single number applied uniformly.
  3. Drift calibration: If two anchor points are defined, compute the linear interpolation function and apply the proportional correction to every cue between the anchors.
  4. Render: Update the waveform preview and Cues Registry to reflect the corrected timestamps. All visual elements recalculate in real time.
  5. Export: Convert the corrected timestamps back to the target format (SRT or VTT) and generate a downloadable file.

This pipeline ensures corrections are applied in the correct order and that each stage can be undone independently. The undo history tracks changes at the pipeline level, so you can revert an offset adjustment without losing subsequent drift calibration or inline edits.

Limitations and Edge Cases

Non-Linear Drift

Two-anchor linear calibration assumes drift is proportional to time. In rare cases, drift may be non-linear — for example, when a video has variable framerate segments or when the subtitle file was manually adjusted in sections. For non-linear drift, segment-by-segment calibration or individual cue editing is needed.

Negative Timestamps

If the offset correction pushes a start time below zero, the cue is clamped to zero. SyncFlow displays a warning for any cue with a corrected negative timestamp. You can either reduce the offset or manually edit the affected cues.

Extreme Drift

If drift is very large (over several minutes), the linear interpolation may produce unexpected results if the anchors are not well-chosen. Ensure anchor A is chosen before the halfway point and anchor B after the 80% mark for the most accurate calibration.

Overlapping Cues After Correction

In rare cases, drift correction can cause two adjacent cues to overlap in time. SyncFlow highlights overlapping cues in the Cues Registry. To fix overlaps, adjust the end time of the earlier cue or the start time of the later cue using the inline editor or waveform markers.

For detailed guidance on handling edge cases, see the manual cue editing guide.

Sync Your Subtitles Now

No account, no watermark, no server uploads. SyncFlow applies offset, drift calibration, and manual editing entirely in your browser.

🚀 Open SyncFlow

Frequently Asked Questions

How does subtitle synchronization work?

+

Subtitle synchronization adjusts the timestamps in a subtitle file so they match the audio timing of the video. It works by modifying the start and end times of each cue. Fixed offset problems use a constant shift applied to every timestamp. Progressive drift uses linear interpolation between two anchor points to calculate a proportional correction for each timestamp.

What is the difference between offset and drift?

+

Offset is a constant timing error where every cue is equally early or late. Drift is a progressive error where the misalignment grows over time. Offset correction adds or subtracts a fixed value from every timestamp. Drift correction uses a linear function that applies a smaller adjustment at the start and a larger adjustment at the end.

How does linear drift calibration work?

+

Linear drift calibration uses two anchor points — one near the start and one near the end of the video. The difference between the subtitle's timing and the actual timing at each anchor defines a linear correction function. Every cue timestamp between the anchors is adjusted proportionally based on its position along this line.

Does SyncFlow process subtitles on a server?

+

No. All synchronization, editing, and export processing happens locally in your browser using the HTML5 File API. Offset adjustment, drift calibration, waveform editing, and export run without network requests. AI features (transcription and translation) send audio/text through a secure Cloudflare proxy to Groq's API, but standard sync operations never leave your device.

Can I combine offset and drift correction?

+

Yes. SyncFlow applies offset first, then drift calibration. This lets you fix a constant timing error at the start and a progressive error simultaneously. The offset slider and the Fix Progressive Drift panel are independent. Applying one does not affect the other. Learn more about offset →