Skip to content

Add support for OGG Vorbis radio streams#3326

Merged
MarvinSchenkel merged 9 commits intodevfrom
support-ogg-vorbis-stream-metadata
Mar 20, 2026
Merged

Add support for OGG Vorbis radio streams#3326
MarvinSchenkel merged 9 commits intodevfrom
support-ogg-vorbis-stream-metadata

Conversation

@OzGav
Copy link
Contributor

@OzGav OzGav commented Mar 7, 2026

DEPENDS ON: music-assistant/models#175

SATISFIES: https://github.com/orgs/music-assistant/discussions/5016

This PR adds support for OGG Vorbis and Opus radio streams with in-band metadata extraction. Internet radio stations using OGG containers send "chained" streams where each track is a separate logical bitstream with its own headers. FFmpeg's OGG demuxer cannot handle these chain transitions—it treats the end-of-stream marker followed by new headers as an error and exits.

The solution, inspired by VLC's OGG demuxer, is to parse the raw OGG pages and stitch multiple logical bitstreams into a single continuous stream. The first chain's headers (OpusHead/OpusTags or Vorbis identification/comment) are forwarded to FFmpeg, while subsequent chains have their headers stripped and EOS pages skipped entirely. Page sequence numbers and granule positions are rewritten to maintain continuity.

Metadata is extracted from OpusTags or Vorbis comment headers at chain boundaries and propagated via callback, enabling track title updates during playback without interrupting the audio stream.

tested with http://stream.tilos.hu:80/tilos.opus and http://srv.tsmod.net:8008/dnb

@MarvinSchenkel MarvinSchenkel added this to the 2.9.0 milestone Mar 16, 2026
@OzGav OzGav modified the milestones: 2.9.0, 2.8.0 Mar 19, 2026
Copy link
Contributor

@marcelveldt-traveling marcelveldt-traveling left a comment

Choose a reason for hiding this comment

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

Looks good, well done!

@MarvinSchenkel MarvinSchenkel merged commit dbf6789 into dev Mar 20, 2026
10 checks passed
@MarvinSchenkel MarvinSchenkel deleted the support-ogg-vorbis-stream-metadata branch March 20, 2026 11:58
OzGav added a commit that referenced this pull request Mar 21, 2026
* Add support for OGG Vorbis/Opus radio streams

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add support for OGG Vorbis/Opus radio streams

* Remove notes

* Tidy up comments and docstrings

* Extract in-band metadata from running stream and improve error handling

---------

Co-authored-by: Claude <noreply@anthropic.com>
OzGav added a commit that referenced this pull request Mar 21, 2026
* Add support for OGG Vorbis/Opus radio streams

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add support for OGG Vorbis/Opus radio streams

* Remove notes

* Tidy up comments and docstrings

* Extract in-band metadata from running stream and improve error handling

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants