mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
Remove can transmux check with extra segments creation
This commit is contained in:
parent
1b73beccf1
commit
4810d6cc5c
@ -81,7 +81,7 @@ func (fs *FileStream) GetMaster() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: also check if the codec is valid in a hls before putting transmux
|
// 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)
|
bitrate := float64(fs.Info.Video.Bitrate)
|
||||||
master += "#EXT-X-STREAM-INF:"
|
master += "#EXT-X-STREAM-INF:"
|
||||||
master += fmt.Sprintf("AVERAGE-BANDWIDTH=%d,", int(math.Min(bitrate*0.8, float64(transmux_quality.AverageBitrate()))))
|
master += fmt.Sprintf("AVERAGE-BANDWIDTH=%d,", int(math.Min(bitrate*0.8, float64(transmux_quality.AverageBitrate()))))
|
||||||
|
@ -34,8 +34,6 @@ func GetKeyframes(path string) ([]float64, bool, error) {
|
|||||||
scanner := bufio.NewScanner(stdout)
|
scanner := bufio.NewScanner(stdout)
|
||||||
|
|
||||||
ret := make([]float64, 0, 1000)
|
ret := make([]float64, 0, 1000)
|
||||||
last := 0.
|
|
||||||
can_transmux := true
|
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
frame := scanner.Text()
|
frame := scanner.Text()
|
||||||
if frame == "" {
|
if frame == "" {
|
||||||
@ -70,22 +68,6 @@ func GetKeyframes(path string) ([]float64, bool, error) {
|
|||||||
ret = append(ret, 0)
|
ret = append(ret, 0)
|
||||||
continue
|
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)
|
ret = append(ret, fpts)
|
||||||
}
|
}
|
||||||
return ret, can_transmux, nil
|
return ret, can_transmux, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user