diff --git a/local_t_est.py b/local_t_est.py index e77105c..0f0b6f9 100644 --- a/local_t_est.py +++ b/local_t_est.py @@ -39,4 +39,9 @@ def ov(): else: assert True -ov() \ No newline at end of file + +#fps = ff.get_fps("H:/CS/practice/python/pyffmpeg subproces/vid.mp4") +#print(fps) + +ov() +# tt() diff --git a/pyffmpeg/__init__.py b/pyffmpeg/__init__.py index 8541899..f8cc9fc 100644 --- a/pyffmpeg/__init__.py +++ b/pyffmpeg/__init__.py @@ -139,14 +139,17 @@ def convert(self, input_file, output_file): self._in_duration = float(d) self.monitor(out) - outP = Popen( - options, shell=SHELL, stdin=PIPE, - stdout=PIPE, stderr=PIPE - ) - self._ffmpeg_instances['convert'] = outP - stderr = str(outP.stderr.read(), 'utf-8') - - print(stderr) + try: + outP = Popen( + options, shell=SHELL, stdin=PIPE, + stdout=PIPE, stderr=PIPE + ) + self._ffmpeg_instances['convert'] = outP + stderr = str(outP.stderr.read(), 'utf-8') + + print(stderr) + except: + self.quit() if 'Output #0' not in stderr: lines = stderr.splitlines() @@ -264,7 +267,7 @@ def options(self, opts): self.logger.info(f'Using {_ffmpeg_file} as ffmpeg file') options = " ".join([_ffmpeg_file, options]) - self.logger.inof(f"Options is: {options} as at now") + self.logger.info(f"Options is: {options} as at now") if self.enable_log: self.logger.info(f"Shell: {SHELL}") @@ -272,9 +275,13 @@ def options(self, opts): if not SHELL: options = shlex.split(options, posix=False) - out = Popen(options, shell=SHELL, stdin=PIPE, stdout=PIPE, stderr=PIPE) - self._ffmpeg_instances['options'] = out - stderr = str(out.stderr.read(), 'utf-8') + try: + out = Popen(options, shell=SHELL, stdin=PIPE, stdout=PIPE, stderr=PIPE) + self._ffmpeg_instances['options'] = out + stderr = str(out.stderr.read(), 'utf-8') + except: + self.quit() + if stderr and 'Output #0' not in stderr: lines = stderr.splitlines() if len(lines) > 0: diff --git a/pyffmpeg/pseudo_ffprobe.py b/pyffmpeg/pseudo_ffprobe.py index 8a93997..c2513d2 100644 --- a/pyffmpeg/pseudo_ffprobe.py +++ b/pyffmpeg/pseudo_ffprobe.py @@ -283,7 +283,7 @@ def probe(self): shell=SHELL) # break the operation - sleep(0.02) + sleep(0.5) stdout, _ = subP.communicate(input='q') self._extract_all(stdout)