mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 05:34:23 -04:00
Disable noaccurate_seek on audio streams
This commit is contained in:
parent
4993d34835
commit
1e0ff4a950
@ -22,6 +22,10 @@ func (as *AudioStream) getOutPath(encoder_id int) string {
|
|||||||
return fmt.Sprintf("%s/segment-a%d-%d-%%d.ts", as.file.Out, as.index, encoder_id)
|
return fmt.Sprintf("%s/segment-a%d-%d-%%d.ts", as.file.Out, as.index, encoder_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (as *AudioStream) getFlags() Flags {
|
||||||
|
return AudioF
|
||||||
|
}
|
||||||
|
|
||||||
func (as *AudioStream) getTranscodeArgs(segments string) []string {
|
func (as *AudioStream) getTranscodeArgs(segments string) []string {
|
||||||
return []string{
|
return []string{
|
||||||
"-map", fmt.Sprintf("0:a:%d", as.index),
|
"-map", fmt.Sprintf("0:a:%d", as.index),
|
||||||
|
@ -15,9 +15,17 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Flags int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
AudioF Flags = 1 << 0
|
||||||
|
VideoF Flags = 1 << 1
|
||||||
|
)
|
||||||
|
|
||||||
type StreamHandle interface {
|
type StreamHandle interface {
|
||||||
getTranscodeArgs(segments string) []string
|
getTranscodeArgs(segments string) []string
|
||||||
getOutPath(encoder_id int) string
|
getOutPath(encoder_id int) string
|
||||||
|
getFlags() Flags
|
||||||
}
|
}
|
||||||
|
|
||||||
type Stream struct {
|
type Stream struct {
|
||||||
@ -154,12 +162,17 @@ func (ts *Stream) run(start int32) error {
|
|||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"-nostats", "-hide_banner", "-loglevel", "warning",
|
"-nostats", "-hide_banner", "-loglevel", "warning",
|
||||||
|
}
|
||||||
|
|
||||||
|
if ts.handle.getFlags()&VideoF != 0 {
|
||||||
// This is the default behavior in transmux mode and needed to force pre/post segment to work
|
// This is the default behavior in transmux mode and needed to force pre/post segment to work
|
||||||
"-noaccurate_seek",
|
// This must be disabled when processing only audio because it creates gaps in audio
|
||||||
|
args = append(args, "-noaccurate_seek")
|
||||||
|
}
|
||||||
|
args = append(args,
|
||||||
"-ss", fmt.Sprintf("%.6f", start_ref),
|
"-ss", fmt.Sprintf("%.6f", start_ref),
|
||||||
"-i", ts.file.Path,
|
"-i", ts.file.Path,
|
||||||
}
|
)
|
||||||
// do not include -to if we want the file to go to the end
|
// do not include -to if we want the file to go to the end
|
||||||
if end+1 < int32(len(ts.file.Keyframes)) {
|
if end+1 < int32(len(ts.file.Keyframes)) {
|
||||||
// sometimes, the duration is shorter than expected (only during transcode it seems)
|
// sometimes, the duration is shorter than expected (only during transcode it seems)
|
||||||
|
@ -18,6 +18,10 @@ func NewVideoStream(file *FileStream, quality Quality) *VideoStream {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (vs *VideoStream) getFlags() Flags {
|
||||||
|
return VideoF
|
||||||
|
}
|
||||||
|
|
||||||
func (vs *VideoStream) getOutPath(encoder_id int) string {
|
func (vs *VideoStream) getOutPath(encoder_id int) string {
|
||||||
return fmt.Sprintf("%s/segment-%s-%d-%%d.ts", vs.file.Out, vs.quality, encoder_id)
|
return fmt.Sprintf("%s/segment-%s-%d-%%d.ts", vs.file.Out, vs.quality, encoder_id)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user