postlund / pyatv

A client library for Apple TV and AirPlay devices
https://pyatv.dev
MIT License
827 stars 87 forks source link

ffmpeg live audiostrem #2380

Closed xXxNIKIxXx closed 1 month ago

xXxNIKIxXx commented 1 month ago

What do you need help with?

I have a live stream from ffmpeg. I'm streaming my microphone as the source. Then, I'm converting the stream into an MP3 format and attempting to play it using the stream_file function. However, I encounter an error stating: mediafile.FileTypeError: 'stream': not in a recognized format, even though my stream is in MP3 format. Somehow, I need to specify that it is in MP3 format because it isn't recognized automatically,

This is my subprocess using ffmpeg process = await asp.create_subprocess_exec("C:\\Program Files\\ffmpeg\\ffmpeg.exe", "-i", "audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{6914E3AE-DC65-4F28-8026-79ADDD13BED5}", "-f", "dshow", "-acodec", "libmp3lame", "-f", "mp3", "-", stdout=asp.PIPE, stderr=asp.PIPE)

xXxNIKIxXx commented 1 month ago

Now its working using process = await asp.create_subprocess_exec("C:\\Program Files\\ffmpeg\\ffmpeg.exe", "-f", "dshow", "-i", "audio=Home Pod (VB-Audio Virtual Cable)", "-acodec", "libmp3lame", "-f", "mp3", "-", stdout=asp.PIPE, stderr=None) await atv.stream.stream_file(process.stdout)