Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
input_parameters = dict2Args(input_params)
#pre-assign default encoder parameters (if not assigned by user).
if "-vcodec" not in output_params:
output_params["-vcodec"] = "libx264"
if output_params["-vcodec"] in ["libx264", "libx265"]:
if "-crf" in output_params:
pass
else:
output_params["-crf"] = "18"
if "-preset" in output_params:
pass
else:
output_params["-preset"] = "fast"
#convert output parameters to list
output_parameters = dict2Args(output_params)
#format command
cmd = [self.ffmpeg , "-y"] + ["-f", "rawvideo", "-vcodec", "rawvideo"] + input_parameters + ["-i", "-"] + output_parameters + [self.out_file]
#assign value to class variable
self.cmd += " ".join(cmd)
# Launch the FFmpeg process
if self.logging:
print(self.cmd)
# In debugging mode
self.process = sp.Popen(cmd, stdin=sp.PIPE, stdout=sp.PIPE, stderr=None)
else:
# In silent mode
self.process = sp.Popen(cmd, stdin=sp.PIPE, stdout=self.DEVNULL, stderr=sp.STDOUT)
def startFFmpeg_Process(self, input_params, output_params):
"""
Start FFmpeg process
:param input_params (dict): Input parameters
:param output_params (dict): Output parameters
"""
#convert input parameters to list
input_parameters = dict2Args(input_params)
#pre-assign default encoder parameters (if not assigned by user).
if "-vcodec" not in output_params:
output_params["-vcodec"] = "libx264"
if output_params["-vcodec"] in ["libx264", "libx265"]:
if "-crf" in output_params:
pass
else:
output_params["-crf"] = "18"
if "-preset" in output_params:
pass
else:
output_params["-preset"] = "fast"
#convert output parameters to list
output_parameters = dict2Args(output_params)
#format command