Browse Your Downloaded Videos on Internet: PHP based video webserver that exposes a local path containing videos to the internet.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
940 B
29 lines
940 B
10 years ago
|
#! /bin/bash -ex
|
||
|
|
||
|
SRC=${1:-.}
|
||
|
DST=${2:-/var/tmp/spielfilme}
|
||
|
|
||
|
FORMATS="ogg webm mp4"
|
||
|
declare -A FLAGS
|
||
|
FLAGS["ogg"]="-c:v libtheora -c:a libvorbis -q:v 6 -q:a 5"
|
||
|
FLAGS["webm"]="-vcodec libvpx -acodec libvorbis -f webm -aq 5 -ac 2 -qmax 25 -threads 2"
|
||
|
FLAGS["mp4"]="-vcodec libx264 -acodec aac -strict experimental -crf 19"
|
||
|
|
||
|
for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do
|
||
|
for format in ${FORMATS}; do
|
||
|
t="${f/$SRC/$DST/${format}}"
|
||
|
t="${t%.*}.${f}"
|
||
|
if test -s "${t}"; then
|
||
10 years ago
|
continue; # ignore if file exists and is not empty
|
||
10 years ago
|
fi
|
||
10 years ago
|
if test -e "$t"; then
|
||
|
rm "$t"; # remove existing empty file
|
||
10 years ago
|
fi
|
||
|
test -d "${t%/*}" || mkdir -p "${t%/*}"
|
||
10 years ago
|
if ( ! avconv -i "$f" ${FLAGS[$f]} -filter:v yadif "$t"
|
||
|
|| ! test -s "${t}") && test -e "$t"; then
|
||
|
rm "$t"; # remove file if conversion failed
|
||
10 years ago
|
fi
|
||
|
done
|
||
|
done
|