mkvcut
#!/bin/bash # in=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml"|grep -o -P ".*?"|cut -d '>' -f2|cut -d '<' -f1; ).mkv; in=$1; out="/home/peter/mkvcut/"$(basename "$in"); fd=$(stat -c %y "$in"); vlc -q "$in" & PID=$!; stack=''; add='+'; t0=0; t1=99999; parts="parts:${stack//+/$add}$add${t0}s-${t1}s"; echoParts () { parts="parts:${stack//+/$add}$add${t0}s-${t1}s"; echo $parts; } while : do read -s -n 1 key; case $key in '*') if [ "$add" == "+" ]; then add=''; echo "split into differnt files ..."; else add='+'; echo "add parts into same file ..."; fi; echoParts; ;; -) t0="${stack##*+}"; t0=${t0%%s*}; t0=${t0:='0'}; t1="${stack##*-}"; t1=${t1%%s*}; t1=${t1:='99999'}; stack="${stack%+*}"; echoParts; ;; +) stack="${stack}+${t0}s-${t1}s,"; t1='99999'; t0=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml"|grep -Po '(?<=).*(?=)';); echoParts; ;; ,) echoParts; ;; q) kill $PID; dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=pl_stop"); break ;; .) mkvmerge -o "$out" --split ${parts} "$in"; touch -d "$fd" "$out"; beep ;; g) mkvmerge -o "$out" --split ${parts} -a ger "$in"; touch -d "$fd" "$out"; beep ;; e) mkvmerge -o "$out" --split ${parts} -a eng "$in"; touch -d "$fd" "$out"; beep ;; /) mkvmerge -o "$out" --split ${parts} -a 1 "$in"; touch -d "$fd" "$out"; beep ;; 0) echo mkvmerge -o \"$out\" --split ${parts} -a 1 \"$in\"; echo ; echo ffmpeg -ss $t0 -t $(expr $t1 - $t0) -i \"$in\" -y \"$out\"; echo touch -d \"$fd\" \"$out\" ;; :) ffmpeg -ss $t0 -t $(expr $t1 - $t0) -i "$in" -y "$out" ; echo touch -d "$fd" "$out"; beep ;; 7) t0=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml"|grep -Po '(?<=).*(?=)';); echoParts; ;; 8) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=+60") ;; 9) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=+300") ;; 4) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=-15") ;; 5) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=-3") ;; 6) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=+15") ;; 1) t1=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml"|grep -Po '(?<=).*(?=)';); echoParts; ;; 2) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=-60") ;; 3) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=seek&val=-300") ;; *) dummy=$(wget -qO- --user='' --password=vlc "http://localhost:8080/requests/status.xml?command=pl_pause") ;; esac done
Zuschneiden von aufgenommenen mkv-Filmen(3.6kB)
Download