postlund / pyatv

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

Streaming audio coming from a USB Audio interface #2133

Closed borjaburgos closed 11 months ago

borjaburgos commented 11 months ago

What do you need help with?

Hi there, I have a quick question. I'm trying to stream audio to airplay coming in from a USB Audio interface (behringer ufo 202). I'm on a RPi. Any hints or pointers appreciated.

postlund commented 11 months ago

I have never done that, but I would expect that ffmpeg can solve it for you. Streaming a simple file using atvremote looks something like this:

ffmpeg -i sample.wav -f mp3 - | atvremote -s 10.0.10.194 stream_file=-

You should be able to pick your card as input (instead of sample.wav), but how you do that depends on the sound system. I suspect that PulseAudio is used, so maybe you can follow the instructions here:

https://trac.ffmpeg.org/wiki/Capture/PulseAudio

If that doesn't work, maybe try ALSA instead:

https://trac.ffmpeg.org/wiki/Capture/ALSA

borjaburgos commented 11 months ago

Hey! Thank you! This worked 👍

postlund commented 11 months ago

Great! 👍