handle UTF-8 encoding, error fix

This commit is contained in:
2026-03-16 17:13:41 -06:00
parent baf17ec369
commit 6588cb7957
5 changed files with 603 additions and 5 deletions
+4 -2
View File
@@ -82,7 +82,7 @@ def get_file_info(input_file):
'-of', 'json',
input_file
]
result = subprocess.run(cmd, capture_output=True, text=True)
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', errors='replace')
return json.loads(result.stdout)
def get_audio_labels(input_file):
@@ -94,7 +94,7 @@ def get_audio_labels(input_file):
'-of', 'json',
input_file
]
result = subprocess.run(cmd, capture_output=True, text=True)
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', errors='replace')
info = json.loads(result.stdout)
labels = []
for stream in info.get('streams', []):
@@ -232,6 +232,8 @@ def encode_dvr(input_file, output_dir, gpu):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
encoding='utf-8',
errors='replace',
bufsize=1
)