minor changes

This commit is contained in:
Tessa Nordgren 2019-07-29 11:10:52 -07:00
parent 9f1ca516b1
commit 540eab999a

14
dve
View File

@ -5,7 +5,7 @@ set -e
# defaults for all configuration values # defaults for all configuration values
ENC="ffmpeg" ENC="ffmpeg"
CRF=24 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 # This is to split out and copy attachment streams, like subtitles
# and fonts, so they only get copied once. # and fonts, so they only get copied once.
DATA_OPTS="-map 0 -c:s copy -c:t copy -c:d copy -vn -an" DATA_OPTS="-map 0 -c:s copy -c:t copy -c:d copy -vn -an"
@ -22,7 +22,7 @@ fi
function on_finish() { function on_finish() {
echo "Cleaning up temporary working files" echo "Cleaning up temporary working files"
cd "$CWD" cd "$CWD"
rm -rf "${OUTDIR}"/ # rm -rf "${OUTDIR}"/
echo "Finished cleaning" echo "Finished cleaning"
} }
@ -69,7 +69,7 @@ while getopts “hl:t:o:s:q:v” OPTION; do
;; ;;
q) q)
CRF="$OPTARG" 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) o)
OPTS="$OPTARG" OPTS="$OPTARG"
@ -109,6 +109,7 @@ if [[ "$1" == *".AVI" || "$1" == *".avi" ]]; then
else 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" $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 fi
echo "Copying file metadata" echo "Copying file metadata"
DATA_IN="-i data.enc -map 1" DATA_IN="-i data.enc -map 1"
${ENC} -y -v ${VERBOSE} -i "$1" ${DATA_OPTS} -f matroska "${OUTDIR}/data.enc" || ${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" 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"
# 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 parallel ${PAR_OPTS} ${ENC} ${ENC_OPTS} ::: chunk-*.orig
fi
echo "Combining chunks into final video file" echo "Combining chunks into final video file"
echo "ffconcat version 1.0" > concat.txt echo "ffconcat version 1.0" > concat.txt