mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 13:46:10 +00:00
@@ -24,7 +24,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
return FFMPEGUI.get_options(self)
|
||||
|
||||
def supported_extensions(self):
|
||||
help_text = (subprocess.check_output([self.renderer_path(), '-h', 'full'], stderr=subprocess.STDOUT,
|
||||
help_text = (subprocess.check_output([self.engine_path(), '-h', 'full'], stderr=subprocess.STDOUT,
|
||||
creationflags=_creationflags).decode('utf-8'))
|
||||
found = re.findall(r'extensions that .* is allowed to access \(default "(.*)"', help_text)
|
||||
found_extensions = set()
|
||||
@@ -35,7 +35,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
def version(self):
|
||||
version = None
|
||||
try:
|
||||
ver_out = subprocess.check_output([self.renderer_path(), '-version'], timeout=SUBPROCESS_TIMEOUT,
|
||||
ver_out = subprocess.check_output([self.engine_path(), '-version'], timeout=SUBPROCESS_TIMEOUT,
|
||||
creationflags=_creationflags).decode('utf-8')
|
||||
match = re.match(r".*version\s*([\w.*]+)\W*", ver_out)
|
||||
if match:
|
||||
@@ -82,7 +82,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
return None
|
||||
|
||||
def get_encoders(self):
|
||||
raw_stdout = subprocess.check_output([self.renderer_path(), '-encoders'], stderr=subprocess.DEVNULL,
|
||||
raw_stdout = subprocess.check_output([self.engine_path(), '-encoders'], stderr=subprocess.DEVNULL,
|
||||
timeout=SUBPROCESS_TIMEOUT, creationflags=_creationflags).decode('utf-8')
|
||||
pattern = r'(?P<type>[VASFXBD.]{6})\s+(?P<name>\S{2,})\s+(?P<description>.*)'
|
||||
encoders = [m.groupdict() for m in re.finditer(pattern, raw_stdout)]
|
||||
@@ -94,7 +94,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
|
||||
def get_all_formats(self):
|
||||
try:
|
||||
formats_raw = subprocess.check_output([self.renderer_path(), '-formats'], stderr=subprocess.DEVNULL,
|
||||
formats_raw = subprocess.check_output([self.engine_path(), '-formats'], stderr=subprocess.DEVNULL,
|
||||
timeout=SUBPROCESS_TIMEOUT,
|
||||
creationflags=_creationflags).decode('utf-8')
|
||||
pattern = r'(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)'
|
||||
@@ -108,7 +108,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
# Extract the common extension using regex
|
||||
muxer_flag = 'muxer' if 'E' in ffmpeg_format['type'] else 'demuxer'
|
||||
format_detail_raw = subprocess.check_output(
|
||||
[self.renderer_path(), '-hide_banner', '-h', f"{muxer_flag}={ffmpeg_format['id']}"],
|
||||
[self.engine_path(), '-hide_banner', '-h', f"{muxer_flag}={ffmpeg_format['id']}"],
|
||||
creationflags=_creationflags).decode('utf-8')
|
||||
pattern = r"Common extensions: (\w+)"
|
||||
common_extensions = re.findall(pattern, format_detail_raw)
|
||||
@@ -121,7 +121,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
return [x['id'] for x in self.get_all_formats() if 'E' in x['type'].upper()]
|
||||
|
||||
def get_frame_count(self, path_to_file):
|
||||
raw_stdout = subprocess.check_output([self.renderer_path(), '-i', path_to_file, '-map', '0:v:0', '-c', 'copy',
|
||||
raw_stdout = subprocess.check_output([self.engine_path(), '-i', path_to_file, '-map', '0:v:0', '-c', 'copy',
|
||||
'-f', 'null', '-'], stderr=subprocess.STDOUT,
|
||||
timeout=SUBPROCESS_TIMEOUT, creationflags=_creationflags).decode('utf-8')
|
||||
match = re.findall(r'frame=\s*(\d+)', raw_stdout)
|
||||
@@ -131,7 +131,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
return -1
|
||||
|
||||
def get_arguments(self):
|
||||
help_text = (subprocess.check_output([self.renderer_path(), '-h', 'long'], stderr=subprocess.STDOUT,
|
||||
help_text = (subprocess.check_output([self.engine_path(), '-h', 'long'], stderr=subprocess.STDOUT,
|
||||
creationflags=_creationflags).decode('utf-8'))
|
||||
lines = help_text.splitlines()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user