2024-10-25 00:51:49 -04:00
|
|
|
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,
|
|
|
|
)
|
|
|
|
|
2024-10-27 10:53:25 -04:00
|
|
|
for k, v := range config.GlobalConfig.Play {
|
|
|
|
args = append(args, k)
|
|
|
|
args = append(args, fmt.Sprint(v))
|
2024-10-25 00:51:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
args = append(args, fmt.Sprintf("%s/%s", config.GlobalConfig.Output.RTMPServer, config.GlobalConfig.Output.StreamKey))
|
|
|
|
|
|
|
|
log.Println("ffmpeg args: ", args)
|
|
|
|
|
|
|
|
return args
|
|
|
|
}
|