我是一名音乐人,兼职做一些编程,所以能力有限,请见谅。
有时我需要多个音频文件的 LUFS 级别,最快的方法(对我来说......)是使用 ffmpeg 来计算,因为它可以在几秒钟内离线播放一个文件,而不必全部播放在 DAW 中进行读出。
这是我想出的脚本:
#!/bin/zsh
TempDirectory="~/Desktop/TEMP"
TempRAW="$TempDirectory/ffmpeg_LUFS_output_RAW.txt"
OutputCSV="$TempDirectory/ffmpeg_LUFS_output.csv"
for CurrentFile in "$@"
do
echo "File: "$(/usr/bin/basename "$CurrentFile") >>"$TempRAW"
/opt/homebrew/bin/ffmpeg -i "$CurrentFile" -hide_banner -af ebur128=framelog=verbose -f null - 2>>"$TempRAW"
done
# The next part extracts the info from the raw ffmpeg output file
# The output from ffmpeg is 55 lines
# Line 1: File: LSK Adore v18 [Dreamy] MIX ALL Stereo.wav
# ... snip ...
# Line 47: Integrated loudness:
# Line 48: I: -32.2 …Run Code Online (Sandbox Code Playgroud)