#18123·jellyfin

Live TV: a tuner channel's audio codec is never checked, so an undecodable soundtrack direct-plays and no transcode is ever offered

Author: superuser404notfoundCreated Sep 19, 2026Updated Sep 28, 2026

Description of the bug

For a tuner-backed Live TV channel, StreamBuilder never compares the audio codec against the client's device profile. The comparison is skipped, not failed, so the verdict comes back DirectPlay no matter what the soundtrack is, and PlaybackInfo answers with TranscodingUrl: null and TranscodeReasons: 0. A client whose profile does not list that audio codec is handed the raw stream anyway, and there is no offer of a transcode for it to fall back to.

This is invisible on almost every channel, because broadcast audio is usually AC-3 or AAC and every client lists those. It becomes visible on an ATSC 3.0 (NextGen TV) channel, whose audio is AC-4: jellyfin-ffmpeg can decode it (jellyfin-ffmpeg#387, shipped since v6.0.1-8), but the client is told to direct-play it and never sees the re-encode the server was able to offer.

The chain, read on master:

  1. HdHomerunHost.GetMediaSource builds the lineup-derived streams with Index = -1 and leaves IsDefault unset: https://github.com/jellyfin/jellyfin/blob/master/src/Jellyfin.LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs (the MediaStreams = new MediaStream[] { ... } block)
  2. MediaSourceManager.OpenLiveStreamInternal only probes when MediaStreams.Any(i => i.Index != -1) is false and SupportsProbing is set, so on this path the lineup-derived streams survive as they are, IsDefault included.
  3. User.PlayDefaultAudioTrack defaults to true for every user (User constructor), so SetDefaultAudioStreamIndex sets source.DefaultAudioIndexSource |= AudioIndexSource.Default.
  4. StreamBuilder.BuildVideoItem then narrows the candidates to default-flagged streams: candidateAudioStreams = item.MediaStreams.Where(stream => stream.Type == MediaStreamType.Audio && stream.IsDefault).ToArray(); No lineup-derived stream carries that flag, so the collection is empty.
  5. StreamBuilder.GetVideoDirectPlayProfile guards the audio check on that collection: if (candidateAudioStreams.Count != 0) { ... SupportsAudioCodec ... } With it empty, AudioCodecNotSupported can never be raised. Container ts and the video codec pass, failureReasons == 0, and the result is PlayMethod.DirectPlay.
  6. MediaInfoHelper.SetDeviceSpecificData only builds a TranscodingUrl under if (!mediaSource.SupportsDirectPlay && ...), and TranscodeReasons is only assigned on the path that runs when streamInfo describes something other than a clean direct play. So the answer carries neither.

A useful confirmation that this is the mechanism rather than a permissions problem: toggling Allow playback remuxing, Allow video transcoding and Allow audio transcoding in every combination changes nothing. Those three gate SupportsTranscoding, which is never consulted once DirectPlay has won at step 5.

The same source asked again with EnableDirectPlay: false behaves correctly: the direct-play block is skipped entirely, BuildStreamVideoItem finds no candidate with a supported codec, raises AudioCodecNotSupported, and a TranscodingUrl comes back. That is a workaround a client can implement, not a fix, because a client cannot tell "this channel genuinely direct-plays" from "the audio was never looked at".

Reproduction steps

  1. Set up an HDHomeRun tuner host whose lineup contains a channel with an audio codec your client's device profile does not list. An ATSC 3.0 channel (AC-4 audio) on an HDHomeRun 4K is the clearest case, since no client profile lists AC-4.
  2. From a client whose posted DeviceProfile has a video DirectPlayProfile for container ts that does not name that audio codec, POST /Items/{channelId}/PlaybackInfo with AutoOpenLiveStream=true.
  3. Read the returned MediaSourceInfo.

An ATSC 1.0 channel from the same station is the control: it behaves identically, which is the point, its audio just happens to be decodable.

What is the current bug behavior?

The response carries TranscodingUrl: null and TranscodeReasons: 0, and the media source is marked as direct-playable, although the source's only audio stream carries a codec the posted profile does not list. The client either plays the channel silently or stalls on it, with nothing in the answer to indicate why, and no transcode offered to fall back to.

What is the expected correct behavior?

The audio codec of a tuner-derived source should be compared against the profile like any other source. When it is not supported, AudioCodecNotSupported should appear in TranscodeReasons and a TranscodingUrl should be offered, so the server can re-encode audio it can decode into something the client can play.

A minimal shape for this would be to not let the candidate narrowing produce an empty set, for example in BuildVideoItem, falling back to the selected audioStream when the filtered collection comes out empty. That keeps the preference behavior for sources with real dispositions and restores the check for sources that have none. Setting IsDefault on the lineup-derived stream in HdHomerunHost would fix the HDHomeRun case specifically, but not the same shape arriving from another tuner host.

Jellyfin Server version

Observed on 12.1.0. Every code reference above was read on master.

Environment

  • Tuner: HDHomeRun 4K, ATSC 3.0 channel with HEVC video and AC-4 audio, via the HDHomeRun tuner host.
  • Client: a third-party tvOS client posting a device profile whose ts direct-play profile lists aac,aac_latm,ac3,eac3,mp3,mp2,... and, deliberately, no ac4.