Skip to content

Playing back recorded live TV (.ts files) client causes rapid screen flickering — the player starts and stops in a continuous loop. #5421

@WizardOfYendor1

Description

@WizardOfYendor1

This issue respects the following points:

  • I have discussed this issue in the Jellyfin forum and/or troubleshooting chat before opening this issue.
  • This issue is not already reported on GitHub (I've searched it).
  • I agree to follow Jellyfin's Code of Conduct.
  • This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.

Describe the bug

On recorded live tv content, when you attempt to playback the show/content the playback is constantly starting/stopping in fast loop. The effect the user sees is endless flickering of the recording.

The recorded show plays back fine on an android client.

Initial Analysis

MPEG-TS containers use PID-based stream identifiers (e.g., video PID 0x91=145, audio PID 0x94=148) rather than sequential indices. The VideoManager track matching methods (getExoPlayerTrack and setExoPlayerTrack) rely on offsetStreamIndex to translate between
Jellyfin stream indices (sequential: 0, 1) and ExoPlayer track group IDs. This translation assumes group IDs are sequential, which fails for MPEG-TS PIDs:

  • getExoPlayerTrack: Parses the selected audio group ID → 148, calls offsetStreamIndex(148, ...) → fails bounds check (148 > 2 streams) → returns -1
  • setExoPlayerTrack: Converts Jellyfin index 1 → exoTrackID 1, tries to match against group ID 148 → no match → returns false

This triggers the following loop in PlaybackController:

  1. onPrepared() calls switchAudioStream(1) (the server's default audio index)
  2. getAudioStreamIndex() returns -1 (failed PID lookup), so -1 != 1, the early-return is skipped
  3. setExoPlayerTrack(1, AUDIO, ...) returns false (PID mismatch)
  4. The else branch calls stop() then playInternal() to rebuild the stream
  5. stop() calls clearPlaybackSessionOptions() which resets mCurrentStreamInfo and mDefaultAudioIndex
  6. playInternal() POSTs to /Sessions/Playing, restarts the player → back to step 1

Looking and searching through the code history, this MAY be related and introduced with this commit: 66573c3

Media info of the file

Media capabilities report

No response

Client logs

No response

FFmpeg logs

Application version

latest/Head

Where did you install the app from?

None

Device information

Fire Cube TV, Android Studio Emulator.

Android version

N/A

Jellyfin server version

10.10.2

Other sources

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplaybackIssue related to media playback

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions