SHOW:
|
|
- or go back to the newest paste.
| 1 | - | https://www.google.com/search?q=handbrake+cli+video+per+chapter&ie=utf-8&oe=utf-8 |
| 1 | + | |
| 2 | - | https://www.google.com/search?q=iso+to+mkv&ie=utf-8&oe=utf-8#q=iso+to+mkv+ubuntu |
| 2 | + | |
| 3 | - | https://superuser.com/questions/394516/how-to-convert-50-episodes-from-dvd-into-50-mp4-with-handbrake-easily |
| 3 | + | if [ -z $1 ]; then |
| 4 | echo "no file given" | |
| 5 | exit 0 | |
| 6 | fi | |
| 7 | - | sudo add-apt-repository ppa:stebbins/handbrake-releases |
| 7 | + | |
| 8 | - | sudo apt-get update |
| 8 | + | if [ -z $2 ]; then |
| 9 | outFilePrefix="$(echo $1 | sed 's=.*/==;s/.iso//I')" | |
| 10 | - | HandBrake gtk gui with the command: |
| 10 | + | else |
| 11 | - | apt-get install handbrake-gtk |
| 11 | + | outFilePrefix=$2 |
| 12 | fi | |
| 13 | - | HandBrake CLI with the command: |
| 13 | + | |
| 14 | - | apt-get install handbrake-cli |
| 14 | + | if [ -z $3 ]; then |
| 15 | outTitleOffset=1 | |
| 16 | - | HandBrakeCLI -Z "High Profile" -i a_movie.iso -o a_movie.mp4 |
| 16 | + | else |
| 17 | outTitleOffset=$3 | |
| 18 | fi | |
| 19 | ||
| 20 | rawout=$(HandBrakeCLI --min-duration 0 -i $1 -t 0 2>&1 >/dev/null) | |
| 21 | - | https://handbrake.fr |
| 21 | + | |
| 22 | ||
| 23 | echo $count | |
| 24 | - | $ for i in `seq 4`; do HandBrakeCLI --input /dev/dvd --title $i --preset Normal --output NameOfDisc_Title$i.mp4; done |
| 24 | + | echo $rawout | grep -Eao "\\+ duration: [0-9]+:[0-9]+:[0-9]+" |
| 25 | ||
| 26 | - | patty@patty:~$ for i in `seq 4`; do HandBrakeCLI -i /media/patty/DVDTITLE -t $i -o DVDTITLE_Title$i.mp4 -e x264 -q 18; done |
| 26 | + | |
| 27 | do | |
| 28 | title=$(printf "%02d" $outTitleOffset) | |
| 29 | ((outTitleOffset++)) | |
| 30 | echo -e "\n\n\nExtracting title $i as '${outFilePrefix}${title}.mkv'\n\n\n"
| |
| 31 | HandBrakeCLI -i $1 -t $i --preset Normal --output ${outFilePrefix}${title}.mkv
| |
| 32 | - | rawout=$(HandBrakeCLI -i /dev/dvd -t 0 2>&1 >/dev/null) |
| 32 | + | |
| 33 | - | #read handbrake's stderr into variable |
| 33 | + | |
| 34 | echo -e "\n\n\niso2mkv complete!" | |
| 35 | ||
| 36 | - | #parse the variable using grep to get the count |
| 36 | + | |
| 37 | #prereqs: | |
| 38 | #sudo add-apt-repository ppa:stebbins/handbrake-releases | |
| 39 | #sudo apt-get update | |
| 40 | - | HandBrakeCLI --input /dev/dvd --title $i --preset Normal --output $i.mp4 |
| 40 | + | #apt-get install handbrake-cli libdvdcss2 |
| 41 | ||
| 42 | #It's worth noting that if you want that count value to be right you'll need to pass --min-duration 0 | |
| 43 | #to HandBrakeCLI otherwise you'll come up short on some DVDs. | |
| 44 | - | 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. For example, my test DVD has a 10 second track 1 that will be ignored in the final output |
| 44 | + | #default is the track length needs to be >10 seconds |
| 45 | - | https://handbrake.fr/docs/en/1.0.0/cli/cli-guide.html |
| 45 | + | #https://handbrake.fr/docs/en/1.0.0/cli/cli-guide.html |
| 46 | #version 2 of this script: https://pastebin.com/SRHihAED |