Permalink
Browse files

Attempting to correct FFMPEG subprocess management problem which only…

… seems to occur on XP windows version (.kill not found).
  • Loading branch information...
1 parent 1fd92e3 commit a577248396cc5e9766a82bf497516677754aeb39 @metadirective metadirective committed Jan 30, 2014
Showing with 13 additions and 6 deletions.
  1. +13 −6 MediaCours.py
View
@@ -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

0 comments on commit a577248

Please sign in to comment.