Read incoming stream from stdin
This commit is contained in:
parent
edf807851b
commit
9d96e0236a
25
main.go
25
main.go
|
@ -1,10 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"segmenta/pkg/generator"
|
||||
"segmenta/pkg/handler"
|
||||
|
@ -13,32 +11,13 @@ import (
|
|||
// How to stream a static video file as a "live" stream?
|
||||
|
||||
func main() {
|
||||
var url string
|
||||
|
||||
flag.StringVar(&url, "url", "", "URL to open")
|
||||
flag.Parse()
|
||||
|
||||
if url == "" {
|
||||
fmt.Println("Usage:")
|
||||
flag.PrintDefaults()
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
// open URL:
|
||||
client := http.Client{}
|
||||
resp, err := client.Get(url)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
handler := handler.NewS3Handler("rfwatson-hls", "public-read")
|
||||
generator := generator.NewFFMPEGGenerator("test", resp.Body)
|
||||
generator := generator.NewFFMPEGGenerator("test", os.Stdin)
|
||||
generator.AddHandler(handler)
|
||||
|
||||
fmt.Println("starting generator...")
|
||||
|
||||
err = generator.Generate()
|
||||
err := generator.Generate()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
package web
|
Loading…
Reference in New Issue