stream-server/transcoder/transcoder.go

26 lines
489 B
Go
Raw Permalink Normal View History

package transcoder
import (
"os/exec"
"os"
"io"
)
func NewTranscoder(stream_key string) (io.WriteCloser, error) {
base_dir, _ := os.UserHomeDir()
2023-10-26 00:18:34 +05:00
command := "hls-transcoder-2"
command_args := []string{
2023-10-26 00:18:34 +05:00
"4",
"/vid/" + stream_key + "/",
"4",
}
transcoder := exec.Command(command, command_args...)
transcoder.Dir = base_dir + "/live/" + stream_key + "/"
data_in, err := transcoder.StdinPipe()
if err != nil {
return nil, err
}
transcoder.Start()
return data_in, nil
}