From 540eab999a3a92a65d1a332fd11733d7b90adc26 Mon Sep 17 00:00:00 2001 From: Tessa Nordgren Date: Mon, 29 Jul 2019 11:10:52 -0700 Subject: [PATCH] minor changes --- dve | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dve b/dve index ba6ae09..88bae15 100755 --- a/dve +++ b/dve @@ -5,7 +5,7 @@ set -e # defaults for all configuration values ENC="ffmpeg" CRF=24 -OPTS="-map 0 -c:v libx265 -pix_fmt yuv420p10le -preset fast -x265-params crf=${CRF}:aq-mode=3 -c:a libvorbis -aq 5" +OPTS="-map 0 -c:v libx265 -pix_fmt yuv420p10le -preset fast -x265-params crf=${CRF}:aq-mode=3 -c:a libopus -b:a 128000" # This is to split out and copy attachment streams, like subtitles # and fonts, so they only get copied once. DATA_OPTS="-map 0 -c:s copy -c:t copy -c:d copy -vn -an" @@ -22,7 +22,7 @@ fi function on_finish() { echo "Cleaning up temporary working files" cd "$CWD" - rm -rf "${OUTDIR}"/ +# rm -rf "${OUTDIR}"/ echo "Finished cleaning" } @@ -69,7 +69,7 @@ while getopts “hl:t:o:s:q:v” OPTION; do ;; q) CRF="$OPTARG" - OPTS="-map 0 -c:v libx265 -pix_fmt yuv420p10le -preset fast -x265-params crf=${CRF}:aq-mode=3 -c:a libvorbis -aq 5" + OPTS="-map 0 -c:v libx265 -pix_fmt yuv420p10le -preset fast -x265-params crf=${CRF}:aq-mode=3 -c:a libopus -b:a 128000" ;; o) OPTS="$OPTARG" @@ -109,6 +109,7 @@ if [[ "$1" == *".AVI" || "$1" == *".avi" ]]; then else $ENC -i "$1" -map 0:a -map 0:v -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig" fi + echo "Copying file metadata" DATA_IN="-i data.enc -map 1" ${ENC} -y -v ${VERBOSE} -i "$1" ${DATA_OPTS} -f matroska "${OUTDIR}/data.enc" || @@ -121,7 +122,14 @@ PAR_OPTS="--no-notice --gnu -j 1 -S ${SERVERS} --eta --retries 2 --nice 10" PAR_OPTS="${PAR_OPTS} --workdir ... --transfer --return {.}.enc" ENC_OPTS="-y -v ${VERBOSE} -i {} ${OPTS} -f matroska {.}.enc" -parallel ${PAR_OPTS} ${ENC} ${ENC_OPTS} ::: chunk-*.orig +# do local encode if single chunk, else parallel encode +numchunks="$(ls -1q chunk-*.orig | wc -l)" +if [ "$numchunks" -eq "1" ]; then + ENC_OPTS="-y -v ${VERBOSE} -i chunk-*.orig ${OPTS} -f matroska chunk-0000.enc" + ${ENC} ${ENC_OPTS} +else + parallel ${PAR_OPTS} ${ENC} ${ENC_OPTS} ::: chunk-*.orig +fi echo "Combining chunks into final video file" echo "ffconcat version 1.0" > concat.txt