The following code calls mplayer to play local audio files. Can the data in the filepath
file be obtained through p
?
p=subprocess.Popen(["mplayer",filepath],shell=False,stdin=subprocess.PIPE,stderr=subprocess.PIPE)
filepath
It may also be a url, where the data is needed, but you don’t want to access this address again.
-------Supplement-------
I followed up when trying to debug, and wanted to see if the file content was obtained before calling mplayer, but in the subprocess module, the single Step debugging does not work, so I want to know if the subprocess module has obtained the data before calling mplayer. If so, it can obtain the data.
subprocess
只是一个调用命令的库, 它的stdin, stdout
It only stores the results of the command output. If your command has results, text or other output during execution, you can get it, but if you want to parse this audio file, it probably won't work. , or you need other parsing methods to explain, or open the file directly, maybe you can get what you wantIt seems that what you want to get is the metadata of the audio data. If it is actually MP3, you can try the ID3 library.