Bake-in captions into videos using srts and ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations | |
# with women in STEAM to learn a bit about what they do and who they are. | |
# https://steampoweredshow.com/learn-more/ | |
# 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 video.mov, there should be a video.en_US.srt 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; | |
do | |
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.en_US.srt" "${f%w.*}subs.mp4" < /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment