plugin.video.twitch icon indicating copy to clipboard operation
plugin.video.twitch copied to clipboard

4.0.0 alpha2 - live streams play audio but no picture (InputStream Adaptive 22)

Open einanderson opened this issue 5 days ago • 0 comments

Context

  • Add-on Version: 4.0.0~alpha2
  • Kodi Version: 22.0-RC2 (Piers), InputStream Adaptive 22.3.24
  • Kodi GUI Language: German
  • Operating System: LibreELEC 13 (Raspberry Pi 4)
  • Operating System Language: German

Expected Behavior

A live stream plays with picture and sound, with the master playlist or with Play (choose quality).


Current Behavior

Sound plays, the picture stays black. Same with the master playlist (H.264 and HEVC renditions offered) and with Play (choose quality) at 1440p HEVC and at 1080p H.264. YouTube 8.0 plays fine on the same device.

In the debug log the video decoder opens (h264_v4l2m2m / DRM PRIME HEVC) but never outputs a frame: there is no CRenderManager::Configure and no VideoPlayer::Sync - Video, only the audio is synced.


Possible Fix

The cause is the audio muxed into Twitch's video renditions (CODECS="avc1...,mp4a.40.2"). I played the playlists through a .strm with #KODIPROP lines, without the add-on, on the same channel (the first and last case twice each, the others once):

Playlist handed to InputStream Adaptive Picture
usher master as the add-on requests it no
same, with inputstream.adaptive.live_delay=8 no
same, with allow_audio_only=true no
allow_audio_only=true, mp4a removed from the video renditions' CODECS, so the audio-only rendition is the one audio track (served from localhost) yes

This isn't new with v4. I ran into the same muxed audio tracks with the 3.x add-on on Kodi 21 / InputStream Adaptive 21, where they showed up differently: Adaptive made one audio track per muxed rendition, only the audio-only one ever delivered packets, so streams sometimes started silent, and switching to another rendition during playback could end in a black picture. In my fork (https://github.com/einanderson/twitch-for-kodi) I tried other ways before settling on this one, measured on the same channel:

Master playlist Runs Result when switching renditions
mp4a removed from the video renditions, audio-only rendition kept 6 picture every time
audio-only rendition removed, muxed audio kept 4 black picture every time

Removing only the audio-only rendition's #EXT-X-MEDIA:TYPE=VIDEO group (it carries only audio) changed nothing, Adaptive still made two audio tracks. Nothing but the audio-only rendition as the single audio track worked. The fork has played that way on two Raspberry Pi 4 since July, and on Kodi 22 since this month.

On Kodi 21, switching to HEVC during playback also failed for a second reason: Kodi disabled the stream (Codec id 173 require extradata). On Kodi 22 that's gone. With the audio fix and all renditions kept (H.264 and HEVC), I switched the video stream during playback 6 times on the same channel, 3 times H.264 to HEVC and 3 times HEVC to H.264: the new decoder opened and the renderer was set up every time, with no require extradata and no disabled stream.

So the master needs rewriting before InputStream Adaptive gets it. It has to be served over HTTP, since InputStream Adaptive won't open a local file as the manifest.

I have this working in a local build of alpha2 (service with a localhost server, the master rewritten in _stream, falling back to the original address when anything fails). Picture and sound on live streams, with the master and with Play (choose quality) at every resolution offered. Happy to open it as a PR if you want it.


Steps to Reproduce

  1. Player: InputStream Adaptive (default); happens with the H.264 and the H.265 codec setting
  2. Play a live stream, or use Play (choose quality)
  3. Sound, no picture

Debuglog

The usher master as the add-on requests it, with the add-on's live_delay, played through a .strm (H.264 only, so it isn't the codec). Addresses redacted. After VideoPlayer::Sync - Audio only segment downloads follow; within 20 s there is no VideoPlayer::Sync - Video and no CRenderManager::Configure, and the playing time doesn't move.

2026-11-28 22:46:48.181 T:1020     info <general>: VideoPlayer::OpenFile: <path>
2026-11-28 22:46:48.204 T:2120    debug <inputstream.adaptive>: Open()
2026-11-28 22:46:48.206 T:2120    debug <inputstream.adaptive>: Property found "inputstream.adaptive.live_delay" value: 8
2026-11-28 22:46:48.206 T:2120  warning <inputstream.adaptive>: Warning "inputstream.adaptive.live_delay" property is deprecated and will be removed next Kodi version, use "inputstream.adaptive.manifest_config" instead.
2026-11-28 22:46:48.206 T:2120    debug <inputstream.adaptive>: [Repr. chooser] Type: Default
2026-11-28 22:46:48.206 T:2120     info <inputstream.adaptive>: [Repr. chooser] Resolution set: 1920x1080, max allowed: 3840x2160, Adjust refresh rate: 1
2026-11-28 22:46:48.206 T:2120    debug <inputstream.adaptive>: [Repr. chooser] Configuration
2026-11-28 22:46:48.300 T:2120    debug <inputstream.adaptive>: Download finished: https://usher.ttvnw.net/api/channel/hls/rawiioli.m3u8?<redacted> (downloaded 8745 byte, speed 70652.00 byte/s)
2026-11-28 22:46:48.300 T:2120     info <inputstream.adaptive>: Manifest successfully parsed (Periods: 1, Streams in first period: 2, Type: live)
2026-11-28 22:46:48.300 T:2120    debug <inputstream.adaptive>: [Repr. chooser] Stream selection conditions
2026-11-28 22:46:48.300 T:2120    debug <inputstream.adaptive>: [Repr. chooser] Selected representation
2026-11-28 22:46:48.300 T:2120    debug <inputstream.adaptive>: Created AdaptiveStream [AS-0] with adaptation set ID: "", stream type: video
2026-11-28 22:46:48.300 T:2120    debug <inputstream.adaptive>: Created AdaptiveStream [AS-1] with adaptation set ID: "", stream type: audio
2026-11-28 22:46:48.300 T:2120    debug <inputstream.adaptive>: GetCapabilities()
2026-11-28 22:46:48.301 T:2120    debug <inputstream.adaptive>: GetStreamIds()
2026-11-28 22:46:48.301 T:2120    debug <inputstream.adaptive>: GetStream(1001)
2026-11-28 22:46:48.301 T:2120    debug <inputstream.adaptive>: GetStream(1002)
2026-11-28 22:46:48.301 T:2120    debug <inputstream.adaptive>: OpenStream(1001)
2026-11-28 22:46:48.506 T:2120    debug <inputstream.adaptive>: Download finished: https://euc11.playlist.ttvnw.net/v1/playlist/<redacted> (downloaded 16019 byte, speed 41573.00 byte/s)
2026-11-28 22:46:48.586 T:2127    debug <inputstream.adaptive>: [AS-0] Download finished: https://1cf9ea8ea05d.j.cloudfront.hls.ttvnw.net/v1/segment/<redacted>?<redacted> (downloaded 1125 byte, speed 14332.00 byte/s)
2026-11-28 22:46:48.588 T:2120    debug <inputstream.adaptive>: UpdateSampleDescription: Codec fourcc: avc1 (1635148593)
2026-11-28 22:46:48.588 T:2120    debug <inputstream.adaptive>: GetStream(1001)
2026-11-28 22:46:48.674 T:2120     info <general>: Creating video codec: h264
2026-11-28 22:46:48.674 T:2120     info <general>: CDVDVideoCodecDRMPRIME::Open - using decoder V4L2 mem2mem H.264 decoder wrapper
2026-11-28 22:46:48.678 T:2120     info <general>: ffmpeg[0x39772820]: [h264_v4l2m2m] Using device /dev/video10
2026-11-28 22:46:48.678 T:2120     info <general>: ffmpeg[0x39772820]: [h264_v4l2m2m] driver 'bcm2835-codec' on card 'bcm2835-codec-decode' in mplane mode
2026-11-28 22:46:48.679 T:2120     info <general>: ffmpeg[0x39772820]: [h264_v4l2m2m] requesting formats: output=H264/none capture=YU12/none
2026-11-28 22:46:48.699 T:2120    debug <general>: CVideoPlayerVideo::OpenStream - open stream with codec: h264
2026-11-28 22:46:48.704 T:2120    debug <general>: CVideoPlayer::OpenStream: m_bFullScreenVideo set pre-Configure, viewport 1921x1079
2026-11-28 22:46:48.704 T:2120    debug <inputstream.adaptive>: OpenStream(1002)
2026-11-28 22:46:48.704 T:2120    debug <inputstream.adaptive>: CreateReaderByTrack: Created shared reader for audio track id 1
2026-11-28 22:46:48.705 T:2120    debug <inputstream.adaptive>: UpdateSampleDescription: Codec fourcc: mp4a (1836069985)
2026-11-28 22:46:48.705 T:2120    debug <inputstream.adaptive>: GetStream(1002)
2026-11-28 22:46:48.705 T:2120     info <general>: Finding audio codec for: 86018
2026-11-28 22:46:48.706 T:2120     info <general>: void CVideoPlayerAudio::OpenStream(CDVDStreamInfo&, std::unique_ptr<CDVDAudioCodec>): Allowing max Out-Of-Sync Value of 50 ms
2026-11-28 22:46:48.706 T:2120     info <general>: Creating audio thread
2026-11-28 22:46:48.706 T:2120    debug <general>: CVideoPlayer::SetCaching - caching state 2
2026-11-28 22:46:48.860 T:2131     info <general>: Creating audio stream (codec: aac, channels: 2, sample rate: 48000, no pass-through)
2026-11-28 22:46:48.882 T:2120    debug <general>: CVideoPlayer::HandleMessages - player started 1
2026-11-28 22:46:48.911 T:2127    debug <inputstream.adaptive>: [AS-0] Download finished: https://1cf9ea8ea05d.j.cloudfront.hls.ttvnw.net/v1/segment/<redacted>?<redacted> (downloaded 1926944 byte, speed 12567545.00 byte/s)
2026-11-28 22:46:48.934 T:2120    debug <general>: VideoPlayer::Sync - Audio - pts: 4208341999.000000, cache: 516240.707983, totalcache: 800000.011921
2026-11-28 22:46:48.934 T:1066    debug <general>: virtual void CApplicationPlayerCallback::OnAVStarted(const CFileItem&): call
2026-11-28 22:46:48.991 T:2127    debug <inputstream.adaptive>: [AS-0] Download finished: https://1cf9ea8ea05d.j.cloudfront.hls.ttvnw.net/v1/segment/<redacted>?<redacted> (downloaded 1929571 byte, speed 24177360.00 byte/s)
2026-11-28 22:46:49.072 T:2127    debug <inputstream.adaptive>: [AS-0] Download finished: https://1cf9ea8ea05d.j.cloudfront.hls.ttvnw.net/v1/segment/<redacted>?<redacted> (downloaded 1927339 byte, speed 24130648.00 byte/s)
2026-11-28 22:46:49.154 T:2127    debug <inputstream.adaptive>: [AS-0] Download finished: https://1cf9ea8ea05d.j.cloudfront.hls.ttvnw.net/v1/segment/<redacted>?<redacted> (downloaded 1932376 byte, speed 23613075.00 byte/s)

einanderson avatar Nov 28 '26 21:11 einanderson