mirror of https://bitbucket.org/ausocean/av.git
Using flag for rtmp url
This commit is contained in:
parent
e6c2cf5f00
commit
cac22540c0
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue