This is an old revision of the document!


Table of Contents

DVD Subtitles

For DVDs, closed captioning streams are embedded in the video stream.

Detect CC

See if a DVD has closed captioning:

dvd_copy -o - | ffprobe -v 0 -show_streams -show_entries stream=start_pts -select_streams s -f lavfi -i movie=pipe\\\\:0[out+subcc]

See if a video has closed captioning:

ffprobe -v 0 -show_streams -show_entries stream=start_pts -select_streams s -f lavfi -i movie=dvd_copy.mpg[out+subcc]

When splitting the streams using lavfi device, ffmpeg will “create” a subtitle stream, even if one is not present. To make sure one exists or not, a closer look at the stream itself is actually needed.

This one has a starting presentation timestamp (PTS) that's a positive value, so it's safe to say that one exists.

[STREAM]
start_pts=25257
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

Here's one without it present:

[STREAM]
start_pts=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

Extract CC

Use ffmpeg to extract the closed captioning stream from a DVD using dvd_copy:

dvd_copy -o - | ffmpeg -f lavfi -i movie=pipe\\\\:0[out+subcc] -map 0:s subtitles.srt

Extract CC subtitles from an MPG:

dvd_copy -o dvd_copy.mpg
ffmpeg -f lavfi -i move=dvd_copy.mpg[out+subcc] -map 0:s subtitles.srt

Since the closed captioning is embedded in the video stream, you can re-encode that at the same time. It won't see any other streams though (audio, vobsub).

ffmpeg -f lavfi -i move=dvd_copy.mpg[out+subcc] -map 0:v -map 0:s video.mkv

Navigation