From ba9b9ccc4cc689d4b0d4fb5e18346f46c3728cd8 Mon Sep 17 00:00:00 2001 From: WORD559 Date: Thu, 5 Jul 2018 20:35:30 +0100 Subject: [PATCH] Cleaned up the output by discarding ffmpeg's output --- PPM.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PPM.py b/PPM.py index 9e2f255..ad5a58c 100755 --- a/PPM.py +++ b/PPM.py @@ -864,7 +864,8 @@ if __name__ == '__main__': export_command.pop(8) else: has_bgm = True - subprocess.call(export_command) + with open(os.devnull) as null: + subprocess.call(export_command,stdout=null,stderr=null) print "Done!" # These are the ffmpeg commands I need for each sound effect @@ -882,7 +883,7 @@ if __name__ == '__main__': ## else: # Read in the sound effect usage data - print "Reading in sound effect usage..." + print "Reading sound effect usage..." with open("{path}/sounds/SFX usage.txt".format(path=tempdir),"r") as sfx_usage_file: sfx_usage = sfx_usage_file.read().split("\n") print "Done!" @@ -894,11 +895,13 @@ if __name__ == '__main__': sfx = line.split(":")[1].strip() if line.strip() != "" else "" if sfx != "": # If a sound effect must be played... length = frame*fps - print "Adding "+sfx+" {length} seconds in.".format(length=length) + print "Adding "+sfx+" at {length} seconds into the video.".format(length=length) # ...run each command in series with the correct arguments - subprocess.call([i.format(path=tempdir,sfx=sfx,length=length) for i in silence_command]) - subprocess.call([i.format(path=tempdir,sfx=sfx) for i in SFX_command]) - subprocess.call([i.format(path=tempdir) for i in merge_command]) + with open(os.devnull,"w") as null: + subprocess.call([i.format(path=tempdir,sfx=sfx,length=length) for i in silence_command],stdout=null,stderr=null) + subprocess.call([i.format(path=tempdir,sfx=sfx) for i in SFX_command],stdout=null,stderr=null) + subprocess.call([i.format(path=tempdir) for i in merge_command],stdout=null,stderr=null) + print "Done!" time.sleep(sleep_time) # optional sleep -- in case you want to slow things down for HDD strain or reliability or something # Remove the temp dir and all files in it