diff --git a/device/geovision/geovision.go b/device/geovision/geovision.go index 10a82813..6f2a262a 100644 --- a/device/geovision/geovision.go +++ b/device/geovision/geovision.go @@ -171,7 +171,7 @@ func (g *GeoVision) Set(c avconfig.Config) error { ), gvconfig.Height(int(g.cfg.Height)), gvconfig.FrameRate(int(g.cfg.FrameRate)), - gvconfig.VariableBitrate(g.cfg.VBR), + gvconfig.VariableBitrate(!g.cfg.CBR), gvconfig.VBRQuality( map[avconfig.Quality]gvconfig.Quality{ avconfig.QualityStandard: gvconfig.QualityStandard, diff --git a/device/raspivid/raspivid.go b/device/raspivid/raspivid.go index baf1a148..0e533420 100644 --- a/device/raspivid/raspivid.go +++ b/device/raspivid/raspivid.go @@ -152,18 +152,18 @@ func (r *Raspivid) Set(c config.Config) error { errs = append(errs, errBadFrameRate) } - if c.VBR { - c.Bitrate = 0 - if c.Quantization < 10 || c.Quantization > 40 { - errs = append(errs, errBadQuantization) - c.Quantization = defaultRaspividQuantization - } - } else { + if c.CBR || containsUint8(config.OutputHTTP, c.Outputs) { c.Quantization = 0 if c.Bitrate <= 0 { errs = append(errs, errBadBitrate) c.Bitrate = defaultRaspividBitrate } + } else { + c.Bitrate = 0 + if c.Quantization < 10 || c.Quantization > 40 { + errs = append(errs, errBadQuantization) + c.Quantization = defaultRaspividQuantization + } } if c.MinFrames <= 0 { @@ -235,7 +235,7 @@ func (r *Raspivid) Start() error { "--inline", "--intra", fmt.Sprint(r.cfg.MinFrames), ) - if r.cfg.VBR { + if !r.cfg.CBR { args = append(args, "-qp", fmt.Sprint(r.cfg.Quantization)) } case codecutil.MJPEG: diff --git a/revid/config/config.go b/revid/config/config.go index 1448c9ef..a2ab47c6 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -178,13 +178,13 @@ type Config struct { // defined in /etc/netsender.conf. HTTPAddress string - // VBR indicates whether we wish to use constant or variable bitrate. If VBR - // is true then we will use variable bitrate, and constant bitrate otherwise. + // CBR indicates whether we wish to use constant or variable bitrate. If CBR + // is true then we will use constant bitrate, and variable bitrate otherwise. // In the case of the Pi camera, variable bitrate quality is controlled by // the Quantization parameter below. In the case of the GeoVision camera, // variable bitrate quality is controlled by firstly the VBRQuality parameter // and second the VBRBitrate parameter. - VBR bool + CBR bool // Quantization defines the quantization level, which will determine variable // bitrate quality in the case of input from the Pi Camera. diff --git a/revid/revid.go b/revid/revid.go index 146eaffb..786b75f5 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -656,13 +656,13 @@ func (r *Revid) Update(vars map[string]string) error { break } r.cfg.MTSRBWriteTimeout = v - case "VBR": + case "CBR": v, ok := map[string]bool{"true": true, "false": false}[strings.ToLower(value)] if !ok { - r.cfg.Logger.Log(logger.Warning, pkg+"invalid VBR var", "value", value) + r.cfg.Logger.Log(logger.Warning, pkg+"invalid CBR var", "value", value) break } - r.cfg.VBR = v + r.cfg.CBR = v case "VBRQuality": v, ok := map[string]config.Quality{"standard": config.QualityStandard, "fair": config.QualityFair, "good": config.QualityGood, "great": config.QualityGreat, "excellent": config.QualityExcellent}[strings.ToLower(value)] if !ok {