live-streamer/streamer/helper.go

36 lines
664 B
Go

package streamer
import (
"fmt"
"live-streamer/config"
"log"
)
func buildFFmpegArgs(videoItem config.InputItem) []string {
videoPath := videoItem.Path
args := []string{"-re"}
if videoItem.Start != "" {
args = append(args, "-ss", videoItem.Start)
}
if videoItem.End != "" {
args = append(args, "-to", videoItem.End)
}
args = append(args,
"-i", videoPath,
)
for k, v := range config.GlobalConfig.Play {
args = append(args, k)
args = append(args, fmt.Sprint(v))
}
args = append(args, fmt.Sprintf("%s/%s", config.GlobalConfig.Output.RTMPServer, config.GlobalConfig.Output.StreamKey))
log.Println("ffmpeg args: ", args)
return args
}