diff --git a/MkvOpusEnc.py b/MkvOpusEnc.py index 144fc64..ff34ee5 100644 --- a/MkvOpusEnc.py +++ b/MkvOpusEnc.py @@ -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. diff --git a/av1_opus_encoder.py b/av1_opus_encoder.py index 102d5f0..6c59756 100644 --- a/av1_opus_encoder.py +++ b/av1_opus_encoder.py @@ -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.