feat: adjust loudnorm integrated loudness and true peak targets in ffmpeg filter.
This commit is contained in:
@@ -72,7 +72,7 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
|
|||||||
# The stats are printed to stderr, so we must use subprocess.run directly to capture it.
|
# The stats are printed to stderr, so we must use subprocess.run directly to capture it.
|
||||||
print(" - Pass 1: Analyzing...")
|
print(" - Pass 1: Analyzing...")
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["ffmpeg", "-v", "info", "-i", str(temp_extracted), "-af", "loudnorm=I=-24:LRA=7:tp=-2:print_format=json", "-f", "null", "-"],
|
["ffmpeg", "-v", "info", "-i", str(temp_extracted), "-af", "loudnorm=I=-23:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
|
||||||
capture_output=True, text=True, check=True)
|
capture_output=True, text=True, check=True)
|
||||||
|
|
||||||
# Find the start of the JSON block in stderr and parse it.
|
# Find the start of the JSON block in stderr and parse it.
|
||||||
@@ -100,7 +100,7 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
|
|||||||
print(" - Pass 2: Applying normalization...")
|
print(" - Pass 2: Applying normalization...")
|
||||||
run_cmd([
|
run_cmd([
|
||||||
"ffmpeg", "-v", "quiet", "-stats", "-y", "-i", str(temp_extracted), "-af",
|
"ffmpeg", "-v", "quiet", "-stats", "-y", "-i", str(temp_extracted), "-af",
|
||||||
f"loudnorm=I=-24:LRA=7:tp=-2:measured_i={stats['input_i']}:measured_lra={stats['input_lra']}:measured_tp={stats['input_tp']}:measured_thresh={stats['input_thresh']}:offset={stats['target_offset']}",
|
f"loudnorm=I=-23:LRA=7:tp=-1:measured_i={stats['input_i']}:measured_lra={stats['input_lra']}:measured_tp={stats['input_tp']}:measured_thresh={stats['input_thresh']}:offset={stats['target_offset']}",
|
||||||
"-c:a", "flac", str(temp_normalized)
|
"-c:a", "flac", str(temp_normalized)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user