Skip to content

Commit

Permalink
Attempting to correct FFMPEG subprocess management problem which only…
Browse files Browse the repository at this point in the history
… seems to occur on XP windows version (.kill not found).
  • Loading branch information
FrancoisSchnell committed Jan 30, 2014
1 parent 1fd92e3 commit a577248
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions MediaCours.py
Expand Up @@ -836,18 +836,25 @@ def recordStop():
serverAnswer= page.read() # Read/Check the result
print serverAnswer

def stopFFMPEG():
global pffmpeg
try:
pffmpeg.stdin.write("q")
pffmpeg.kill()
except:
print "WARNING: Can't stop properly FFMPEG subprocess, attempting forced taskkill, media may not be directly readable..."
writeInLogs("- WARNING: Can't stop properly FFMPEG subprocess, attempting forced taskkill, media may lack header as a result and may not be directly readable... "+ str(datetime.datetime.now())+"\n")
os.popen("taskkill /F /IM ffmpeg.exe")

lastEvent=time.time()
if usage=="audio" and audioEncoder==True:
pffmpeg.stdin.write("q")
pffmpeg.kill()
stopFFMPEG()
if usage=="video" and videoEncoder=="ffmpeg":
pffmpeg.stdin.write("q")
pffmpeg.kill()
stopFFMPEG()
if usage=="video" and videoEncoder=="flash":
flv.stop(FMLEpid)
if usage=="screencast":
pffmpeg.stdin.write("q")
pffmpeg.kill()
stopFFMPEG()
if live==True:
liveFeed.SetValue(False) #unchecks live checkbox for next user
#DEPRECATED VIDEO FORMATS AND ENCODERS
Expand Down

0 comments on commit a577248

Please sign in to comment.