Extract a subtitle track to SRT
Many video files carry subtitle streams inside the container, often as a `mov_text` track in MP4 or a PGS bitmap track in MKV. If you want to edit them in a text editor, generate transcripts, or burn them back in with custom styling, the first step is to extract the track as a separate SRT file.
The command
ffmpeg -i in.mp4 -map 0:s:0 -c:s srt out.srtWhat it does
The `-map 0:s:0` option selects the first subtitle stream from input 0. The `-c:s srt` flag converts it to the SubRip text format. The output is a plain-text SRT file with the cues, timecodes, and sequence numbers you can edit in any text editor. If the input has multiple subtitle languages, change `0:s:0` to `0:s:1`, `0:s:2`, and so on to pick the right one.
Requirements
The input must contain a subtitle stream. PGS bitmap subs and ASS/SSA subs convert to SRT cleanly; image-based subs (DVD VobSub) need a separate OCR pass. No hardware required.
Things to avoid
- Picking a wrong stream index. If the file has 2 video streams and 1 subtitle, the subtitle is `0:s:0` only if it's the only subtitle — count carefully with `ffprobe`.
- Expecting styled output. The SRT format has no styling beyond italic, bold, underline. ASS/SSA styles are dropped on conversion.
- Re-encoding the whole file. Without `-c copy`, FFmpeg may re-encode the video stream too. Specify `-c copy` for the video and audio to keep them untouched.
- Naming the output `out.srt` and then renaming it to `out.ass` later — the file extension is just a hint to the player, but the content was written as SRT, so keep the extension matching.