diff --git a/revid/config.go b/revid/config.go index b00cd63e..7be75475 100644 --- a/revid/config.go +++ b/revid/config.go @@ -118,6 +118,7 @@ const ( defaultVBRQuality = qualityStandard defaultBurstPeriod = 10 // Seconds defaultVBRBitrate = 500 // kbps + defaultCameraChan = 2 // Raspivid video defaults. defaultBrightness = 50 @@ -241,6 +242,9 @@ type Config struct { // variable bitrate. VBRBitrate int + // This is the channel we're using for the GeoVision camera. + CameraChan int + // MinFrames defines the frequency of key NAL units SPS, PPS and IDR in // number of NAL units. This will also determine the frequency of PSI if the // output container is MPEG-TS. If ClipDuration is less than MinFrames, @@ -525,6 +529,11 @@ func (c *Config) Validate() error { c.VBRBitrate = defaultVBRBitrate } + if c.CameraChan != 1 && c.CameraChan != 2 { + c.Logger.Log(logger.Info, pkg+"CamChan bad or unset, defaulting", "CamChan", defaultCameraChan) + c.CameraChan = defaultCameraChan + } + return nil } diff --git a/revid/inputs.go b/revid/inputs.go index e83806e0..c1576019 100644 --- a/revid/inputs.go +++ b/revid/inputs.go @@ -188,6 +188,7 @@ func (r *Revid) startRTSPCamera() (func() error, error) { err := gvctrl.Set( r.config.CameraIP, + gvctrl.Channel(r.config.CameraChan), gvctrl.CodecOut( map[uint8]gvctrl.Codec{ codecutil.H264: gvctrl.CodecH264, diff --git a/revid/revid.go b/revid/revid.go index 1d9736a1..8214446d 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -645,6 +645,13 @@ func (r *Revid) Update(vars map[string]string) error { break } r.config.VBRBitrate = v + case "CameraChan": + v, err := strconv.Atoi(value) + if err != nil || (v != 1 && v != 2) { + r.config.Logger.Log(logger.Warning, pkg+"invalid CameraChan var", "value", value) + break + } + r.config.CameraChan = v } } r.config.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.config))