Skip to content

Instantly share code, notes, and snippets.

@novadeviator
Created October 25, 2013 08:53
Show Gist options
  • Save novadeviator/7151644 to your computer and use it in GitHub Desktop.
Save novadeviator/7151644 to your computer and use it in GitHub Desktop.
hardcoding subtitles and then creating versions for web
if [[ -z $2 ]]
then
echo "error. i need a video file to work on."
echo "use command [video file] [subtitles file (srt)]"
else
FILE=$1
SUBS=$2
SUBBED="${FILE%.*}"_subs.mpeg
# first hardcode subtitles
mencoder "$FILE" -sub "$SUBS" -o "$SUBBED" \
-subfont-text-scale 2.5 -utf8 -subfont-blur 8 -subfont-outline 4 \
-oac copy -ovc lavc -of mpeg -mc 0 -noskip \
-lavcopts vcodec=mpeg2video:vbitrate=15000:keyint=15:vstrict=0:vqscale=1
# create resized versions for web
# webm
avconv -i "$SUBBED" -s 854x480 -b 1000k -qmin 2 -qmax 6 -threads 3 -c:a libvorbis -ab 128k -y "${SUBBED%.*}".webm
# ogv/theora
avconv -i "$SUBBED" -s 854x480 -b 1000k -qmin 2 -qmax 6 -threads 3 -c:a libvorbis -ab 128k -y "${SUBBED%.*}".ogv
# mp4
avconv -i "$SUBBED" -s 854x480 -c:v libx264 -qmax 26 -threads 3 -c:a libvo_aacenc -ab 128k -ac 2 -ar 44100 -y "${SUBBED%.*}".mp4
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment