Remove can transmux check with extra segments creation

This commit is contained in:
Zoe Roux 2024-02-26 17:05:48 +01:00
parent 1b73beccf1
commit 4810d6cc5c
2 changed files with 1 additions and 19 deletions

View File

@ -81,7 +81,7 @@ func (fs *FileStream) GetMaster() string {
}
}
// TODO: also check if the codec is valid in a hls before putting transmux
if fs.CanTransmux {
if true {
bitrate := float64(fs.Info.Video.Bitrate)
master += "#EXT-X-STREAM-INF:"
master += fmt.Sprintf("AVERAGE-BANDWIDTH=%d,", int(math.Min(bitrate*0.8, float64(transmux_quality.AverageBitrate()))))

View File

@ -34,8 +34,6 @@ func GetKeyframes(path string) ([]float64, bool, error) {
scanner := bufio.NewScanner(stdout)
ret := make([]float64, 0, 1000)
last := 0.
can_transmux := true
for scanner.Scan() {
frame := scanner.Text()
if frame == "" {
@ -70,22 +68,6 @@ func GetKeyframes(path string) ([]float64, bool, error) {
ret = append(ret, 0)
continue
}
// If we have a segment of more than 20s, create new keyframes during transcode and disable transmuxing
if fpts-last > 20 {
can_transmux = false
fake_count := math.Ceil(fpts - last/4)
duration := (fpts - last) / fake_count
// let the last one be handled normally, this prevents floating points rounding
for fake_count > 1 {
fake_count--
last = last + duration
ret = append(ret, last)
}
}
last = fpts
ret = append(ret, fpts)
}
return ret, can_transmux, nil