all repos — dotfiles @ 87fb6579cde259fcc7426ed8b663eb8c0cd4c8af

linux dotfiles

bin/misc/split_and_encrypt/split-scenes.sh (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
#!/usr/bin/bash
# Usage : ./split-scenes.sh <file> <slicemins>
# <slicmins> is the length of each slice in mins

videofile="$1"
slicemins="$2"
mins=$(echo "ceil(`ffprobe -loglevel error -show_entries\
    format=duration -of csv $videofile | cut -d ',' -f2` / 60)" |\
    calc -p)

fldr=$(echo "$1" | cut -d '.' -f1)
[ -d "$fldr" ] || mkdir "$fldr"
for value in $(seq 0 $slicemins $(expr $mins - 1))
do
    echo $(expr $value / 2) / $(expr $(expr $mins - 1) / 2)
    ffmpeg -loglevel quiet -i "$videofile" -ss 00:$value:00\
        -t 00:$slicemins:00 -c copy\
        $fldr/$fldr`expr $value / 2`.mp4
done