Closed tsaiyuen closed 1 year ago
SRS has a default setting where it waits for a complete GOP of frames before closing a TS segment. This means that if you set hls_fragment
to 2, but your GOP is 5 seconds long, the resulting segment may exceed the 5-second limit.
To reduce the size of the GOP, you can modify the encoder settings. For instance, in FFmpeg, you can set the GOP to 2 seconds by using the command -r 25 -g 50
by -g frames
.
You can also configure SRS to not wait for a complete GOP before closing a TS segment file by adjusting thehls_wait_keyframe
setting.
# whether wait keyframe to reap segment,
# if off, reap segment when duration exceed the fragment,
# if on, reap segment when duration exceed and got keyframe.
# default: on
hls_wait_keyframe on;
See FAQ:
Description
I want to configure my EXT-X-TARGETDURATION with value 5. My segment needs to have max 5 seconds, and I tried may values for hls_fragment and hls_window. My minimum value is always EXT-X-TARGETDURATION: 9. Is there any limitation?
SRS Version: 4.0
SRS Log:
Replay
Please describe how to replay the bug?
Step 1: Run docker, copying the
docker.conf
from my file, with the configuration aboveStep 2: run ffmpeg streaming
Step 3: curl localhost with wery string
➜ curl "http://localhost:8080/live/livestream.m3u8"
➜ curl "http://localhost:8080/live/livestream.m3u8?hls_ctx=223b622j"
Expect
I believe we should have a smaller
EXT-X-TARGETDURATION
andEXTINF
. MaybeEXT-X-TARGETDURATION:5
andEXTINF:4.8
TRANS_BY_GPT3