#!/bin/bash version=0.5 COLOROFF="\033[1;0m" # standart color HEADCOLOR="\033[1;32m" # green MAINCOLOR="\033[1;37m" # white SUBCOLOR="\033[1;36m" # blue TABLECOLOR="\033[1;31m" # red INPUTCOLOR="\033[1;35m" # lilac echo -e "${TABLECOLOR}+------------------+" echo -e "|${HEADCOLOR} TUXCOPYDVD v${version}${TABLECOLOR} |" echo -e "${TABLECOLOR}+------------------+" echo -e "$MAINCOLOR" #-------------- Tests des dépendances ------------------ LISTE_APPLIS="mplayer tcprobe tccat tcextract grep awk sed bc expr tcrequant mplex dvdauthor mkisofs perl" sortie="notok" for i in $LISTE_APPLIS; do which $i > /dev/null 2>&1 if [ "$?" = "1" ]; then [ "$sortie" = "notok" ] && echo -e "${MAINCOLOR}Programme(s) manquant(s) : " echo -e "${HEADCOLOR} ${i}${MAINCOLOR}" sortie="ok" fi; done if [ "$sortie" = "ok" ]; then echo exit -1 fi #-------------- fin Tests des dépendances ------------------ #parametres script iso="notok" stocke="notok" fly="notok" while [ $1 ]; do case $1 in "--a-la-volee" ) exist=`which buffer 2>/dev/null` if [ "$exist" = "" ]; then echo "Le programme \"buffer\" est manquant, le mode \"à la volée\" est donc impossible." else echo "Toutes les opérations seront effectuées à la volée." fly="ok" fi shift;; "--version" ) exit;; "--stockage" ) echo "Tous les fichiers intermédiaires seront conservés... Il faut beaucoup d'espace disque !" stocke="ok" shift;; "--config" ) [ -r ~/.tuxcopydvdrc ] && rm -f ~/.tuxcopydvdrc touch ~/.tuxcopydvdrc echo "-->Toutes les autres options de tuxcopydvd sont ignorées." echo "-->Mode config : Le fichier de préférence va être généré..." #repertoire de travail exist=notok until [ "$exist" = "OK" ] do echo -n -e "${SUBCOLOR}-------> Répertoire de travail [défaut : /space] ?" echo -n -e "${INPUTCOLOR}> " read RACINE if [ "$RACINE" = "" ] ; then RACINE="/space" echo "Choix par défaut : /space" fi if [ -d "$RACINE" ]; then exist=OK FS=`df -P -T -m $RACINE | grep /dev | awk '{print $2}'` free=`df -P -T -m $RACINE | grep /dev | awk '{print $5}'` if [ $free -le 9000 ]; then echo -e "${MAINCOLOR}${free}Mo sont disponibles dans ${RACINE}, pensez à faire de la place..." fi else echo -e "${HEADCOLOR}Ce répertoire n'existe pas ou ne possède pas les bons droits..." fi done echo "1." $RACINE >> ~/.tuxcopydvdrc #device exist=notok until [ "$exist" = "OK" ] do echo -n -e "${SUBCOLOR}-------> Device du DVD [défaut : /dev/dvd] ? " echo -n -e "${INPUTCOLOR}> " read DEVICE if [ "$DEVICE" = "" ] ; then DEVICE="/dev/dvd" echo "Choix par défaut : /dev/dvd" fi if [ -r "$DEVICE" ]; then exist=OK else echo -e "${HEADCOLOR}Ce device n'existe pas..." fi done echo "2." $DEVICE >> ~/.tuxcopydvdrc exit;; "--help" ) echo "--a-la-volee : pour effectuer le processus de copie en 1 seule étape depuis le DVD source." echo "--config : pour créer le fichier de conf." echo "--version : pour controler le numéro de version." echo "--help : pour afficher ce message." echo "--iso : pour créer une image iso." echo "--stockage : pour conserver les GROS fichiers intermédiaires." exit;; "--iso" ) echo "Une image iso sera générée à la fin." iso="ok" shift;; * ) echo "Option inconnue $1 donc ignorée..." shift;; esac done #fin parametres script # lecture fichier conf if [ -r ~/.tuxcopydvdrc ] ; then RACINE=`cat ~/.tuxcopydvdrc | grep ^"1\." | awk '{print $2}'` DEVICE=`cat ~/.tuxcopydvdrc | grep ^"2\." | awk '{print $2}'` else echo "fichier de conf manquant, relancer tuxcopydvd en mode --config" exit fi #fin lecture fichier conf # ANALYSE DU DVD----------------------------------- echo echo -e "${TABLECOLOR}++++++++SCAN DU DVD++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo -e "${MAINCOLOR}" # test présence dvdok="notok" while [ "$dvdok" = "notok" ]; do tcprobe -i $DEVICE 2>/dev/null > /tmp/infos.dvd.test testdvd=`ls -l /tmp/infos.dvd.test | awk '{print $5}'` if [ $testdvd -eq 0 ]; then echo echo -e "${SUBCOLOR}Insérez le DVD dans $DEVICE et appuyez sur ENTREE ${MAINCOLOR}" # kdialog --warningcontinuecancel "Aucun DVD détecté dans $DEVICE" if [ $? = 2 ]; then exit fi rm -f /tmp/infos.dvd.test read else dvdok="ok" fi done [ -e /tmp/infos.dvd.test ] && rm -f /tmp/infos.dvd.test echo -e "${HEADCOLOR}Analyse vidéo en cours...${MAINCOLOR}" # fin test présence #création dossiers de travail projet=$( dd if=$DEVICE ibs=1 skip=32808 count=32 2>/dev/null | sed "s/\ //g" ) [ -e $RACINE/$projet ] && rm -rf $RACINE/$projet mkdir $RACINE/$projet mkdir $RACINE/$projet/tmp #fin création dossiers # analyse structure DVD tcprobe sur tous les titres titre=1 tcprobe -i $DEVICE -T $titre > $RACINE/$projet/tmp/infos.dvd.$titre 2>&1 titremax=`cat $RACINE/$projet/tmp/infos.dvd.$titre | grep "DVD title" | awk '{print $4}' | awk -F "/" '{print $2}' | awk -F ":" '{print $1}'` titre=2 while [ $titre -le $titremax ]; do tcprobe -i $DEVICE -T $titre > $RACINE/$projet/tmp/infos.dvd.$titre 2>&1 titre=$(($titre + 1)) done titre=1 timemax=0 titredef=1 liste="" while [ $titre -le $titremax ]; do echo -e "${HEADCOLOR}--->Titre $titre${MAINCOLOR}" echo -n -e "${MAINCOLOR}Données :${SUBCOLOR}" ; cat $RACINE/$projet/tmp/infos.dvd.$titre | grep "DVD title" | awk -F ":" '{print $2}' | awk -F ", title" '{print $1}' time=`cat $RACINE/$projet/tmp/infos.dvd.$titre | grep "time" | awk '{print $5}'` H=`echo $time | cut -d: -f 1` M=`echo $time | cut -d: -f 2` S=`echo $time | cut -d: -f 3` timesec=`bc < Quel titre à ripper [défaut : $titredef] ? " echo -n -e "${INPUTCOLOR}> " read title # title=`kdialog --title tuxcopydvd --radiolist "Quel titre à ripper ?" $liste` isnum=`echo $title | grep "^[1-9][0-9]*$"` if [ "$title" = "" ]; then echo "Choix par défaut : titre $titredef..." title=$titredef fi isnum=`echo $title | grep "^[1-9][0-9]*$"` if [ "$isnum" != "" ]; then if [ $title -gt $titremax ]; then echo "Attention, il n'y a que $titremax titre(s) disponible(s) !!!" isnum="" fi else echo "Attention, le titre est un entier supérieur ou égal à 1 !!!" fi done echo -n -e "${MAINCOLOR}" # fin choix titre à ripper # durée du titre choisi time=`cat $RACINE/$projet/tmp/infos.dvd.$title | grep "time" | awk '{print $5}'` H=`echo $time | cut -d: -f 1` M=`echo $time | cut -d: -f 2` S=`echo $time | cut -d: -f 3` timesec=`bc < $RACINE/$projet/tmp/infos.dvd 2>&1 #choix angle angle=`cat $RACINE/$projet/tmp/infos.dvd | grep "angles in this DVD title" | awk '{print $3}'` anglemax=$angle if [ $anglemax -gt 1 ]; then isnum="" echo -e "${HEADCOLOR}Il y a ${SUBCOLOR}$anglemax${HEADCOLOR}angles disponibles dans ce titre... " until [ "$isnum" != "" ]; do echo -n -e "${SUBCOLOR}-------> Quel angle à ripper [défaut : 1] ? " echo -n -e "${INPUTCOLOR}> " read angle if [ "$angle" = "" ]; then echo "Choix par défaut : angle 1..." angle=1 fi isnum=`echo $angle | grep "^[1-9][0-9]*$"` if [ "$isnum" != "" ]; then if [ $angle -gt $anglemax ]; then echo "Attention, il n'y a que $anglemax angle(s) disponible(s) !!!" isnum="" fi else echo "Attention, l'angle est un entier supérieur ou égal à 1 !!!" fi done echo -n -e "${MAINCOLOR}" echo else echo "On rippe le seul angle disponible, le "$angle"..." fi echo -e "${HEADCOLOR}" #fin choix angle # taille du titre choisi + analyse audio echo -e "${HEADCOLOR}Analyse audio en cours...${MAINCOLOR}" blocfin=`cat $RACINE/$projet/tmp/infos.dvd | grep "DVD start=" | awk -F "end=" '{print $2}'` blocdeb=`cat $RACINE/$projet/tmp/infos.dvd | grep "DVD start=" | awk -F "end=" '{print $1}' | awk -F "start=" '{print $2}'` nbchap=`cat $RACINE/$projet/tmp/infos.dvd.$title | grep "chapter(s)" | awk '{print $5}'` tailletotko=`echo "($blocfin - $blocdeb + 1 ) * 2" | bc -ql` echo "taille du titre : " $tailletotko "Ko" # scan audio tccat -i $DEVICE -T $title,1,$angle 2>/dev/null > $RACINE/$projet/tmp/chp1.vob tcprobe -i $RACINE/$projet/tmp/chp1.vob -H 20 2>/dev/null > $RACINE/$projet/tmp/infoaudio.dvd rm -f $RACINE/$projet/tmp/chp1.vob IFS=$'\n' index=($(cat $RACINE/$projet/tmp/infoaudio.dvd | grep "\-a" | grep audio | awk '{print $4}')) bitrate=($(cat $RACINE/$projet/tmp/infoaudio.dvd | grep -v "frame" | grep "bitrate" | awk -F "bitrate=" '{print $2}' | awk '{print $1}')) nch=$((${#index[*]})) i=0 taillevideo=$tailletotko while [ $i -lt $nch ]; do echo -e "${HEADCOLOR}--->Piste $i${MAINCOLOR}" aid[$i]=$((${index[i]}+128)) [ ${bitrate[$i]} = "" ] && bitrate[$i]="448" tailleaudio[$i]=`bc < Combien de pistes audio souhaitez-vous copier [défaut : 2] ? " echo -n -e "${INPUTCOLOR}> " read nbaudio if [ "$nbaudio" = "" ]; then echo "Choix par défaut : on conserve 2 bandes-son..." nbaudio=2 fi isnum=`echo $nbaudio | grep "^[0-9][0-9]*$"` if [ "$isnum" != "" ]; then if [ $nbaudio -gt $nch ]; then echo "Attention, il n'y a que $nch bandes sonores disponibles..." isnum="" fi else echo "Veuillez saisir un entier strictement positif." fi done i=1 while [ $i -le $nbaudio ]; do isnum="" until [ "$isnum" != "" ]; do echo -n -e "${SUBCOLOR}-------> Quelle piste ripper en position $i ? " echo -n -e "${INPUTCOLOR}> " read numaudio[$i] isnum=`echo ${numaudio[$i]} | grep "^[0-9][0-9]*$"` if [ "$isnum" != "" ]; then if [ ${numaudio[$i]} -gt $nbaudiomax ]; then echo "Attention, cette piste audio n'existe pas !!!" isnum="" fi else echo "Attention, l'index de la piste audio est un entier supérieur ou égal à 1 !!!" fi done echo -n -e "${MAINCOLOR}" i=$(($i+1)) done else nbaudio=1 numaudio[$nbaudio]=1 echo -e "${MAINCOLOR}On rippe la seule piste audio disponible, la 1..." fi i=1 while [ $i -le $nbaudio ]; do echo -e "${HEADCOLOR}Langue de la piste choisie : ${pisteaudio[${numaudio[i]}]}" echo -e "${HEADCOLOR}Type de la piste choisie : ${typeaudio[${numaudio[i]}]}" echo -e "${HEADCOLOR}Bitrate de la piste choisie : ${bitrate[${numaudio[i]}]}" echo -e "${HEADCOLOR}Index de la piste choisie : ${index[${numaudio[i]}]}" echo -e "${MAINCOLOR}" i=$(($i+1)) done au=$(($index+1)) i=1 tailleau=0 while [ $i -le $nbaudio ]; do tailleau=`echo "$tailleau + ${tailleaudio[${numaudio[i]}]}" | bc -ql` i=$(($i+1)) done echo "taille audio : " $tailleau "Ko" req=`echo "1.00 * $taillevideo / (4505600 - ${tailleau})" | bc -ql` test=`bc < 1. EOF ` if [ "$test" = "1" ]; then echo pc=`bc </dev/null rm -f $RACINE/$projet/*.fifo 2>/dev/null t1=`date +'%s'` # à la volée------------------------- if [ "$fly" = "ok" ]; then echo echo -e "${TABLECOLOR}++++++++COPIE A LA VOLEE EN COURS+++++++++++++++++++++++++++++++++++++++++++" echo -e "${MAINCOLOR}" tcprobe -i $DEVICE -T $title -H 20 2>&1 | egrep "\[Chapter ..\] " | cut -d " " -f 4 | perl -pi -e 's/\n/,/' | perl -pi -e 's/,$//' > $RACINE/$projet/chap.list mkfifo $RACINE/$projet/tmp/vid.fifo mkfifo $RACINE/$projet/vfile.fifo mkfifo $RACINE/$projet/movie.fifo i=1 while [ $i -le $nbaudio ]; do mkfifo $RACINE/$projet/tmp/aud$i.fifo mkfifo $RACINE/$projet/oafile$i.fifo i=$(($i+1)) done case $nbaudio in 1) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo & ;; 2) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo & ;; 3) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo $RACINE/$projet/oafile3.fifo & ;; 4) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo $RACINE/$projet/oafile3.fifo $RACINE/$projet/oafile4.fifo & ;; 5) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo $RACINE/$projet/oafile3.fifo $RACINE/$projet/oafile4.fifo $RACINE/$projet/oafile5.fifo & ;; 6) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo $RACINE/$projet/oafile3.fifo $RACINE/$projet/oafile4.fifo $RACINE/$projet/oafile5.fifo $RACINE/$projet/oafile6.fifo & ;; 7) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo $RACINE/$projet/oafile3.fifo $RACINE/$projet/oafile4.fifo $RACINE/$projet/oafile5.fifo $RACINE/$projet/oafile6.fifo $RACINE/$projet/oafile7.fifo & ;; 8) mplex -f 8 -S 0 -o $RACINE/$projet/movie.fifo $RACINE/$projet/vfile.fifo $RACINE/$projet/oafile1.fifo $RACINE/$projet/oafile2.fifo $RACINE/$projet/oafile3.fifo $RACINE/$projet/oafile4.fifo $RACINE/$projet/oafile5.fifo $RACINE/$projet/oafile6.fifo $RACINE/$projet/oafile7.fifo $RACINE/$projet/oafile8.fifo & ;; esac sleep 1 i=1 while [ $i -le $nbaudio ]; do buffer -s 64k -m 16m -i $RACINE/$projet/tmp/aud$i.fifo | tcextract -t vob -x ${typeaudio[${numaudio[i]}]} -a ${index[${numaudio[i]}]} > $RACINE/$projet/oafile$i.fifo & sleep 1 i=$(($i+1)) done if [ "$test" = "1" ]; then buffer -s 64k -m 16m -i $RACINE/$projet/tmp/vid.fifo | tcextract -t vob -x mpeg2 | tcrequant -f $req > $RACINE/$projet/vfile.fifo & else buffer -s 64k -m 16m -i $RACINE/$projet/tmp/vid.fifo | tcextract -t vob -x mpeg2 > $RACINE/$projet/vfile.fifo & fi sleep 1 case $nbaudio in 1 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 2 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 3 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 4 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 5 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 6 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/aud6.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 7 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/aud6.fifo $RACINE/$projet/tmp/aud7.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; 8 ) (tccat -i $DEVICE -T $title,-1,$angle -L | dd bs=100M) | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/aud6.fifo $RACINE/$projet/tmp/aud7.fifo $RACINE/$projet/tmp/aud8.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null & ;; esac sleep 1 cd $RACINE/$projet/ [ -e $RACINE/$projet/dvd ] && rm -rf $RACINE/$projet/dvd case $nbaudio in 1) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 2) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 3) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 4) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 5) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 6) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]},${typeaudio[${numaudio[6]}]}+${pisteaudio[${numaudio[6]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 7) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]},${typeaudio[${numaudio[6]}]}+${pisteaudio[${numaudio[6]}]},${typeaudio[${numaudio[7]}]}+${pisteaudio[${numaudio[7]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; 8) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]},${typeaudio[${numaudio[6]}]}+${pisteaudio[${numaudio[6]}]},${typeaudio[${numaudio[7]}]}+${pisteaudio[${numaudio[7]}]},${typeaudio[${numaudio[8]}]}+${pisteaudio[${numaudio[8]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.fifo ;; esac dvdauthor -T -o dvd rm -f $RACINE/$projet/tmp/*.fifo 2>/dev/null rm -f $RACINE/$projet/*.fifo 2>/dev/null # image iso if [ "$iso" = "ok" ]; then echo echo -e "${TABLECOLOR}++++++++CREATION IMAGE ISO++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo -e "${MAINCOLOR}" mkisofs -dvd-video -udf -o $RACINE/$projet/dvd.iso $RACINE/$projet/dvd [ "$stocke" = "notok" ] && rm -rf $RACINE/$projet/dvd/ echo -e "${HEADCOLOR}Vous pouvez maintenant graver $RACINE/$projet/dvd.iso.${MAINCOLOR}" else echo echo -e "${HEADCOLOR}Vous pouvez maintenant graver $RACINE/$projet/dvd en mode dvdvideo." echo -e "Vous pouvez également tester avec xine ou mplayer :" echo -e "xine dvd://$RACINE/$projet/dvd/ ou mplayer -dvd-device $RACINE/$projet/dvd/ dvd://${MAINCOLOR}" fi t2=`date +'%s'` nbhrs=`bc < $RACINE/$projet/oafile$i.ac3 & i=$(($i+1)) done if [ "$test" = "1" ]; then tcextract -i $RACINE/$projet/tmp/vid.fifo -t vob -x mpeg2 | tcrequant -f $req > $RACINE/$projet/vfile.m2v & else tcextract -i $RACINE/$projet/tmp/vid.fifo -t vob -x mpeg2 > $RACINE/$projet/vfile.m2v & fi case $nbaudio in 1 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 2 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 3 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 4 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 5 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 6 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/aud6.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 7 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/aud6.fifo $RACINE/$projet/tmp/aud7.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; 8 ) tccat -i $DEVICE -T $title,-1,$angle -L | tee $RACINE/$projet/tmp/aud1.fifo $RACINE/$projet/tmp/aud2.fifo $RACINE/$projet/tmp/aud3.fifo $RACINE/$projet/tmp/aud4.fifo $RACINE/$projet/tmp/aud5.fifo $RACINE/$projet/tmp/aud6.fifo $RACINE/$projet/tmp/aud7.fifo $RACINE/$projet/tmp/aud8.fifo $RACINE/$projet/tmp/vid.fifo >/dev/null ;; esac rm -f $RACINE/$projet/tmp/*.fifo tcprobe -i $DEVICE -T $title -H 20 2>&1 | egrep "\[Chapter ..\] " | cut -d " " -f 4 | perl -pi -e 's/\n/,/' | perl -pi -e 's/,$//' > $RACINE/$projet/chap.list echo echo -e "${HEADCOLOR}Vous pouvez maintenant éjecter le DVD.${MAINCOLOR}" #fin extraction A/V/chap #remultiplexage A/V echo echo -e "${TABLECOLOR}++++++++MULTIPLEXAGE A/V++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo -e "${MAINCOLOR}" echo -e "${HEADCOLOR}Multiplexage audio/video en cours ...${MAINCOLOR}" case $nbaudio in 1) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 2) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 3) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 $RACINE/$projet/oafile3.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 4) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 $RACINE/$projet/oafile3.ac3 $RACINE/$projet/oafile4.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 5) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 $RACINE/$projet/oafile3.ac3 $RACINE/$projet/oafile4.ac3 $RACINE/$projet/oafile5.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 6) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 $RACINE/$projet/oafile3.ac3 $RACINE/$projet/oafile4.ac3 $RACINE/$projet/oafile5.ac3 $RACINE/$projet/oafile6.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 7) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 $RACINE/$projet/oafile3.ac3 $RACINE/$projet/oafile4.ac3 $RACINE/$projet/oafile5.ac3 $RACINE/$projet/oafile6.ac3 $RACINE/$projet/oafile7.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; 8) mplex -f 8 -S 0 -o $RACINE/$projet/movie.mpeg $RACINE/$projet/vfile.m2v $RACINE/$projet/oafile1.ac3 $RACINE/$projet/oafile2.ac3 $RACINE/$projet/oafile3.ac3 $RACINE/$projet/oafile4.ac3 $RACINE/$projet/oafile5.ac3 $RACINE/$projet/oafile6.ac3 $RACINE/$projet/oafile7.ac3 $RACINE/$projet/oafile8.ac3 > $RACINE/$projet/tmp/mplex.out 2>&1 ;; esac error=`cat $RACINE/$projet/tmp/mplex.out | grep ERROR` if [ "$error" != "" ]; then cat $RACINE/$projet/tmp/mplex.out | grep ERROR exit fi [ "$stocke" = "notok" ] && rm -f $RACINE/$projet/vfile.m2v [ "$stocke" = "notok" ] && rm -f $RACINE/$projet/oafile*.ac3 #fin remultiplexage A/V #création des VOB echo echo -e "${TABLECOLOR}++++++++CREATION STRUCTURE DVD++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo -e "${MAINCOLOR}" cd $RACINE/$projet/ [ -e $RACINE/$projet/dvd ] && rm -rf $RACINE/$projet/dvd case $nbaudio in 1) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 2) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 3) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 4) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 5) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 6) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]},${typeaudio[${numaudio[6]}]}+${pisteaudio[${numaudio[6]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 7) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]},${typeaudio[${numaudio[6]}]}+${pisteaudio[${numaudio[6]}]},${typeaudio[${numaudio[7]}]}+${pisteaudio[${numaudio[7]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; 8) dvdauthor -t -a ${typeaudio[${numaudio[1]}]}+${pisteaudio[${numaudio[1]}]},${typeaudio[${numaudio[2]}]}+${pisteaudio[${numaudio[2]}]},${typeaudio[${numaudio[3]}]}+${pisteaudio[${numaudio[3]}]},${typeaudio[${numaudio[4]}]}+${pisteaudio[${numaudio[4]}]},${typeaudio[${numaudio[5]}]}+${pisteaudio[${numaudio[5]}]},${typeaudio[${numaudio[6]}]}+${pisteaudio[${numaudio[6]}]},${typeaudio[${numaudio[7]}]}+${pisteaudio[${numaudio[7]}]},${typeaudio[${numaudio[8]}]}+${pisteaudio[${numaudio[8]}]} -c `cat $RACINE/$projet/chap.list` -o dvd $RACINE/$projet/movie.mpeg ;; esac dvdauthor -T -o dvd [ "$stocke" = "notok" ] && rm -f $RACINE/$projet/movie.mpeg #fin création des VOB # image iso if [ "$iso" = "ok" ]; then echo echo -e "${TABLECOLOR}++++++++CREATION IMAGE ISO++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo -e "${MAINCOLOR}" mkisofs -dvd-video -udf -o $RACINE/$projet/dvd.iso $RACINE/$projet/dvd [ "$stocke" = "notok" ] && rm -rf $RACINE/$projet/dvd/ echo -e "${HEADCOLOR}Vous pouvez maintenant graver $RACINE/$projet/dvd.iso.${MAINCOLOR}" else echo echo -e "${HEADCOLOR}Vous pouvez maintenant graver $RACINE/$projet/dvd en mode dvdvideo." echo -e "Vous pouvez également tester avec xine ou mplayer :" echo -e "xine dvd://$RACINE/$projet/dvd/ ou mplayer -dvd-device $RACINE/$projet/dvd/ dvd://${MAINCOLOR}" fi t2=`date +'%s'` nbhrs=`bc <