Skip to content

Instantly share code, notes, and snippets.

Created October 10, 2012 07:20
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 anonymous/3863702 to your computer and use it in GitHub Desktop.
Save anonymous/3863702 to your computer and use it in GitHub Desktop.
stdin
#!/bin/bash
# http://www.cyberciti.biz/tips/howto-linux-create-video-dvds.html
# http://www.linuxtv.org/wiki/index.php/MEncoder
# http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-vcd-dvd.html
if [[ -f ~/.hvtrc ]]
then
source ~/.hvtrc
fi
usage()
{
cat << EOF
usage: $0 options
This script is used for capturing home videos and should produce files small enough to fit on a 4.7gb dvd.
CONFIGURATION
Set configuration variables inside the config file: ~/.hvtrc
ENVIRONMENT VARIABLES
AUDIO_DEVICE : The audio device to record from. Accepted format looks like this "hw.2,0".
Use "arecord -l" to find out which card you wish to record from.
RECORDING_PATH: This is a path to the directory you wish to store the recordings.
Acceptable format is: "~/path/to/dir" or "/path/to/dir"
OPTIONS:
-h Show this message
-n The name of home video you are working on (required)
-v Verbose
EOF
}
while getopts “n:vh” OPTION
do
case $OPTION in
h)
usage
exit 1
;;
n)
NAME=$OPTARG
FILE=$RECORDING_PATH/$NAME.mpg
;;
v)
VERBOSE=1
;;
?)
usage
exit
;;
esac
done
if [[ -z $NAME ]] || [[ -z $RECORDING_PATH ]]
then
usage
exit 1
fi
mencoder -endpos 03:00:00 \
-tv driver=v4l2:norm=ntsc:forceaudio:alsa:audiorate=48000:adevice=$AUDIO_DEVICE tv:// \
-vf pp=ci \
-srate 48000 \
-af lavcresample=48000 \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=8000:vbitrate=3700:keyint=15:trell:mbd=2:precmp=2:subcmp=2:dia=-10:predia=-10:cbp:mv0:dc=10:vqmin=1:lmin=1:vstrict=0:acodec=ac3:abitrate=192:aspect=4/3:threads=8 \
-ofps 30000/1001 \
-ovc lavc \
-oac lavc \
-of mpeg \
-mpegopts format=dvd:tsaf \
-o $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment