Syncing Subtitles with Rust is a practical project for Rust learners who want to transform a real file without losing its content. A short film's opening title has changed, so every caption needs the same time offset. You will build a tool that exports a playable WebVTT track while preserving the original captions, video, and earlier results.
Two Guided Labs move from checked time calculations to complete-file validation and protected output creation. One Challenge combines the same techniques for a different film and offset direction. Each lab starts independently with its own prepared project and files.
What You Will Learn
After completing this course, you will be able to:
- convert validated timestamp fields into integer milliseconds with checked multiplication and addition;
- shift both endpoints of every cue by one signed offset while preserving duration, file order, complete Unicode and multiline text, legal overlap, and equal start times;
- handle malformed or unsupported input, negative shifted times, and integer overflow through contextual
Resulterrors; - validate and transform the entire caption collection before creating a new output, reject existing output paths, and preserve earlier work when retrying;
- load your actual exported file in Preview, check public visual alignment points, play the video with its real subtitle track, and download the loaded files.
Who This Course Is For
This course is for learners ready to combine familiar Rust data types and file operations into a small, recoverable transformation tool.
Prerequisites: Basic terminal use and Rust structs, enums, Vec, Result, strings, file reading and writing, basic tests, and loops. Build Your First Rust CLI is recommended but optional; no clap knowledge is required.
Learning environment: LabEx provides Terminal and Preview, a prepared Rust project, and original synthetic silent films with visible scene cards and public observation times. The parser, formatter, command interface, and actual-file player are supplied. Interface labels and command output remain in English.
Frequently Asked Questions
Will I write a complete subtitle parser or transcribe video?
No. The course uses a defined plain-text WebVTT subset. You implement time conversion, one-cue and whole-collection shifts, and the protected export boundary. Full WebVTT support, transcription, translation, and audio/video encoding are outside the course.
Can a corrected run overwrite an earlier result?
No. Existing output paths are refused. You learn to keep an earlier result in a unique backup directory before recreating its required filename. Invalid late cues are rejected before output creation rather than leaving a partial export.
How long should I allow?
The author estimates 140 minutes, including reading, visual checks, and ordinary recovery. This estimate has not been validated through a beginner walkthrough.

