====== mehrere Videos zusammenzufügen mit Mplayer ====== vmerge #!/bin/bash #part of the Mutils by Paul Hänsch #to be ditributed under the terms of the GPL v.2 and any later version frontend=Xdialog #if more than one file is opened at once in konqueror, one instance of the script #will be opened for every file - this if-else stuff passes all files to the first #instance of the script (using the fifo "/tmp/encode.list") if [ -e /tmp/encode.list ]; then echo \#$1 >>/tmp/encode.list exit 0 else mkfifo /tmp/encode.list echo \#$1 >>/tmp/encode.list & sleep 3 files=`cat /tmp/encode.list` rm /tmp/encode.list #I cannot control in which order the files are given, that's why I sort them files=`echo $files |sed '/#/s//\n#/g'|sort` #The filenames must be translated into a format which mplayer understands #I also try to translate the damn kde-media:-protocol path but that's very #simple yet and may not work on your system files=`echo $files |sed '/media:\/hdc/s//\/mnt\/cdrom/g;/-/s//\\-/g;/ #/s//#/g;/ /s//\\ /g'` dialog=`mktemp -t diagXXXX` ofile=~/ while [ -d $ofile ]; do $frontend --fselect "$ofile" 15 70 2>$dialog if [ $? == 1 ];then rm -f $dialog exit 0 fi ofile=`cat $dialog` done part=`mktemp -t partXXXX` cpipe=`mktemp -t mpipeXXXX` rm -f $cpipe mkfifo $cpipe cnt=2 while [ ! -z `echo $files |cut -d "#" -f$cnt` ]; do if [ $frontend == dialog ]; then $frontend --infobox "Attaching\nPart: `expr $cnt - 1`" 0 0 else $frontend --no-buttons --infobox "Attaching\nPart: `expr $cnt - 1`" 0 0 5000 & fi cat $cpipe >>$part & cat "`echo $files |cut -d "#" -f$cnt`" >$cpipe cnt=`expr $cnt + 1` done if [ $frontend == dialog ]; then $frontend --infobox "Finalizing $ofile" 0 0 else $frontend --no-buttons --infobox "Finalizing $ofile" 0 0 5000 & fi mencoder $part -forceidx -o "$ofile" -oac copy -ovc copy 2>>/dev/null >>/dev/null rm -f $part rm -f $cpipe rm -f $dialog if [ $? -eq 0 ]; then $frontend --ok-label " Dankeschön " --msgbox " Videos erfolgreich zusammengefügt. " 6 53 else $frontend --ok-label " Tja! " --msgbox "Irgendwas ging schief.\n - sorry -" 0 0 fi fi