Looking for the above?
i have a few dvd's (i.e. tv show series) that I want to rip - each show/title into it's how m4v/universal file.
handbrakecli script file for ripping dvd/tv show series
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Re: handbrakecli script file for ripping dvd/tv show series
Your best bet is to have a browse around the CLI forum.
Re: handbrakecli script file for ripping dvd/tv show series
Here's the linux bash script (rough) that I made to encode DVD/Episodes. lsdvd is required as it uses it to read the DVD titles. I start the script a boot, it detects when a DVD is inserted, encodes it, and then moves it to a shared directory. When completed it ejects the disc and loops back to detecting if one is inserted again. The variable mintime is set to 20, all titles greater then 20 minutes will be encoded. This is a rough script that I just made yesterday, it is a little rough around the edges and any help is appreciated. Hope this helps you out.
Code: Select all
#!/bin/bash
cd /rip
# ------------------------------------------------------------
# Setup Environment
# ------------------------------------------------------------
PDIR=${0%`basename $0`}
LCK_FILE=`basename $0`.lck
# ------------------------------------------------------------
# Am I Running
# ------------------------------------------------------------
if [ -f "${LCK_FILE}" ]; then
# The file exists so read the PID
# to see if it is still running
MYPID=`head -n 1 "${LCK_FILE}"`
TEST_RUNNING=`ps -p ${MYPID} | grep ${MYPID}`
if [ -z "${TEST_RUNNING}" ]; then
# The process is not running
# Echo current PID into lock file
echo "Start autoripper @" >> /rip/autorip.log
date >> /rip/autorip.log
echo $$ > "${LCK_FILE}"
else
echo "`basename $0` is already running [${MYPID}]" >> /rip/autorip.log
date >> /rip/autorip.log
exit 0
fi
else
echo "Start autoripper @" >> /rip/autorip.log
date >> /rip/autorip.log
echo $$ > "${LCK_FILE}"
fi
# ------------------------------------------------------------
# Do Something
# ------------------------------------------------------------
while true
do
ismediaincheck=$(hal-device | grep /dev/sr0)
isi=${#ismediaincheck}
if [ $isi -gt 85 ]
then
echo "GO! " >> /rip/autorip.log
date >> /rip/autorip.log
mintime=20
lsdvd /dev/sr0 | grep -i Length > not.tmp
titles=$(wc -l < not.tmp )
TITLE=$(lsdvd /dev/sr0 | grep -i Disc | sed 's/Disc Title: //g')
echo "Disc title: " $TITLE
echo There are $titles titles
counter=1
let ttitles=titles+1
while [ $counter -lt $ttitles ]; do
#echo "Title " $counter "",
hour=$(sed -n ''$counter'p' not.tmp | awk -F'gth: ' '{print $2}' | cut -c1-2)
min=$(sed -n ''$counter'p' not.tmp | awk -F'gth: ' '{print $2}' | cut -c4-5)
totalmin=$(($hour * 60))
let totalmin=totalmin+$min
if [ $totalmin -gt $mintime ]; then
echo Title $counter of $titles length is $totalmin minutes !!!
COPYTO=$"/mnt/raid/Shared/Open/fresh/"$TITLE"-T"$counter".m4v"
OUTPUT=$"/rip/handbraketmp/"$TITLE"-T"$counter".m4v"
echo "Ripping title to " $COPYTO >> /rip/autorip.log
date >> /rip/autorip.log
HandBrakeCLI -C4 -i /dev/sr0 -o $OUTPUT -t $counter -e x264 -q 20.0 -a 1,1 -E faac,ac3 -B 160,160 -6 dpl2,auto -R 48,Auto -D 0.0,0.0 -f mp4 --decomb -4 -X 960 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0
echo "Done ripping, moving file, umounting disc and ejecting." >> /rip/autorip.log
date >> /rip/autorip.log
mv $OUTPUT $COPYTO
else
echo Title $counter of $titles length is $totalmin minutes
fi
let counter=counter+1
done
rm not.tmp
umount /dev/sr0
eject /dev/sr0
else
echo "Running @"
date
fi
sleep 15
done
# ------------------------------------------------------------
# Cleanup
# ------------------------------------------------------------
rm -f "${LCK_FILE}"
# ------------------------------------------------------------
# Done
# ------------------------------------------------------------
exit 0