Last active
August 7, 2019 12:34
-
-
Save diewland/d8c6c1a9a5c0b9a60fe237ce62c296a2 to your computer and use it in GitHub Desktop.
subprocess in pydub.AudioSegment.from_file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/jiaaro/pydub/blob/master/pydub/audio_segment.py | |
if filename: | |
conversion_command += ["-i", filename] | |
stdin_parameter = None # <------------------------------------------- Look at this line !! | |
stdin_data = None | |
else: | |
if cls.converter == 'ffmpeg': | |
conversion_command += ["-read_ahead_limit", str(read_ahead_limit), | |
"-i", "cache:pipe:0"] | |
else: | |
conversion_command += ["-i", "-"] | |
stdin_parameter = subprocess.PIPE | |
stdin_data = file.read() | |
... | |
p = subprocess.Popen(conversion_command, stdin=stdin_parameter, # <------- Yeah! stdin is None | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
p_out, p_err = p.communicate(input=stdin_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment