Repository navigation
Description
What happened
An HLS remux that copies both video and AAC audio from an MPEG-TS source fails after the first segment. MPEG-TS carries AAC in ADTS framing, and the fMP4 segments the HLS muxer writes can't hold ADTS. FFmpeg stops on the first audio packet:
[mp4 @ <redacted address>] Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
[aost#0:1/copy @ <redacted address>] Error submitting a packet to the muxer: Operation not permitted
[out#0/hls @ <redacted address>] Error muxing a packet
FFmpeg exits with status 255 after writing init.mp4 and a partial first segment.
#2698 fixes the same failure in the progressive fMP4 remux. The HLS copy path in internal/playback/transcode.go has the same problem and is not part of that PR.
Steps to reproduce
Not reproduced on a deployment. It was reproduced by running the arguments the server builds:
- Make an MPEG-TS file with H.264 video and AAC audio:
ffmpeg -f lavfi -i testsrc2=size=160x90:rate=25 -f lavfi -i sine=frequency=440:sample_rate=48000 -t 8 -c:v libx264 -g 25 -c:a aac -ac 2 s.ts - Build the HLS arguments with
buildFFmpegArgsforTranscodeOpts{TargetCodecVideo: "copy", TargetCodecAudio: "copy", SourceVideoCodec: "h264", SegmentDuration: 2, AudioTrackIndex: -1}with that file as input. - Run FFmpeg with those arguments. They select
-hls_segment_type fmp4becausecopyVideoUsesFMP4is true. FFmpeg 6.1.1 fails with the error above.
The planner chooses this path for an HLS remux that keeps the source audio (plan_v3.go, HLS remux with TargetAudioCodec: "copy"). Jellycompat sessions with HLSRemuxMPEGTS set write MPEG-TS segments and are not affected.
Expected behavior
An HLS copy remux of an MPEG-TS file with AAC audio writes playable fMP4 segments, with -bsf:a aac_adtstoasc added for a copied AAC track.
Silo version / commit
main at a7594d8
Deployment
Not deployment-specific. Found by running FFmpeg locally with the arguments the server builds.
Clients affected
Any client the planner sends to an HLS remux with copied video and audio for an MPEG-TS source. Not checked per client.
Relevant logs
FFmpeg output above. No server logs available.
Technical notes
aac_adtstoascrejects any codec other than AAC, so the filter has to depend on the copied track's codec and can't apply to every copy. In the HLS path,TargetCodecAudiois"copy"and doesn't say which codec is copied. fix(playback): play MPEG-TS files with AAC audio over the web remux #2698 adds a copied-audio-codec field (CopyAudioCodec, token claimcac) for the progressive remux. This fix should follow that PR and reuse the field so remote nodes get the codec too.- The filter passes AAC that is already raw (MKV, MP4) through unchanged.
AI harness
Claude Code in T3 Code
AI tool(s)
Claude Code
AI model(s)
claude-opus-5-5
AI involvement
Found and reproduced by an AI reviewer while reviewing #2698. A human has not verified it.
Independent or adversarial review
None for this issue.
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
- Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above
Source: found in review of #2698
Activity
fix(playback): convert copied ADTS AAC for fMP4 HLS segments (Silo-Se…