handle UTF-8 encoding, error fix
This commit is contained in:
@@ -88,7 +88,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):
|
||||
@@ -100,7 +100,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', []):
|
||||
@@ -229,6 +229,8 @@ def encode_dvr(input_file, output_dir, gpu, bitrate):
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True,
|
||||
encoding='utf-8',
|
||||
errors='replace',
|
||||
bufsize=1
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user