Próbuję napisać gui dla FFMPEG
. Używam podprocesów pythonów do utworzenia procesu ffmpeg dla każdej wybranej konwersji. Działa to dobrze, ale ja też lubię sposób, aby uzyskać postęp konwersji, czy to nie udało, czy nie itd. Pomyślałem, co mogłem zrobić to poprzez dostęp do stdout procesu jest tak:Podproces FFMPEG i Pythons
Wywołanie subprocess.Popen()
# Convert - Calls FFMPEG with current settings. (in a seperate
# thread.)
def convert(self):
# Check if options are valid
if self.input == "" or self.output == "":
return False
# Make the command string
ffmpegString = self.makeString()
# Try to open with these settings
try:
self.ffmpeg = subprocess.Popen(ffmpegString, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except OSError:
self.error.append("OSError: ")
except ValueError:
self.error.append("ValueError: Couldn't call FFMPEG with these parameters")
# Convert process should be running now.
i czytanie stdout
:
convert = Convert()
convert.input = "test.ogv"
convert.output = "test.mp4"
convert.output_size = (0, 0)
convert.convert()
while 1:
print convert.ffmpeg.stdout.readline()
działa to jednak, status FFmpeg nie pokazuje. Zakładam, że ma to coś wspólnego z tym, co ffmpeg odświeża. Czy jest jakiś sposób, aby uzyskać do niego dostęp?
Oba twoje łącza są martwe, napraw je. – slhck