changed "first pass analyzing output" to include a progress

This commit is contained in:
2025-10-25 10:44:24 +02:00
parent 46fa0896ae
commit cb75402539
2 changed files with 6 additions and 4 deletions

View File

@@ -83,9 +83,10 @@ def convert_audio_track(stream_index, channels, temp_dir, source_file, should_do
# First pass: Analyze the audio to get loudnorm stats
# The stats are printed to stderr, so we must use subprocess.run directly to capture it.
print(" - Pass 1: Analyzing...")
# Add -stats to show progress. -v error hides verbose info but keeps stats and the loudnorm JSON.
result = subprocess.run(
["ffmpeg", "-v", "info", "-i", str(temp_extracted), "-af", "loudnorm=I=-18:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
capture_output=True, text=True, check=True)
["ffmpeg", "-v", "error", "-stats", "-i", str(temp_extracted), "-af", "loudnorm=I=-18:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
capture_output=True, text=True, check=True, encoding='utf-8')
# Find the start of the JSON block in stderr and parse it.
# This is more robust than slicing the last N lines.

View File

@@ -71,9 +71,10 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
# First pass: Analyze the audio to get loudnorm stats
# The stats are printed to stderr, so we must use subprocess.run directly to capture it.
print(" - Pass 1: Analyzing...")
# Add -stats to show progress. -v error hides verbose info but keeps stats and the loudnorm JSON.
result = subprocess.run(
["ffmpeg", "-v", "info", "-i", str(temp_extracted), "-af", "loudnorm=I=-18:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
capture_output=True, text=True, check=True)
["ffmpeg", "-v", "error", "-stats", "-i", str(temp_extracted), "-af", "loudnorm=I=-18:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
capture_output=True, text=True, check=True, encoding='utf-8')
# Find the start of the JSON block in stderr and parse it.
# This is more robust than slicing the last N lines.