Skip to content

Instantly share code, notes, and snippets.

Last active July 17, 2022 00:38
What would you like to do?
Bake-in captions into videos using srts and ffmpeg
# Check out STEAM Powered ( where I have conversations
# with women in STEAM to learn a bit about what they do and who they are.
# Usage
# =====
# Execute script in the directory containing the video and srts files, or modify to take
# a path argument.
# Expects the directory to contain the video files with correspondingly named
# srt files in the same directory.
# ie. If there is a file named, there should be a to apply.
# Outputs a new videosubs.mp4 file.
# For individual video files, use the ffmpeg command on its own.
# Change input video file extension as needed.
find -E . -type f -regex ".*.mov" -print0 | while IFS= read -r -d '' name;
f=$(basename -- "$name")
# Modify the SRT suffix to match your required language, or remove.
# Change output video file suffix and extension as needed.
ffmpeg -nostdin -i "$f" -vf subtitles="$" "${f%w.*}subs.mp4" < /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment