From 70298cc4fbf3c8d9baebb3f5cdec504d353958e8 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Mon, 25 Nov 2024 13:24:46 -0500 Subject: [PATCH 1/4] remove a condition since it's the same as the next one --- makederiv | 6 ------ 1 file changed, 6 deletions(-) diff --git a/makederiv b/makederiv index c242519..0ecda59 100755 --- a/makederiv +++ b/makederiv @@ -455,12 +455,6 @@ while [[ "${@}" != "" ]] ; do _add_video_filter "setdar=16/9" _add_video_filter "fps=fps=ntsc" MIDDLEOPTIONS+=("${MIDDLEOPTIONSXDCAM[@]}") - elif [ $(echo "scale=3 ; ${DARRATIO} > (16/9)" | bc -l) = 1 ] ; then - _add_video_filter "scale=size=hd1080:interl=1:force_original_aspect_ratio=decrease" - _add_video_filter "pad=1920:1080:(ow-iw)/2:(oh-ih)/2" - _add_video_filter "setdar=16/9" - _add_video_filter "fps=fps=ntsc" - MIDDLEOPTIONS+=("${MIDDLEOPTIONSXDCAM[@]}") elif [ $(echo "scale=3 ; $DARRATIO > (3/2)" | bc -l) = 1 -o "${ADDSLATE}" = "Y" ] ; then _add_video_filter "scale=size=hd1080:interl=1:force_original_aspect_ratio=decrease" _add_video_filter "pad=1920:1080:(ow-iw)/2:(oh-ih)/2" From c05175bf916a5e3f469bcbb3c28be84748105752 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 17 Dec 2024 10:53:57 -0500 Subject: [PATCH 2/4] always uprez to HD if bigger than SD --- makederiv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makederiv b/makederiv index 0ecda59..14f7973 100755 --- a/makederiv +++ b/makederiv @@ -455,7 +455,7 @@ while [[ "${@}" != "" ]] ; do _add_video_filter "setdar=16/9" _add_video_filter "fps=fps=ntsc" MIDDLEOPTIONS+=("${MIDDLEOPTIONSXDCAM[@]}") - elif [ $(echo "scale=3 ; $DARRATIO > (3/2)" | bc -l) = 1 -o "${ADDSLATE}" = "Y" ] ; then + elif [ $(echo "scale=3 ; $DARRATIO > (3/2)" | bc -l) = 1 -o "${HEIGHT}" -gt "512" -o "${ADDSLATE}" = "Y" ] ; then _add_video_filter "scale=size=hd1080:interl=1:force_original_aspect_ratio=decrease" _add_video_filter "pad=1920:1080:(ow-iw)/2:(oh-ih)/2" _add_video_filter "setdar=16/9" From 844693ac42029c167daa51afd06749b32deba499 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 17 Dec 2024 10:55:09 -0500 Subject: [PATCH 3/4] add volume normalization for multi part objects --- mmfunctions | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mmfunctions b/mmfunctions index bf9921f..0ba5fa1 100755 --- a/mmfunctions +++ b/mmfunctions @@ -1038,7 +1038,6 @@ _find_input (){ FFMPEGINPUT+=(-i) FFMPEGINPUT+=("${SOURCEFILE}") else - VOLADJUST="N" INPUTOPTIONS+=(-f concat) INPUTOPTIONS+=(-safe 0) FFCONCATFILE="$(_maketemp).ffconcat" @@ -1116,9 +1115,6 @@ _find_input (){ if [[ -n "${LISTCHAPTERS}" ]]; then _report -d "Found this chapter list:" _report -d "${LISTCHAPTERS}" - unset FFMPEGINPUT - INPUTOPTIONS+=(-f concat) - INPUTOPTIONS+=(-safe 0) FFCONCATFILE=$(_maketemp) while read chapter ; do STARTTIME=$(echo "${chapter}" | cut -d- -f1) @@ -1149,6 +1145,9 @@ _find_input (){ echo "inpoint ${STARTTIME}" >> "${FFCONCATFILE}" echo "outpoint ${ENDTIME}" >> "${FFCONCATFILE}" done < <(echo "${LISTCHAPTERS}") + unset FFMPEGINPUT + FFMPEGINPUT+=(-f concat) + FFMPEGINPUT+=(-safe 0) FFMPEGINPUT+=(-i) FFMPEGINPUT+=("${FFCONCATFILE}") fi @@ -1272,7 +1271,7 @@ _get_audio_mapping(){ LOUD_ADJ=$(_readingestlog "loudness_adjustment") fi if [ ! "${LOUD_ADJ}" ] ; then - _get_volume_adjustment "${SOURCEFILE}" + _get_volume_adjustment "${FFMPEGINPUT[@]}" fi if [[ "${measured_I}" == "inf" ]] || [[ "${measured_I}" == "-inf" ]] ; then VOLADJUST="N" @@ -1435,7 +1434,7 @@ _get_volume_adjustment(){ LOUD_ADJ="" LOUDNESS_OPT_START="" LOUDNESS_OPT_END="" - INPUT_MOVIE="${1}" + VOL_FFMPEG_INPUT="${*}" if [[ -n "${INTIME}" ]] ; then _report -dt "Loudness reading will start at intime (${INTIME})." LOUDNESS_OPT_START="-ss ${INTIME}" @@ -1444,8 +1443,8 @@ _get_volume_adjustment(){ _report -dt "Loudness reading will end at outtime (${OUTTIME})." LOUDNESS_OPT_END="-to ${OUTTIME}" fi - _report -dt "Getting loudness data for $(basename "${INPUT_MOVIE}") ..." - LOUDNESS_DATA=$(ffmpeg -nostdin ${LOUDNESS_OPT_START} -i "${1}" ${LOUDNESS_OPT_END} -vn -filter_complex "${AUDIOFILTERCHAIN},loudnorm=print_format=json" -f null - 2>&1) + _report -dt "Getting loudness data for '${VOL_FFMPEG_INPUT[*]}' ..." + LOUDNESS_DATA=$(ffmpeg -nostdin ${LOUDNESS_OPT_START} ${VOL_FFMPEG_INPUT[*]} ${LOUDNESS_OPT_END} -vn -filter_complex "${AUDIOFILTERCHAIN},loudnorm=print_format=json" -f null - 2>&1) VOLUME_EXIT_CODE="${?}" if [ "${VOLUME_EXIT_CODE}" -ne 0 ] ; then _report -wt "Volume analysis for ${INPUT_MOVIE} exited with ${VOLUME_EXIT_CODE}." From a838979e6bfc46b897a254174de0d378bbccc7ca Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Tue, 17 Dec 2024 12:18:36 -0500 Subject: [PATCH 4/4] use crop_filter value from capture.log if any must be in form of crop_filter: crop=3820:3000:210:54 --- makederiv | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/makederiv b/makederiv index 14f7973..149d561 100755 --- a/makederiv +++ b/makederiv @@ -311,15 +311,21 @@ while [[ "${@}" != "" ]] ; do if [[ "${CODEC_TAG_STRING}" == "mjp2" ]] ; then INPUTOPTIONS+=(-vcodec libopenjpeg) fi + CROPADJ=$(_readingestlog "crop_filter") + if [[ -n "${CROPADJ}" ]] ; then + _report -dt "A directive to crop the input object with ${CROPADJ} was found in the capture.log. Will apply." + fi + if [[ "${CROPDETECT}" = "Y" && -z "${CROPADJ}" ]] ; then + _get_cropdetection "${SOURCEFILE}" + fi + if [[ -n "${CROPADJ}" ]] ; then + _add_video_filter "${CROPADJ}" + WIDTH=$(echo "${CROPADJ}" | cut -d= -f2 | cut -d: -f1) + HEIGHT=$(echo "${CROPADJ}" | cut -d= -f2 | cut -d: -f2) + DAR="(${WIDTH}/${HEIGHT})*${SAR}" + fi if [[ "${OUTPUT_TYPE}" == "broadcast" ]] ; then _get_broadcastduration "${SOURCEFILE}" - if [ "${CROPDETECT}" = "Y" ] ; then - _get_cropdetection "${SOURCEFILE}" - _add_video_filter "${CROPADJ}" - WIDTH=$(echo "${CROPADJ}" | cut -d= -f2 | cut -d: -f1) - HEIGHT=$(echo "${CROPADJ}" | cut -d= -f2 | cut -d: -f2) - DAR="(${WIDTH}/${HEIGHT})*${SAR}" - fi # set options for zeroing timecode if input is MXF if [[ "${FORMAT}" == "mxf" ]] ; then metadata_option="-metadata"