minor fixes

This commit is contained in:
David 2015-08-31 13:29:43 -03:00
parent 1fdbba0fed
commit c35d96286c

35
dve
View File

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash -e
ENC="ffmpeg" ENC="ffmpeg"
ENCPATH="" ENCPATH=""
OPTS="-c:v libx265 -preset fast -x265-params crf=24 -c:a libvorbis -aq 5 -c:s copy" OPTS="-c:v libx264 -preset fast -g 250 -qp 22 -c:a libfdk_aac -ac 1"
SUFFIX="_new.mkv" SUFFIX="_new.mkv"
SERVERS="localhost" SERVERS=":,192.168.1.14"
LEN=60 LEN=60
OUTDIR="$HOME/.dve" OUTDIR="/tmp/.dve" #ram
VERBOSE="error" VERBOSE="error"
function usage() { function usage() {
@ -35,17 +35,8 @@ function checkpaths() {
exit 1 exit 1
fi fi
done done
# check as absolute path first #FIXME: should not force absolute path on all servers
if [ -x "$ENC" ]; then ENCPATH="ffmpeg"
ENCPATH="$ENC"
else
# then check for something in $PATH
ENCPATH="`which $ENC`"
if ! [ -x "$ENCPATH" ]; then
echo "$ENC not found."
exit 1
fi
fi
} }
checkpaths checkpaths
@ -93,14 +84,22 @@ if ! mkdir -p ${OUTDIR}; then
fi fi
echo "Creating chunks to encode" echo "Creating chunks to encode"
$ENCPATH -i "$1" -map 0 -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig" if [[ "$1" == *".AVI" ]]; then
$ENCPATH -fflags +genpts -i "$1" -map 0 -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig"
else
$ENCPATH -i "$1" -map 0 -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig"
fi
if [ $? -ne 0 ]; then
echo "Error creating chunks "
exit
fi
CWD=`pwd` CWD=`pwd`
cd "$OUTDIR" cd "$OUTDIR"
echo "Running parallel encoding jobs" echo "Running parallel encoding jobs"
PAR_OPTS="--gnu -j 1 -S ${SERVERS} --eta --retries 2 --nice 10" PAR_OPTS="--no-notice --gnu -j 1 -S ${SERVERS} --eta --retries 2 --nice 10"
#PAR_OPTS="$PAR_OPTS --workdir ... --trc {.}.enc"
PAR_OPTS="$PAR_OPTS --workdir ... --transfer --return {.}.enc" PAR_OPTS="$PAR_OPTS --workdir ... --transfer --return {.}.enc"
ENC_OPTS="-y -v ${VERBOSE} -i {} ${OPTS} -f matroska {.}.enc" ENC_OPTS="-y -v ${VERBOSE} -i {} ${OPTS} -f matroska {.}.enc"