From bda2cde08195d33cb7fc4ee6ff1199a633ac3c45 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Fri, 18 Mar 2022 15:15:20 -0400 Subject: [PATCH 1/5] remove redundant option --- makederiv | 1 - 1 file changed, 1 deletion(-) diff --git a/makederiv b/makederiv index 88c94753..ece5b2ff 100755 --- a/makederiv +++ b/makederiv @@ -397,7 +397,6 @@ while [[ "${@}" != "" ]] ; do MIDDLEOPTIONSIMX+=(-aspect 4:3) MIDDLEOPTIONSIMX+=(-qmax 12) MIDDLEOPTIONSIMX+=(-g 1) - MIDDLEOPTIONSIMX+=(-top 1) MIDDLEOPTIONSIMX+=(-b:v 30M) MIDDLEOPTIONSIMX+=(-maxrate:v 30M) MIDDLEOPTIONSIMX+=(-minrate:v 30M) From 1e76c7759c1e8f2828d5375efda085f6dcde9f59 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 21 Feb 2023 15:02:51 -0500 Subject: [PATCH 2/5] remove unneeded lines --- makegifsummary | 2 -- 1 file changed, 2 deletions(-) diff --git a/makegifsummary b/makegifsummary index 03bbe239..5c37b0df 100755 --- a/makegifsummary +++ b/makegifsummary @@ -70,7 +70,6 @@ while [ "${*}" != "" ] ; do _add_video_filter "scale=320:320/($DAR)" _add_video_filter "thumbnail=4" MIDDLEOPTIONS+=(-frames:v 1) - echo "DAR $DAR" _filter_to_middle_option _set_up_output _log -b @@ -85,7 +84,6 @@ while [ "${*}" != "" ] ; do if [ "${CONCATSOURCE}" != "" ] ; then FFMPEGINPUT="${CONCATSOURCE}" fi - _run_critical_event ffmpeg -nostdin -y ${INPUTOPTIONS[@]} -v warning -ss "$START" "${FFMPEGINPUT[@]}" "${MIDDLEOPTIONS[@]}" "${TEMPIMAGES}.${IMAGENUMBER}.png" done PALETTE="$(_maketemp)" From 79bff5b829d687eec98fa370ec7d0e3b10fb836c Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 21 Feb 2023 15:03:05 -0500 Subject: [PATCH 3/5] bracketing --- makegifsummary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makegifsummary b/makegifsummary index 5c37b0df..09224aa9 100755 --- a/makegifsummary +++ b/makegifsummary @@ -67,7 +67,7 @@ while [ "${*}" != "" ] ; do if [[ "${CODEC_TAG_STRING}" == "mjp2" ]] ; then INPUTOPTIONS+=(-vcodec libopenjpeg) fi - _add_video_filter "scale=320:320/($DAR)" + _add_video_filter "scale=320:320/(${DAR})" _add_video_filter "thumbnail=4" MIDDLEOPTIONS+=(-frames:v 1) _filter_to_middle_option From 2458ee0c26896b35c20582ee267a8c6c3647e280 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 21 Feb 2023 15:03:16 -0500 Subject: [PATCH 4/5] adjust ffmpeg options to avoid warnings --- makegifsummary | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/makegifsummary b/makegifsummary index 09224aa9..052f5985 100755 --- a/makegifsummary +++ b/makegifsummary @@ -62,14 +62,13 @@ while [ "${*}" != "" ] ; do # encoding options _get_codectagstring "${SOURCEFILE}" _get_dar "${SOURCEFILE}" - INPUTOPTIONS+=(-vsync 0) INPUTOPTIONS+=(-nostdin) if [[ "${CODEC_TAG_STRING}" == "mjp2" ]] ; then INPUTOPTIONS+=(-vcodec libopenjpeg) fi _add_video_filter "scale=320:320/(${DAR})" _add_video_filter "thumbnail=4" - MIDDLEOPTIONS+=(-frames:v 1) + MIDDLEOPTIONS+=(-update 1 -frames:v 1) _filter_to_middle_option _set_up_output _log -b From c6b544ea92acc33d3a940c2181040514b7346c7f Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 21 Feb 2023 15:04:17 -0500 Subject: [PATCH 5/5] support output as directory or as file --- makegifsummary | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/makegifsummary b/makegifsummary index 052f5985..b6fa46a2 100755 --- a/makegifsummary +++ b/makegifsummary @@ -17,7 +17,7 @@ _usage(){ echo "Dependencies: ${DEPENDENCIES[@]}" echo "Usage: $(basename ${0}) [ -d /path/to/deliver/to/ ] fileorpackage1 [ fileorpackage2 ...]" echo " -d directory ( directory to deliver the resulting file to )" - echo " -o directory ( directory to write the resulting file to )" + echo " -o file or directory ( directory or filepath to write the resulting file to )" echo " -n (dry-run mode, show the commands that would be run but don't do anything)" echo " -h display this help" echo @@ -33,7 +33,7 @@ while getopts ":d:e:E:o:nh" OPT ; do d) DELIVERDIR="${OPTARG}" && _check_deliverdir ;; e) EMAILADDRESS_DELIVERY="${OPTARG}" && check_emailaddress "${EMAILADDRESS_DELIVERY}" ;; E) EMAILADDRESS_OUTCOME="${OPTARG}" && check_emailaddress "${EMAILADDRESS_OUTCOME}" ;; - o) OUTPUTDIR_FORCED="${OPTARG}" && _check_outputdir_forced ;; + o) OUTPUT_FORCED="${OPTARG}" ;; n) DRYRUN=true;; h) _usage ;; *) echo "bad option -${OPTARG}" ; _usage ;; @@ -45,18 +45,32 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do INPUT="${1}" shift - if [ -z "${OUTPUTDIR_FORCED}" ] ; then + _unset_variables + _find_input "${INPUT}" + + MEDIAID=$(basename "${INPUT}" | cut -d. -f1) + + if [[ -z "${OUTPUT_FORCED}" ]] ; then [ -d "${INPUT}" ] && { OUTPUTDIR="${INPUT}/objects/access/gif" && LOGDIR="${INPUT}/metadata/logs" ;}; [ -f "${INPUT}" ] && { OUTPUTDIR=$(dirname "${INPUT}")"/access/gif" && LOGDIR="$(dirname "${INPUT}")/access/logs" ;}; [ ! "$OUTPUTDIR" ] && { OUTPUTDIR="${INPUT}/objects/access/gif" && LOGDIR="${INPUT}/metadata/logs" ;}; + _set_up_output else - OUTPUTDIR="${OUTPUTDIR_FORCED}" - LOGDIR="${OUTPUTDIR_FORCED}/logs" + if [[ -d "${OUTPUT_FORCED}" ]] ; then + OUTPUTDIR="${OUTPUT_FORCED}" + LOGDIR="${OUTPUT_FORCED}/logs" + OUTPUTDIR_FORCED="${OUTPUT_FORCED}" + _check_outputdir_forced + else + OUTPUTDIR="$(dirname "${OUTPUT_FORCED}")" + OUTPUT="${OUTPUT_FORCED}" + if [ -s "${OUTPUT}" ] ; then + _report -wt "WARNING ${OUTPUT} already exists, skipping transcode" + continue + fi + fi fi - _unset_variables - _find_input "${INPUT}" - MEDIAID=$(basename "${INPUT}" | cut -d. -f1) _report_to_db # encoding options @@ -70,7 +84,6 @@ while [ "${*}" != "" ] ; do _add_video_filter "thumbnail=4" MIDDLEOPTIONS+=(-update 1 -frames:v 1) _filter_to_middle_option - _set_up_output _log -b DURATION=$(ffprobe 2>/dev/null "${SOURCEFILE}" -show_format | grep duration | cut -d= -f2) _run_critical mkdir -p "${OUTPUTDIR}"