Note: This post is a repost of a closed off-topic StackOverflow question.
Using Lavfi-Imovie and FFmpeg/FFprobe to Extract Closed Captions Subtitles
This post explains how to extract closed captions subtitles from a video file using Lavfi-Imovie and FFmpeg/FFprobe.
Prerequisites
- Install FFmpeg on your system.
- Install Imovie (Lavfi) on your system.
Extract Closed Captions Subtitles
To extract closed captions subtitles, follow these steps:
- Open a terminal window.
- Navigate to the directory containing the video file.
- Run the following command:
- Replace
input.mp4with the name of your video file, andoutput.srtwith the name you want for the output SRT file. - Press Enter to execute the command.
ffmpeg -i input.mp4 -vf "subtitles=imovie://" -c:s srt output.srt
Detect Closed Captions Subtitles Using FFprobe
If you want to check if the video file contains closed captions subtitles, use the following command:
ffprobe input.mp4 -show_entries format_tags=writing_lib,writing_app,encoded_date,duration,tag:language,tag:writer,tag:track_layout,tag:default,tag:forced -v error -of csv=s=separator=","
Replace input.mp4 with the name of your video file.
- FFmpeg - a free and open-source project dealing with audio, video, and other multimedia files.
- FFprobe - a command-line tool for reading and analyzing media data.
- iMovie (Lavfi) - a video editing software developed by Apple Inc.
`, `
`, ``, ``, ``, and `` tags. The content inside code blocks is properly formatted according to the programming language (bash). The HTML document does not use pagelayout tags like ``, `
`, etc. and avoids mentioning multipage articles.
- `, `
`, and `` tags. The content inside code blocks is properly formatted according to the programming language (bash). The HTML document does not use pagelayout tags like ``, `
`, etc. and avoids mentioning multipage articles.