Skip to content

Instantly share code, notes, and snippets.

@thepoppingone
Created March 14, 2020 17:50
Show Gist options
  • Save thepoppingone/b53eb7a5919b9f889f9b242f4901cb21 to your computer and use it in GitHub Desktop.
Save thepoppingone/b53eb7a5919b9f889f9b242f4901cb21 to your computer and use it in GitHub Desktop.
Add srt file to mp4 file and flatten to a mp4 with hardcoded subs
#!/bin/sh
# Author : Wang Poh Peng
# Description : Use FFMPEG to hardcode subs into videos into mkv or mp4 format
RED='\033[1;31m'
NC='\033[0m' # No Color
GREEN='\033[0;32m'
CYAN='\033[0;36m'
ls | grep '.mp4\|srt'
echo "${GREEN}Please enter .mp4 file full name to add subtitles below:${NC}"
read MP4FILE
echo "${GREEN}Please enter .srt file full name below:${NC}"
read SRTFILE
echo "${GREEN}Please enter the final output mp4 file e.g. test.mp4:${NC}"
read OUTPUTFILE
ffmpeg -i $MP4FILE -filter_complex "subtitles=$SRTFILE" -c:a copy $OUTPUTFILE
echo "${CYAN}The video file is saved at $PWD/$OUTPUTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment