Skip to content

Commit

Permalink
Merge pull request #656 from deuteronomy-works/master
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
amoh-godwin authored Apr 28, 2023
2 parents 8cffd6b + deeeb97 commit b2a1590
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
7 changes: 6 additions & 1 deletion local_t_est.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ def ov():
else:
assert True

ov()

#fps = ff.get_fps("H:/CS/practice/python/pyffmpeg subproces/vid.mp4")
#print(fps)

ov()
# tt()
31 changes: 19 additions & 12 deletions pyffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -264,17 +267,21 @@ 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}")

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:
Expand Down
2 changes: 1 addition & 1 deletion pyffmpeg/pseudo_ffprobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b2a1590

Please sign in to comment.