Plugin hooks for per-session FFmpeg audio filters and edit graphs
I am willing to implement this and already have an open PR against master: https://github.com/jellyfin/jellyfin/pull/17808 (rebased onto current master).
Summary
Add optional plugin extension points so a plugin can, for a single playback session:
- Inject an FFmpeg
-afaudio filter (ISessionAudioFilterProvider) - Supply a labeled
-filter_complexgraph instead of the stock A/V filter chain (ISessionMediaEditGraphProvider) - Load session state before the first FFmpeg process starts (
ISessionPlaybackPlanLoader)
If no plugin implements these (the default no-ops), encoding and playback are unchanged.
This is not a dashboard “extra FFmpeg args” field. Custom FFmpeg flags were removed in 10.8.13 after GHSA-866x-wj5j-2vf4 and declined again on features/2563. The hooks are typed plugin interfaces, not user-supplied command-line strings.
Motivation
Plugins cannot change the transcode graph today without forking EncodingHelper. That blocks server-side mute/cut (needed for Chromecast and other clients that cannot apply Media Segment Mute locally), and it also blocks optional transcode-time -af uses such as volume boost or a compressor.
Related demand (this issue does not implement those product features):
- https://features.jellyfin.org/posts/3396 (mute for content-filtering plugins)
- https://github.com/jellyfin/jellyfin/issues/4556 (low volume / boost during transcode)
- https://features.jellyfin.org/posts/1112 (night-mode compressor during transcode)
- Media Segments already store a Mute action; clients mostly skip; the encoder never applies mute/cut
Proposed approach
- New interfaces in
MediaBrowser.Controller, with no-op implementations registered inApplicationHost. EncodingHelperkeeps the original six-parameter constructor and adds an overload that takes the session providers, so existing call sites and ApiCompat stay intact while DI can inject the hooks.- HLS and progressive video call the plan loader, then ask for
-afor a graph, before building the FFmpeg command. - Graph path is opt-in per session. If the plugin returns nothing, the stock filter path runs.
- Plugin-supplied filter strings should be constrained (no free-form argument injection). Exact sanitization can be discussed in review.
I can split follow-up work (playback modifiers, subtitle cue remapping, trickplay) into later PRs. This issue is only the encode hooks.
Non-goals
- User-configurable extra FFmpeg arguments in the UI or API
- Forcing transcode for Direct Play
- Implementing mute, loudnorm, EDL, or content filtering in core
- Changing Media Segments metadata (providers already exist)
Testing
I have exercised the hooks with a plugin on a patched Jellyfin stack and rebased the PR onto current master. Hook unit tests pass locally (EncodingHelperSessionHooks, SDK 10); full PR CI is waiting on maintainer workflow approval.
Source: jellyfin/jellyfin