0

i'm working with omxplayer in Python. Is there a way to filter the elapsed time shown by executing omxplayer with the '-s' parameter and save it as a string?

I'm avoiding using omxplayer-wrapper because this string i'm trying to get will actually going to be inside another program that is already executing omxplayer, and i would prefere to "recycle" the process instead of modifying the whole script just to use the wrapper. (if still want to know, i'm working with a modified version of this: https://github.com/jehutting/omxplayer-pir)

For example, i've got this piece of code that let me execute omxplayer from console with ./ command and print the result, but have no clue to achieve what i want to do.

#!/usr/bin/env python

from subprocess import Popen

videoFile = 'home/pi/filename.mov'

execute = Popen(['omxplayer', '-s', videoFile])
  • 1
    Is it printing output continuously as it's playing, or do you just need the subprocess to finish and its output to then be returned? Either way, look at the FAQs in [the Stack Overflow `subprocess` tag info page.](/tags/subprocess/info) – tripleee Dec 06 '20 at 09:09
  • Both would be usefull because either displaying the data contiuously or in a "static" way, first i must get it inside a variable, am i right? Maybe the first case (the contiuous one) would be the ideal because of it's possible applications inside the script. Thanks for the link, i'll check it out right away! – Julian Otto Dec 06 '20 at 09:18

0 Answers0