mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Better error handling for ffmpeg.get_all_formats()
This commit is contained in:
@@ -33,11 +33,15 @@ class FFMPEG(BaseRenderEngine):
|
||||
return encoders
|
||||
|
||||
def get_all_formats(self):
|
||||
try:
|
||||
formats_raw = subprocess.check_output([self.renderer_path(), '-formats'], stderr=subprocess.DEVNULL,
|
||||
timeout=SUBPROCESS_TIMEOUT).decode('utf-8')
|
||||
pattern = '(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)'
|
||||
pattern = '(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)\r'
|
||||
all_formats = [m.groupdict() for m in re.finditer(pattern, formats_raw)]
|
||||
return all_formats
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting all formats: {e}")
|
||||
return []
|
||||
|
||||
def extension_for_format(self, ffmpeg_format):
|
||||
# Extract the common extension using regex
|
||||
|
||||
Reference in New Issue
Block a user