From b0d358494970905311cc4fd5915f8cd08de9142b Mon Sep 17 00:00:00 2001 From: Andrew Weaver Date: Thu, 1 Jun 2017 14:39:35 -0700 Subject: [PATCH 1/5] change loudness out to json --- mmfunctions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmfunctions b/mmfunctions index bf7a1153..cedfe1c5 100755 --- a/mmfunctions +++ b/mmfunctions @@ -1435,7 +1435,7 @@ _prep_volume_adjustment(){ _get_volume_adjustment "${SOURCEFILE}" fi _report -dt "Integrated loudness for $(basename "${INPUT_MOVIE}") is ${measured_I} LUFS. Reference is -24 LUFS. Will adjust by ${LOUD_ADJ} LUFS" - _add_audio_filter "loudnorm=measured_I=${measured_I}:measured_LRA=${measured_LRA}:measured_TP=${measured_TP}:measured_thresh=${measured_thresh}:offset=${target_offset}:linear=true:print_format=summary" + _add_audio_filter "loudnorm=measured_I=${measured_I}:measured_LRA=${measured_LRA}:measured_TP=${measured_TP}:measured_thresh=${measured_thresh}:offset=${target_offset}:linear=true:print_format=json" fi } From ab3367208c37bcf7ebfb711d69664ef5121fb297 Mon Sep 17 00:00:00 2001 From: Andrew Weaver Date: Thu, 1 Jun 2017 15:55:05 -0700 Subject: [PATCH 2/5] lookup loudness function --- mmfunctions | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/mmfunctions b/mmfunctions index cedfe1c5..93f45bf7 100755 --- a/mmfunctions +++ b/mmfunctions @@ -1255,11 +1255,11 @@ _get_volume_adjustment(){ target_offset=$(echo "$LOUDNESS_DATA" | grep "target_offset" | awk -F\" '{print $4}') LOUD_ADJ=$(echo "($measured_I - -24)*-1" | bc) if [[ -f "${INGESTLOG}" ]] ; then - _writeingestlog "measured_true_peak" "${measured_TP}" - _writeingestlog "r128_loudness_range" "${measured_LRA}" - _writeingestlog "r128_integrated_loudness" "${measured_I}" - _writeingestlog "measured_threshold" "${measured_thresh}" - _writeingestlog "target_offset" "${target_offset}" + _writeingestlog "input_measured_true_peak" "${measured_TP}" + _writeingestlog "input_r128_loudness_range" "${measured_LRA}" + _writeingestlog "input_r128_integrated_loudness" "${measured_I}" + _writeingestlog "input_measured_threshold" "${measured_thresh}" + _writeingestlog "input_target_offset" "${target_offset}" _writeingestlog "loudness_adjustment" "${LOUD_ADJ}" fi fi @@ -1439,6 +1439,21 @@ _prep_volume_adjustment(){ fi } +_lookup_final_loudness(){ + FFMPEGLOG=$(ls -t | head -n 1) + PARSE_FOR_LOUNDESS=$(cat "${FFMPEGLOG}") + output_i=$(echo "$LOUDNESS_DATA" | grep "output_i" | awk -F\" '{print $4}') + output_lra=$(echo "$LOUDNESS_DATA" | grep "output_lra" | awk -F\" '{print $4}') + output_tp=$(echo "$LOUDNESS_DATA" | grep "output_tp" | awk -F\" '{print $4}') + output_thresh=$(echo "$LOUDNESS_DATA" | grep "output_thresh" | awk -F\" '{print $4}') + if [[ -f "${INGESTLOG}" ]] ; then + _writeingestlog "r128_integrated_loudness" "${output_i}" + _writeingestlog "r128_loudness_range" "${output_lra}" + _writeingestlog "measured_true_peak" "${output_tp}" + _writeingestlog "measured_threshold" "${output_thresh}" + fi +} + _filter_to_middle_option(){ if [ -n "${VIDEOFILTERCHAIN}" -a -n "${AUDIOFILTERCHAIN}" ] ; then MIDDLEOPTIONS+=(-filter_complex ${VIDEOFILTERCHAIN}\;${AUDIOFILTERCHAIN}) From 5b70b7f537a6219f4f185b139a8ce6c3c58b902c Mon Sep 17 00:00:00 2001 From: Andrew Weaver Date: Thu, 1 Jun 2017 16:00:11 -0700 Subject: [PATCH 3/5] add loudness lookup --- makebroadcast | 1 + 1 file changed, 1 insertion(+) diff --git a/makebroadcast b/makebroadcast index 1b533d5e..15c85447 100755 --- a/makebroadcast +++ b/makebroadcast @@ -379,6 +379,7 @@ MIDDLEOPTIONS+=(-map "[with_slate_video]" -map "[with_slate_stereo1]" -map "[wit _run_critical_event ffmpeg "${INPUTOPTIONS[@]}" "${FFMPEGINPUT[@]}" "${MIDDLEOPTIONS[@]}" "${OUTPUT}" echo + _lookup_final_loudness _summarize_make _deliver_output "${MAKEBROADCAST_DELIVERY_EMAIL_TO}" _log -e From 11d39880e2957094b9b69054acdf5a75a05fdcb7 Mon Sep 17 00:00:00 2001 From: Andrew Weaver Date: Fri, 2 Jun 2017 12:24:35 -0700 Subject: [PATCH 4/5] fix source of loudness --- mmfunctions | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mmfunctions b/mmfunctions index 93f45bf7..322748fa 100755 --- a/mmfunctions +++ b/mmfunctions @@ -1424,11 +1424,11 @@ _prep_volume_adjustment(){ unset VOLADJ if [[ "${VOLADJUST}" != "N" ]] ; then if [[ -f "${INGESTLOG}" ]] ; then - measured_I=$(_readingestlog "r128_integrated_loudness") - measured_LRA=$(_readingestlog "r128_loudness_range") - measured_TP=$(_readingestlog "measured_true_peak") - measured_thresh=$(_readingestlog "measured_threshold") - target_offset=$(_readingestlog "target_offset") + measured_I=$(_readingestlog "input_r128_integrated_loudness") + measured_LRA=$(_readingestlog "input_r128_loudness_range") + measured_TP=$(_readingestlog "input_measured_true_peak") + measured_thresh=$(_readingestlog "input_measured_threshold") + target_offset=$(_readingestlog "input_target_offset") LOUD_ADJ=$(_readingestlog "loudness_adjustment") fi if [ ! "${LOUD_ADJ}" ] ; then @@ -1440,7 +1440,7 @@ _prep_volume_adjustment(){ } _lookup_final_loudness(){ - FFMPEGLOG=$(ls -t | head -n 1) + FFMPEGLOG=$(ls -t | grep "${0}" | head -n 1) PARSE_FOR_LOUNDESS=$(cat "${FFMPEGLOG}") output_i=$(echo "$LOUDNESS_DATA" | grep "output_i" | awk -F\" '{print $4}') output_lra=$(echo "$LOUDNESS_DATA" | grep "output_lra" | awk -F\" '{print $4}') From a8ee84455cf2ea0d8757e713c37fb419fd84470a Mon Sep 17 00:00:00 2001 From: Andrew Weaver Date: Thu, 3 Aug 2017 15:42:31 -0700 Subject: [PATCH 5/5] fix brokenness and make changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change names of loudness variables to reflect output values. Oh, and also make it so it isn’t broken. --- mmfunctions | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/mmfunctions b/mmfunctions index 322748fa..2ec01ea0 100755 --- a/mmfunctions +++ b/mmfunctions @@ -699,11 +699,11 @@ _email_delivery(){ if [[ -f "${INGESTLOG}" ]] ; then FROMLOG="Operator: $(_readingestlog "operator")\n Processing Computer: $(_readingestlog "computer_name") -Audio True Peak (dBTP): $(_readingestlog "measured_true_peak") -Integrated Loudness (LUFS): $(_readingestlog "r128_integrated_loudness") +Audio True Peak (dBTP): $(_readingestlog "output_measured_true_peak") +Integrated Loudness (LUFS): $(_readingestlog "output_r128_integrated_loudness") Loudness Adjustment (LUFS): $(_readingestlog "loudness_adjustment") -Loudness Range (LU): $(_readingestlog "r128_loudness_range") -Threshold (LUFS) : $(_readingestlog "measured_threshold") +Loudness Range (LU): $(_readingestlog "output_r128_loudness_range") +Threshold (LUFS) : $(_readingestlog "output_measured_threshold") Out of Phase Audio Ranges: $(_readingestlog "Out_of_phase_audio_ranges")" fi echo -e "Subject: [delivery] $(basename "${OUTPUT}")\n @@ -1255,11 +1255,11 @@ _get_volume_adjustment(){ target_offset=$(echo "$LOUDNESS_DATA" | grep "target_offset" | awk -F\" '{print $4}') LOUD_ADJ=$(echo "($measured_I - -24)*-1" | bc) if [[ -f "${INGESTLOG}" ]] ; then - _writeingestlog "input_measured_true_peak" "${measured_TP}" - _writeingestlog "input_r128_loudness_range" "${measured_LRA}" - _writeingestlog "input_r128_integrated_loudness" "${measured_I}" - _writeingestlog "input_measured_threshold" "${measured_thresh}" - _writeingestlog "input_target_offset" "${target_offset}" + _writeingestlog "measured_true_peak" "${measured_TP}" + _writeingestlog "r128_loudness_range" "${measured_LRA}" + _writeingestlog "r128_integrated_loudness" "${measured_I}" + _writeingestlog "measured_threshold" "${measured_thresh}" + _writeingestlog "target_offset" "${target_offset}" _writeingestlog "loudness_adjustment" "${LOUD_ADJ}" fi fi @@ -1424,11 +1424,11 @@ _prep_volume_adjustment(){ unset VOLADJ if [[ "${VOLADJUST}" != "N" ]] ; then if [[ -f "${INGESTLOG}" ]] ; then - measured_I=$(_readingestlog "input_r128_integrated_loudness") - measured_LRA=$(_readingestlog "input_r128_loudness_range") - measured_TP=$(_readingestlog "input_measured_true_peak") - measured_thresh=$(_readingestlog "input_measured_threshold") - target_offset=$(_readingestlog "input_target_offset") + measured_I=$(_readingestlog "r128_integrated_loudness") + measured_LRA=$(_readingestlog "r128_loudness_range") + measured_TP=$(_readingestlog "measured_true_peak") + measured_thresh=$(_readingestlog "measured_threshold") + target_offset=$(_readingestlog "target_offset") LOUD_ADJ=$(_readingestlog "loudness_adjustment") fi if [ ! "${LOUD_ADJ}" ] ; then @@ -1440,17 +1440,17 @@ _prep_volume_adjustment(){ } _lookup_final_loudness(){ - FFMPEGLOG=$(ls -t | grep "${0}" | head -n 1) - PARSE_FOR_LOUNDESS=$(cat "${FFMPEGLOG}") - output_i=$(echo "$LOUDNESS_DATA" | grep "output_i" | awk -F\" '{print $4}') - output_lra=$(echo "$LOUDNESS_DATA" | grep "output_lra" | awk -F\" '{print $4}') - output_tp=$(echo "$LOUDNESS_DATA" | grep "output_tp" | awk -F\" '{print $4}') - output_thresh=$(echo "$LOUDNESS_DATA" | grep "output_thresh" | awk -F\" '{print $4}') + FFMPEGLOG=$(ls -t "${LOGDIR}" | grep "${0}" | head -n 1) + PARSE_FOR_LOUDNESS=$(cat "${LOGDIR}/${FFMPEGLOG}") + output_i=$(echo "${PARSE_FOR_LOUDNESS}" | grep "output_i" | awk -F\" '{print $4}') + output_lra=$(echo "${PARSE_FOR_LOUDNESS}" | grep "output_lra" | awk -F\" '{print $4}') + output_tp=$(echo "${PARSE_FOR_LOUDNESS}" | grep "output_tp" | awk -F\" '{print $4}') + output_thresh=$(echo "${PARSE_FOR_LOUDNESS}" | grep "output_thresh" | awk -F\" '{print $4}') if [[ -f "${INGESTLOG}" ]] ; then - _writeingestlog "r128_integrated_loudness" "${output_i}" - _writeingestlog "r128_loudness_range" "${output_lra}" - _writeingestlog "measured_true_peak" "${output_tp}" - _writeingestlog "measured_threshold" "${output_thresh}" + _writeingestlog "output_r128_integrated_loudness" "${output_i}" + _writeingestlog "output_r128_loudness_range" "${output_lra}" + _writeingestlog "output_measured_true_peak" "${output_tp}" + _writeingestlog "output_measured_threshold" "${output_thresh}" fi }