Browse Source

Ignore initial delay in audio-only containers (#15247)

Nyanmisaka 1 month ago
parent
commit
6bf88c049e
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Jellyfin.Api/Controllers/DynamicHlsController.cs

+ 5 - 2
Jellyfin.Api/Controllers/DynamicHlsController.cs

@@ -1625,8 +1625,11 @@ public class DynamicHlsController : BaseJellyfinApiController
 
             var useLegacySegmentOption = _mediaEncoder.EncoderVersion < _minFFmpegHlsSegmentOptions;
 
-            // fMP4 needs this flag to write the audio packet DTS/PTS including the initial delay into MOOF::TRAF::TFDT
-            hlsArguments += $" {(useLegacySegmentOption ? "-hls_ts_options" : "-hls_segment_options")} movflags=+frag_discont";
+            if (state.VideoStream is not null && state.IsOutputVideo)
+            {
+                // fMP4 needs this flag to write the audio packet DTS/PTS including the initial delay into MOOF::TRAF::TFDT
+                hlsArguments += $" {(useLegacySegmentOption ? "-hls_ts_options" : "-hls_segment_options")} movflags=+frag_discont";
+            }
 
             segmentFormat = "fmp4" + outputFmp4HeaderArg;
         }