mirror of https://bitbucket.org/ausocean/av.git
revid: defaulting to VBR for camera devices
Easiest way to do this is change VBR config field to CBR (therefore CBR defaults to false without having to do anything).
This commit is contained in:
parent
f7fb7d0a42
commit
a6797a929d
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue