diff --git a/revid/cmd/h264-file-to-flv-rtmp/main.go b/revid/cmd/h264-file-to-flv-rtmp/main.go index 389cc239..082bd549 100644 --- a/revid/cmd/h264-file-to-flv-rtmp/main.go +++ b/revid/cmd/h264-file-to-flv-rtmp/main.go @@ -28,33 +28,41 @@ LICENSE package main import ( + "flag" + "log" "time" - "fmt" "bitbucket.org/ausocean/av/revid" ) const ( inputFile = "../../../../test/test-data/av/input/betterInput.h264" - rtmpUrl = "rtmp://a.rtmp.youtube.com/live2/v70c-qu3x-2bs4-esek" frameRate = "25" runDuration = 120 * time.Second ) // Test h264 inputfile to flv format into rtmp using librtmp c wrapper func main() { + // Get the rtmp url from a cmd flag + rtmpUrlPtr := flag.String("rtmpUrl", "", "The rtmp url you would like to stream to.") + flag.Parse() + if *rtmpUrlPtr == "" { + log.Println("No RTMP url passed!") + return + } + config := revid.Config{ Input: revid.File, InputFileName: inputFile, InputCodec: revid.H264, Output: revid.Rtmp, RtmpMethod: revid.LibRtmp, - RtmpUrl: rtmpUrl, + RtmpUrl: *rtmpUrlPtr, Packetization: revid.Flv, } revidInst, err := revid.New(config, nil) if err != nil { - fmt.Printf("Should not of have got an error!: %v\n", err.Error()) + log.Printf("Should not of have got an error!: %v\n", err.Error()) return } revidInst.Start()