add misc scripts
Prithu Goswami prithugoswami524@gmail.com
Tue, 29 Oct 2019 13:29:00 +0530
4 files changed,
63 insertions(+),
0 deletions(-)
A
bin/misc/split_and_encrypt/decrypt.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/bash + +passes=$(cat "$1") +prefix="$2" +path="$3" +i=0 + +[ -n "$path" ] && cd $3 +mkdir "$2mp4" +for a in $passes +do + echo $a > tmp_pas + cat tmp_pas + gpg --passphrase-file tmp_pas --batch -o "$2mp4/$prefix$i.mp4" -d "$prefix$i.g" + i=$(expr $i + 1) +done;
A
bin/misc/split_and_encrypt/encrypt.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/bash + +passes=$(cat "$1") +prefix="$2" +path="$3" +i=0 + +[ -n "$path" ] && cd $3 +mkdir "$2.g" +for a in $passes +do + echo $a > tmp_pas + cat tmp_pas + gpg --passphrase-file tmp_pas --batch -o "$2.g/$prefix$i.g" -c "$prefix$i.mp4" + i=$(expr $i + 1) +done; +rm tmp_pas
A
bin/misc/split_and_encrypt/genhash.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/bash + +# generate random md5 hashes using /dev/urandom + +for value in $(seq 0 $(expr $1 - 1)) +do + md5sum=$(dd status=none if=/dev/urandom bs=16 count=2 | md5sum |\ + cut -d ' ' -f 1 ) + # just using 16 chars of the hash + echo ${md5sum::16} +done
A
bin/misc/split_and_encrypt/split-scenes.sh
@@ -0,0 +1,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