Skip to content

Instantly share code, notes, and snippets.

@josuecau
Last active August 20, 2020 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josuecau/16a9303d747d9db7f9da10c7c358e1c0 to your computer and use it in GitHub Desktop.
Save josuecau/16a9303d747d9db7f9da10c7c358e1c0 to your computer and use it in GitHub Desktop.
Using ffmpeg in Docker to add srt subtitle files to mp4 files
#!/usr/bin/env bash
#
# Using ffmpeg in Docker to add srt subtitle files to mp4 files
#
# https://mutsinzi.com/add-srt-subtitles-to-quicktime/
# https://hub.docker.com/r/jrottenberg/ffmpeg
# Given the following directory structure:
# .
# ├── in
# │   ├── Subs
# │   │   └── French.fre.srt
# │   └── video.mp4
# └── out
docker run --rm \
-v "$(pwd)/in:/tmp/workdir/in" \
-v "$(pwd)/out:/tmp/workdir/out" \
jrottenberg/ffmpeg \
-i in/video.mp4 -i in/Subs/French.fre.srt -c:v copy -c:a copy \
-c:s mov_text -metadata:s:s:0 language=fre out/video.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment