Skip to content

Add a "Supported codecs" setting (HEVC / Enhanced Broadcasting)#705

Open
einanderson wants to merge 1 commit into
anxdpanic:masterfrom
einanderson:feature/codec-setting
Open

Add a "Supported codecs" setting (HEVC / Enhanced Broadcasting)#705
einanderson wants to merge 1 commit into
anxdpanic:masterfrom
einanderson:feature/codec-setting

Conversation

@einanderson

Copy link
Copy Markdown

Summary

Adds a "Supported codecs" setting so users can opt in to Twitch Enhanced Broadcasting (HEVC), which is required to receive 1440p+ variants.

Addresses #699 (Playback broken for 2k streams) and #700 (No audio on 2k stream): those 2K streams use HEVC, which Twitch only serves when the client requests supported_codecs.

What it does

  • New setting General → "Supported codecs": Twitch default / H.265 (HEVC).
  • The selected value is passed to usher (live / video / live_request / video_request) via the new supported_codecs parameter.
  • Default = "Twitch default" → no supported_codecs sent → behaviour unchanged (no regression).
  • Opt-in by design: HEVC requires hardware decode; users without it keep the default. h264 stays in the requested list as a fallback, so non-HEVC channels/devices still get a playable variant.
  • Graceful fallback: the value is only passed when the installed script.module.python.twitch accepts the parameter (feature-detected), so the plugin still works with an older library.

Pairs with

The library-side change anxdpanic/script.module.python.twitch#141, which adds the supported_codecs parameter. With an older library the setting simply has no effect.

Testing

  • Default setting: usher calls are byte-for-byte unchanged (regression-safe).
  • Codec mapping + graceful fallback verified; the supported_codecs=h265,h264 mechanism is in production use on Raspberry Pi 4 / Kodi 21 (HEVC 1440p plays).
  • Uses only standard APIs (stdlib inspect); platform-independent.

Notes

  • AV1 is intentionally left out for now (Enhanced Broadcasting AV1 is not generally served); the library parameter is codec-agnostic, so it can be added trivially later.

Adds a Supported codecs setting (Twitch default / H.265 (HEVC)) whose
value is passed to usher via the new supported_codecs parameter, so
users with hardware HEVC decode can receive Enhanced Broadcasting
variants (1440p+).

Default is "Twitch default" (no codec requested) -> behaviour unchanged.
The value is only passed when the installed script.module.python.twitch
accepts the parameter (feature-detected), so it degrades gracefully with
an older library.

Refs anxdpanic#699, anxdpanic#700
@einanderson einanderson marked this pull request as ready for review June 5, 2026 15:24
@einanderson

Copy link
Copy Markdown
Author

Ready for review (no longer draft) — no rush. This builds directly on your existing quality/usher handling; it only adds a small optional "Supported codecs" setting that requests H.265 (HEVC) / Enhanced Broadcasting, so 2K streams play (with audio) through inputstream.adaptive. Default stays "Twitch standard", so nothing changes unless enabled — an addition on top of your code, not a rewrite. Addresses #699 / #700.

How to test: check out this branch + the lib PR anxdpanic/script.module.python.twitch#141 → Settings → Supported codecs = H.265 (HEVC), Video Quality = Adaptive (needs inputstream.adaptive) → a 2K channel plays 2K HEVC with audio; back to "Twitch standard" = unchanged stock behaviour. Uses inspect feature-detection so it degrades gracefully on an older lib. Tested on LibreELEC / RPi 4 / Kodi 21.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant