Adjust frag_duration setting in stream (#59135)
This commit is contained in:
parent
7b59dea67e
commit
3693b9bd04
1 changed files with 9 additions and 9 deletions
|
@ -102,18 +102,18 @@ class SegmentBuffer:
|
||||||
# The LL-HLS spec allows for a fragment's duration to be within the range [0.85x,1.0x]
|
# The LL-HLS spec allows for a fragment's duration to be within the range [0.85x,1.0x]
|
||||||
# of the part target duration. We use the frag_duration option to tell ffmpeg to try to
|
# of the part target duration. We use the frag_duration option to tell ffmpeg to try to
|
||||||
# cut the fragments when they reach frag_duration. However, the resulting fragments can
|
# cut the fragments when they reach frag_duration. However, the resulting fragments can
|
||||||
# have variability in their durations and can end up being too short or too long. If
|
# have variability in their durations and can end up being too short or too long. With a
|
||||||
# there are two tracks, as in the case of a video feed with audio, the fragment cut seems
|
|
||||||
# to be done on the first track that crosses the desired threshold, and cutting on the
|
|
||||||
# audio track may result in a shorter video fragment than desired. Conversely, with a
|
|
||||||
# video track with no audio, the discrete nature of frames means that the frame at the
|
# video track with no audio, the discrete nature of frames means that the frame at the
|
||||||
# end of a fragment will sometimes extend slightly beyond the desired frag_duration.
|
# end of a fragment will sometimes extend slightly beyond the desired frag_duration.
|
||||||
# Given this, our approach is to use a frag_duration near the upper end of the range for
|
# If there are two tracks, as in the case of a video feed with audio, there is an added
|
||||||
# outputs with audio using a frag_duration at the lower end of the range for outputs with
|
# wrinkle as the fragment cut seems to be done on the first track that crosses the desired
|
||||||
# only video.
|
# threshold, and cutting on the audio track may also result in a shorter video fragment
|
||||||
|
# than desired.
|
||||||
|
# Given this, our approach is to give ffmpeg a frag_duration somewhere in the middle
|
||||||
|
# of the range, hoping that the parts stay pretty well bounded, and we adjust the part
|
||||||
|
# durations a bit in the hls metadata so that everything "looks" ok.
|
||||||
"frag_duration": str(
|
"frag_duration": str(
|
||||||
self._stream_settings.part_target_duration
|
self._stream_settings.part_target_duration * 9e5
|
||||||
* (98e4 if add_audio else 9e5)
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
if self._stream_settings.ll_hls
|
if self._stream_settings.ll_hls
|
||||||
|
|
Loading…
Add table
Reference in a new issue