Skip to content Skip to sidebar Skip to footer

Python Capture Subprocess Output

I'm working on a tensorflow project that learns from an audio stream. I'm using the subprocess module (with Popen) and FFMPEG to read in the audio data from an mp3. I successfully

Solution 1:

The Popen object has communicate not stdout:

pipe.communicate(str(88200*4))

To also capture stderr through stdout:

 pipe = sp.Popen(command, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE)
 raw_audio, _  = pipe.communicate(str(88200*4).encode())
 print(raw_audio)

Post a Comment for "Python Capture Subprocess Output"