Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ -z $1 ]; then
- echo "no file given"
- exit 0
- fi
- if [ -z $2 ]; then
- outFilePrefix="$(echo $1 | sed 's=.*/==;s/.iso//I')"
- else
- outFilePrefix=$2
- fi
- if [ -z $3 ]; then
- outTitleOffset=1
- else
- outTitleOffset=$3
- fi
- rawout=$(HandBrakeCLI --min-duration 0 -i $1 -t 0 2>&1 >/dev/null)
- count=$(echo $rawout | grep -Eao "\\+ title [0-9]+:" | wc -l)
- echo $count
- echo $rawout | grep -Eao "\\+ duration: [0-9]+:[0-9]+:[0-9]+"
- for i in $(seq $count)
- do
- title=$(printf "%02d" $outTitleOffset)
- ((outTitleOffset++))
- echo -e "\n\n\nExtracting title $i as '${outFilePrefix}${title}.mkv'\n\n\n"
- HandBrakeCLI -i $1 -t $i --preset Normal --output ${outFilePrefix}${title}.mkv
- done
- echo -e "\n\n\niso2mkv complete!"
- #prereqs:
- #sudo add-apt-repository ppa:stebbins/handbrake-releases
- #sudo apt-get update
- #apt-get install handbrake-cli libdvdcss2
- #It's worth noting that if you want that count value to be right you'll need to pass --min-duration 0
- #to HandBrakeCLI otherwise you'll come up short on some DVDs.
- #default is the track length needs to be >10 seconds
- #https://handbrake.fr/docs/en/1.0.0/cli/cli-guide.html
- #version 2 of this script: https://pastebin.com/SRHihAED
Advertisement
Add Comment
Please, Sign In to add comment