changed "first pass analyzing output" to include a progress
This commit is contained in:
@@ -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
|
# 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.
|
# The stats are printed to stderr, so we must use subprocess.run directly to capture it.
|
||||||
print(" - Pass 1: Analyzing...")
|
print(" - Pass 1: Analyzing...")
|
||||||
|
# Add -stats to show progress. -v error hides verbose info but keeps stats and the loudnorm JSON.
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["ffmpeg", "-v", "info", "-i", str(temp_extracted), "-af", "loudnorm=I=-18:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
|
["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)
|
capture_output=True, text=True, check=True, encoding='utf-8')
|
||||||
|
|
||||||
# Find the start of the JSON block in stderr and parse it.
|
# Find the start of the JSON block in stderr and parse it.
|
||||||
# This is more robust than slicing the last N lines.
|
# This is more robust than slicing the last N lines.
|
||||||
|
|||||||
@@ -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
|
# 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.
|
# The stats are printed to stderr, so we must use subprocess.run directly to capture it.
|
||||||
print(" - Pass 1: Analyzing...")
|
print(" - Pass 1: Analyzing...")
|
||||||
|
# Add -stats to show progress. -v error hides verbose info but keeps stats and the loudnorm JSON.
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["ffmpeg", "-v", "info", "-i", str(temp_extracted), "-af", "loudnorm=I=-18:LRA=7:tp=-1:print_format=json", "-f", "null", "-"],
|
["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)
|
capture_output=True, text=True, check=True, encoding='utf-8')
|
||||||
|
|
||||||
# Find the start of the JSON block in stderr and parse it.
|
# Find the start of the JSON block in stderr and parse it.
|
||||||
# This is more robust than slicing the last N lines.
|
# This is more robust than slicing the last N lines.
|
||||||
|
|||||||
Reference in New Issue
Block a user