Skip to content

Instantly share code, notes, and snippets.

@canburak
Created January 20, 2014 09:43
Show Gist options
  • Save canburak/8517499 to your computer and use it in GitHub Desktop.
Save canburak/8517499 to your computer and use it in GitHub Desktop.
I use this to move videos to iTunes. The staps are: (1) Get the video (2) Add the subtitle to the folder (optional) (3) Run the script below, path to the video as first parameter (If there is a subtitle, it adds it to the resulting file.) (3) use http://identify2.arrmihardies.com/ to add metadata to the video. Get the tool from http://handbrake.…
#!/bin/bash
#set -vx
outputdir="/Users/can/Desktop/iPad/"
input="$1"
mkdir "${outputdir}" 2> /dev/null || true
basename="$(basename "${input}")"
dirname="$(dirname "${input}")"
noext="${basename%.*}"
srt="${dirname}/${noext}.srt"
output="${outputdir}/${noext}.mp4"
log="${output}.log"
echo Will encode ${noext}
if [ -f "${srt}" ]; then
nice ~/Can/bin/HandBrakeCLI \
--input "${input}" \
--output "${output}" \
--srt-file "${srt}" \
--srt-lang eng \
--srt-default 1 \
--preset "High Profile"
else
echo No subtitle found for ${noext}
nice ~/Can/bin/HandBrakeCLI \
--input "${input}" \
--output "${output}" \
--preset "High Profile"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment