0

I am trying to make a little script in python to stream from a gopro to PC

from selenium import webdriver
from subprocess import call
import subprocess, sys
import time
import urllib
import urllib2

pid = subprocess.Popen([sys.executable, "Sel.py"])
call(["ffplay", "-fflags", "nobuffer", "udp://:8554"])
driver = webdriver.Firefox(executable_path='/usr/bin/geckodriver')

while True:
    time.sleep(10)
    driver.get("http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart") 

I am not really familiar with python and my objective is to open ffplay with those options and then execute the remaining part of the program (reloading a page every 10 seconds). Now when i run the script it continuously make that system call. Is there a way to detach the execution of ffplay from the execution of the python code?

2 Answers2

0

'Call' will always wait for the process it is calling to complete. I think you need to use Popen for both operations as it will return control to your code. There is a short tutorial at https://pythonspot.com/python-subprocess/

Paula Thomas
  • 1,152
  • 1
  • 8
  • 13
0

Don't repeatedly call the stream http command, use a keep alive magic command instead: http://github.com/konradit/goprostream

konraditurbe
  • 165
  • 9