Skip to content

Instantly share code, notes, and snippets.

@dkam
Created March 4, 2012 23:52
Show Gist options
  • Save dkam/1975474 to your computer and use it in GitHub Desktop.
Save dkam/1975474 to your computer and use it in GitHub Desktop.
MythTV transcode
#!/bin/bash
# Arguments - %CHANID% %STARTTIME% %TITLE%
ChanID="${1}"
StartTime="${2}"
Title="${3}"
Subtitle="${4}"
Desc="${5}"
# Debug
#echo "|Chan|Start|Title|SubTitle|Desc" >/tmp/blahz.$$
#echo "|${1}|${2}|${3}|${4}|${5}" >> /tmp/blahz.$$
/usr/bin/mythtranscode -c ${ChanID} -s ${StartTime} -m -l
# Let members of the group edit the files.
umask 002
enc_dir="/mnt/drobo/encoded/${Title}"
src_file="/mnt/mythtv/recordings/${ChanID}_${StartTime}.mpg.tmp"
mkdir -p "${enc_dir}"
/usr/local/bin/ffmpeg -deinterlace -y -threads 1 \
-i ${src_file} \
-acodec libfaac -ab 128k \
-vcodec libx264 -crf 20 -profile main -preset fast \
-f mp4 -r 25 -level 30 \
-metadata title="${Title}" \
-metadata show="${Title}" \
-metadata description="${Desc}" \
-metadata episode_id="${Subtitle}" \
"${enc_dir}/${Title}-${StartTime}.mp4"
rm ${src_file}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment