Rename volume adjustment scripts
This commit is contained in:
parent
bb26b8ceff
commit
27a08fb402
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Use this to get a report on the video audio volume. You can use this info
|
||||
# manually normalize or increase/decrease a video's volume using the
|
||||
# change-video-volume script, supplying it the volume delta you want. Typically
|
||||
# you use the delta from the analysis report this script provides, e.g. if the
|
||||
# max_volume is -5 db then you would call change-video-volume with a value of
|
||||
# 5. I find that the two pass normalize-video-audio script works better than
|
||||
# this approach...but it will take longer to run!
|
||||
# Use this to get a volume report from a video or audio file. You can use this
|
||||
# info manually normalize or increase/decrease the volume using the
|
||||
# change-volume script, supplying it the volume delta you want. Typically you
|
||||
# use the delta from the analysis report this script provides, e.g. if the
|
||||
# max_volume is -5 db then you would call change-volume with a value of 5. I
|
||||
# find that the two pass normalize-audio script works better than this
|
||||
# approach...but it will take longer to run!
|
||||
#
|
||||
# Inspired by https://superuser.com/a/323127 and https://superuser.com/a/1312885
|
||||
|
||||
|
@ -34,7 +34,7 @@ else
|
|||
fi
|
||||
|
||||
if [[ $1 == "" ]]; then
|
||||
printf "${BOLD}${RED}Usage: analyze-video-volume <video filename>${NORMAL}\n"
|
||||
printf "${BOLD}${RED}Usage: analyze-volume <video or audio filename>${NORMAL}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -48,5 +48,5 @@ printf "\n${BOLD}Running: $cmd\n\n${NORMAL}"
|
|||
eval $cmd
|
||||
|
||||
printf "\n${GREEN}${BOLD}Done analyzing audio in $filename\n${NORMAL}"
|
||||
printf "\n${YELLOW}${BOLD}Look at the reported max_volume value. If != 0 then call the change-video-volume script, passing it the filename, an output name and the delta to bring the volume to 0.\ne.g. if the max_volume is -5 db, then you would pass 5.${NORMAL}\n\n"
|
||||
printf "\n${YELLOW}${BOLD}Look at the reported max_volume value. If != 0 then call the change-volume script, passing it the filename, an output name and the delta to bring the volume to 0.\ne.g. if the max_volume is -5 db, then you would pass 5.${NORMAL}\n\n"
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Re-encodes the audio, modify the volume based on the supplied db delta. The
|
||||
# video is copied as-is. If you want to bring the max_volume to 0 db then call
|
||||
# analyze-video-volume prior to this and pass a delta based on the reported
|
||||
# max_volume.
|
||||
# Re-encodes the audio, modify the volume based on the supplied db delta. If
|
||||
# given a video file then the file is copied as-is. If you want to bring the
|
||||
# max_volume to 0 db then call analyze-volume prior to this and pass a delta
|
||||
# based on the reported max_volume.
|
||||
#
|
||||
# Inspired by https://superuser.com/a/323127 and https://superuser.com/a/1312885
|
||||
|
||||
|
@ -31,7 +31,7 @@ else
|
|||
fi
|
||||
|
||||
if [[ $1 == "" ]]; then
|
||||
printf "${BOLD}${RED}Usage: change-video-volume <filename> <output name> <volume delta in db>${NORMAL}\n"
|
||||
printf "${BOLD}${RED}Usage: change-volume <video or audio filename> <output name> <volume delta in db>${NORMAL}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Use this to normalize the audio of a video using the average loudness, or RMS-based normalization. It does a pretty good job!
|
||||
# If you want to modify the volume yourself then checkout the analyze-video-volume and change-video-volume scripts.
|
||||
# Use this to normalize the volume of a video or audio file using the average loudness, or RMS-based normalization. It does a pretty good job!
|
||||
# If you want to modify the volume manually then checkout the analyze-volume and change-volume scripts.
|
||||
#
|
||||
# This does not re-encode the video.
|
||||
# This does not re-encode video when given a video file.
|
||||
#
|
||||
# Inspired by https://superuser.com/a/323127 and https://superuser.com/a/1312885
|
||||
|
||||
|
@ -31,7 +31,7 @@ else
|
|||
fi
|
||||
|
||||
if [[ $1 == "" ]]; then
|
||||
printf "${BOLD}${RED}Usage: normalize-video-volume <filename> <optional output name>${NORMAL}\n"
|
||||
printf "${BOLD}${RED}Usage: normalize-volume <video or audio filename> <optional output name>${NORMAL}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -57,9 +57,9 @@ temp_file="/tmp/_audio_info_$RANDOM"
|
|||
# 1st pass:
|
||||
cmd="ffmpeg -i \"$filename.$extension\" -pass 1 -filter:a loudnorm=print_format=json -vn -sn -dn -f null /dev/null 2>&1 | sed -n '/{/,/}/p' > $temp_file"
|
||||
printf "\n${BOLD}Running 1st pass:\n$cmd\n\n${NORMAL}"
|
||||
eval $cmd
|
||||
eval "$cmd"
|
||||
|
||||
printf "\n${BOLD}${GREEN}Done.\n\n${NORMAL}"
|
||||
printf "${BOLD}${GREEN}Done.\n\n${NORMAL}"
|
||||
|
||||
ii=`grep \"input_i\" $temp_file | cut -d: -f2 | tr -cd [:digit:].-`
|
||||
itp=`grep \"input_tp\" $temp_file | cut -d: -f2 | tr -cd [:digit:].-`
|
||||
|
@ -70,7 +70,7 @@ to=`grep \"target_offset\" $temp_file | cut -d: -f2 | tr -cd [:digit:].-`
|
|||
# 2nd pass:
|
||||
cmd="ffmpeg -y -stats -loglevel level+error -i \"$filename.$extension\" -c:v copy -pass 2 -filter:a loudnorm=linear=true:I=-16:LRA=11:tp=-1.5:measured_I=$ii:measured_LRA=$ilra:measured_tp=$itp:measured_thresh=$it:offset=$to:print_format=summary -map 0 \"$output\""
|
||||
printf "${BOLD}Re-encoding audio:\n$cmd\n\n${NORMAL}"
|
||||
eval $cmd
|
||||
eval "$cmd"
|
||||
|
||||
printf "\n${GREEN}${BOLD}Done normalizing volume in $filename.$extension | output: $output${NORMAL}\n"
|
||||
rm $temp_file
|
Loading…
Reference in New Issue
Block a user