Skip to content

allow specifying source ffmpeg format#102

Merged
balloob merged 1 commit intoSendspin:mainfrom
DanielKinsman:serve-ffmpeg-source-format
Jan 27, 2026
Merged

allow specifying source ffmpeg format#102
balloob merged 1 commit intoSendspin:mainfrom
DanielKinsman:serve-ffmpeg-source-format

Conversation

@DanielKinsman
Copy link
Contributor

@DanielKinsman DanielKinsman commented Jan 23, 2026

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:

  1. pip install --no-binary av . (necessary to use OS installed ffmpeg for alsa/pulse devices)
  2. sendspin serve --source-format pulse default (or sendspin 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:

  1. pair the phone to the computer and select it as the media output device on your phone
  2. create a virtual output device: pactl load-module module-null-sink sink_name=sendspin
  3. use pavucontrol's playback tab to select the new sendspin output device as the playback "hardware" for your bluetooth stream (show all streams at bottom first)
  4. sendspin serve --source-format pulse sendspin.monitor

@Hedda
Copy link

Hedda commented Jan 23, 2026

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.

@balloob
Copy link
Contributor

balloob commented Jan 23, 2026

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)

@balloob
Copy link
Contributor

balloob commented Jan 23, 2026

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 👍

@balloob balloob marked this pull request as draft January 23, 2026 13:31
@DanielKinsman
Copy link
Contributor Author

DanielKinsman commented Jan 23, 2026

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:

  • test the config file changes
  • re-order the args/docs to put source_format immediately below source?

@balloob
Copy link
Contributor

balloob commented Jan 23, 2026

Yeah let's group them.

@DanielKinsman DanielKinsman force-pushed the serve-ffmpeg-source-format branch from 56f6725 to 9cac08b Compare January 27, 2026 00:54
@DanielKinsman
Copy link
Contributor Author

done

Copy link
Contributor

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@balloob balloob marked this pull request as ready for review January 27, 2026 18:17
Copilot AI review requested due to automatic review settings January 27, 2026 18:17
@balloob balloob added the new-feature Request or implement a new feature label Jan 27, 2026
@balloob balloob merged commit ff08ba9 into Sendspin:main Jan 27, 2026
1 check passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_format parameter 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature Request or implement a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants