Skip to content
← Library

Video write-up · May 15, 2024

Add subtitles to any video

A compact media pipeline that extracts audio, transcribes it with Whisper, creates SRT captions and burns them back into the video.

This tutorial turns subtitle generation into three visible stages. MoviePy extracts MP3 audio from an MP4 file. OpenAI Whisper transcribes that audio into an SRT subtitle file. A final media step combines the original video with those captions to produce a new subtitled MP4. Because every intermediate file is named and inspectable, the workflow is easy to debug or replace piece by piece.

The demonstration starts with only the source video in the folder, runs the script, and produces the audio, subtitle and final video artifacts in roughly seconds for the short sample. A second run produces slightly different wording, which is an honest reminder that speech recognition is probabilistic. Captions should be reviewed when names, technical terms or exact quotations matter.

The same shape extends beyond one API. A local Whisper model can replace the hosted transcription call; FFmpeg can handle extraction and subtitle rendering; and the SRT file can be edited before the final render. The durable idea is not one vendor—it is the clean separation between media conversion, transcription and presentation.

What to take from it

  • Preserve MP3 and SRT intermediates so transcription can be corrected without rerunning everything.
  • Review generated captions for names and specialised vocabulary.
  • Keep API keys outside source code even in short demonstrations.