From 050b420f9af6befdc6a261d5b3c31d80b22698e5 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 17 Feb 2024 16:08:52 +0100 Subject: [PATCH] Fix last segment never showing on transcode/transmux --- transcoder/src/stream.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/transcoder/src/stream.go b/transcoder/src/stream.go index 21da9f9c..2f6816d9 100644 --- a/transcoder/src/stream.go +++ b/transcoder/src/stream.go @@ -314,6 +314,10 @@ func (ts *Stream) GetIndex() (string, error) { index += fmt.Sprintf("#EXTINF:%.6f\n", ts.file.Keyframes[segment+1]-ts.file.Keyframes[segment]) index += fmt.Sprintf("segment-%d.ts\n", segment) } + // do not forget to add the last segment between the last keyframe and the end of the file + index += fmt.Sprintf("#EXTINF:%.6f\n", float64(ts.file.Info.Duration)-ts.file.Keyframes[len(ts.file.Keyframes)-1]) + index += fmt.Sprintf("segment-%d.ts\n", len(ts.file.Keyframes)-1) + index += `#EXT-X-ENDLIST` return index, nil }