Jump to content

Add Server-Side Audio Mixing to Inject “Next Up” or Emergency Announcements


Recommended Posts

Posted

Feature Request: Dynamic Server-Side Audio Overlay for Timed Announcements

Summary
Enable Emby to mix a short, dynamically generated audio clip (for example a text-to-speech "Next up on your playlist…" line) during playback—such as over the final 30 seconds of an episode—without interrupting the main video or requiring any custom client.


Why It’s Valuable

  • Accessibility – live descriptive audio or urgent alerts

  • Community & commercial – sponsor bumps, station IDs, event notices

  • Enthusiast use cases – classic TV–style continuity announcements, DJ-style mixes, music-video countdowns

  • Automation – works with dynamic playlists and TTS to create self-running "virtual channels"

This goes well beyond pre-roll and post-roll, turning Emby into a true TV-style playout system.


Technical Proposal

1. New Plug-in API Hook

{
  "type": "OverlayRequest",
  "playSessionId": "abc123",
  "startOffset": 1200,  // seconds from start of current media
  "duration": 15,
  "audioUrl": "http://plugin.local/next-up-clip.mp3",
  "duckDb": -6         // optional dB reduction of main audio
}

A plug-in would send this request when it knows the next segment to announce.

2. Segment-Level Mixing in ffmpeg

  • Emby already chops streams into HLS/DASH segments.

  • On an OverlayRequest, the server:

    Temporarily reduces segment length (e.g. 2 s) for precise timing.

    For each affected segment, runs:

    ffmpeg -i segment.ts -i next-up-clip.mp3 \
      -filter_complex "[0:a]volume=0.7[a0];[a0][1:a]amix=inputs=2:duration=first" \
      -c:v copy -map 0:v -map "[mixed]" mixed-segment.ts
    

    Serves these mixed segments in place of the originals.

3. Client Transparency

  • Clients continue to read a normal HLS/DASH playlist—no second player, no protocol change, no client modification.

4. Fail-Safe

  • If the overlay isn’t ready in time, Emby simply serves the unmodified segment, ensuring uninterrupted playback.


Advantages

  • Works on all Emby clients (web, Android TV, Apple TV, Roku, etc.)

  • Supports dynamic, real-time audio (TTS or live microphone feeds)

  • Opens up new plugin possibilities for broadcasters, educators, and home-theater enthusiasts

This feature would let Emby natively support continuity-style announcements, emergency alerts, and other live overlay scenarios while preserving Emby’s hallmark direct-play performance and client compatibility.

 
 
visproduction
Posted (edited)

Related attempt that thinks a separate speaker hook up is the only way:
https://community.home-assistant.io/t/play-tts-without-interrupting-media-playback/779428

===

Quote

Temporarily reduces segment length (e.g. 2 s) for precise timing.

I would be concerned if restarted video stream actually picks up in sync audio again, at all.  I think that may fail and might need a total video stream restart to get any audio working, after the announcement break.

I would guess that the users end software player would need to allow this interruption.  That could be a browser, a TV app, android App, iOS app. and also Emby's transcoding, plus all the various audio possible playback situations.  Some user's players permit direct audio on some codecs and not others, for example.  I think the extra function of the audio anouncement would need to work with every combination of user's player and audio type, because it's the player that is going to have to deal with this, as well as pushing the audio change out from the server.  I think it probably just won't work for everyone and might just cut off audio completely from starting up again for everyone.  Have you run any tests with different playbacks?

Edited by visproduction
Posted
5 hours ago, DouglasKiss said:

Feature Request: Dynamic Server-Side Audio Overlay for Timed Announcements

Spoken like a genuine reseller. 😸

  • Haha 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...