I have the following working code in first.py
import os os.system('cat python_better_than_java.wav')
which I can execute this way
python first.py | ffmpeg -y -f wav -i pipe:0 -f mp3 - >hi.mp3
it works.
I want to do this with pythonic, so I edited first.py :
import sys with open('python_better_than_java.wav', 'rb') as content_file: content = content_file.read() sys.stdout.write(content)
and executed it using:
python first.py | ffmpeg -y -f wav -i pipe:0 -f mp3 - >hi.mp3
but then it raises the following error:
pipe:0: Invalid data found when processing input
How can i play cat in python?
source share