allow specifying source ffmpeg format#102
Conversation
|
FYI; rudyberends submitted a draft pull request which would add support for such a source/sender role to Sendspin-clients here: For reference; there is also a direcly related discussion here about how support for audio input could be added to the Sendspin protocol spec: Also note that Sendspin specification developers have previously written there that they have no plans to add support for multiple servers and that they instead plan to add a new source/sender role to Sendspin client-side, so you can have a single server and yet allow each client to also act a source too. |
|
This is great. I love how small this PR is! Given that the default installation of Sendspin is using av with binaries, is there a path forward to use this for other users? I am hesitant to merge a feature that cannot work for most people. (Also README update is missing) |
|
Did some research, and it seems that source format is useful for other use cases, like when the extension doesn't match the input. So I am fine to merge this PR. Please update the README and this PR is good to go 👍 |
|
Ok I've updated the readme. I avoided adding a whole new section to it about the --no-binary and alsa/pulse stuff, might distract from the important information, but let me know if you'd prefer that to be there. Also before you merge I need to:
|
|
Yeah let's group them. |
56f6725 to
9cac08b
Compare
|
done |
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to specify an ffmpeg input format for audio sources in serve mode, enabling streaming from local audio inputs like ALSA and PulseAudio devices. This is a requested feature to enable music providers for local audio input.
Changes:
- Added
source_formatparameter throughout the serve mode stack (settings, CLI, config, and audio decoder) - Updated
av.open()call to accept the format parameter for format-specific input sources - Updated README documentation to describe the new configuration option
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sendspin/settings.py | Added source_format field to ServeSettings with persistence support |
| sendspin/serve/source.py | Added optional source_format parameter to decode_audio() and passed it to av.open() |
| sendspin/serve/init.py | Added source_format field to ServeConfig dataclass and passed it to decode_audio() |
| sendspin/cli.py | Added --source-format CLI argument and integrated it with settings fallback |
| README.md | Updated documentation table to describe the new source_format setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A requested feature in music assistant is a music provider for local audio input. I figured why not also put that ability in to the sendspin serve cli for a stand alone way of doing it without music assistant. Because pyav is used to load the input source we can do that just by specifying the ffmpeg input source format along with the source.
Steps to get it running:
pip install --no-binary av .(necessary to use OS installed ffmpeg for alsa/pulse devices)sendspin serve --source-format pulse default(orsendspin serve --source-format alsa hw:0)Latency seems to be about 5 seconds on my machine but it is better than nothing!
You can even get it to stream from your phone's bluetooth paired to the computer with a few more steps:
pactl load-module module-null-sink sink_name=sendspinsendspin serve --source-format pulse sendspin.monitor