mirror of https://bitbucket.org/ausocean/av.git
revid/config.go: MinPeriod => MinFrames
This commit is contained in:
parent
e57e14678a
commit
a8081b52b2
|
@ -109,7 +109,7 @@ const (
|
|||
defaultRotation = 0 // Degrees
|
||||
defaultWidth = 1280
|
||||
defaultHeight = 720
|
||||
defaultMinPeriod = 100
|
||||
defaultMinFrames = 100
|
||||
defaultClipDuration = 0
|
||||
defaultQuantization = 30
|
||||
defaultBitrate = 400000
|
||||
|
@ -204,14 +204,14 @@ type Config struct {
|
|||
// are using Raspivid input.
|
||||
Quantization uint
|
||||
|
||||
// MinPeriod defines the frequency of key NAL units SPS, PPS and IDR in
|
||||
// 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 MinPeriod,
|
||||
// ClipDuration will default to MinPeriod.
|
||||
MinPeriod uint
|
||||
// output container is MPEG-TS. If ClipDuration is less than MinFrames,
|
||||
// ClipDuration will default to MinFrames.
|
||||
MinFrames uint
|
||||
|
||||
// ClipDuration is the duration of MTS data that is sent using HTTP or RTP
|
||||
// output. This defaults to 0, therefore MinPeriod will determine the length of
|
||||
// output. This defaults to 0, therefore MinFrames will determine the length of
|
||||
// clips by default.
|
||||
ClipDuration time.Duration
|
||||
|
||||
|
@ -392,10 +392,10 @@ func (c *Config) Validate() error {
|
|||
return errors.New("invalid bitrate")
|
||||
}
|
||||
|
||||
if c.MinPeriod == 0 {
|
||||
c.Logger.Log(logger.Info, pkg+"no min period defined, defaulting", "MinPeriod", defaultMinPeriod)
|
||||
c.MinPeriod = defaultMinPeriod
|
||||
} else if c.MinPeriod < 0 {
|
||||
if c.MinFrames == 0 {
|
||||
c.Logger.Log(logger.Info, pkg+"no min period defined, defaulting", "MinFrames", defaultMinFrames)
|
||||
c.MinFrames = defaultMinFrames
|
||||
} else if c.MinFrames < 0 {
|
||||
return errors.New("refresh period is less than 0")
|
||||
}
|
||||
|
||||
|
|
|
@ -456,13 +456,13 @@ func (r *Revid) Update(vars map[string]string) error {
|
|||
break
|
||||
}
|
||||
r.config.Quantization = uint(v)
|
||||
case "MinPeriod":
|
||||
case "MinFrames":
|
||||
v, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
r.config.Logger.Log(logger.Warning, pkg+"invalid MinPeriod param", "value", value)
|
||||
r.config.Logger.Log(logger.Warning, pkg+"invalid MinFrames param", "value", value)
|
||||
break
|
||||
}
|
||||
r.config.MinPeriod = uint(v)
|
||||
r.config.MinFrames = uint(v)
|
||||
|
||||
case "ClipDuration":
|
||||
v, err := strconv.Atoi(value)
|
||||
|
@ -585,7 +585,7 @@ func (r *Revid) startRaspivid() (func() error, error) {
|
|||
args = append(args,
|
||||
"--codec", "H264",
|
||||
"--inline",
|
||||
"--intra", fmt.Sprint(r.config.MinPeriod),
|
||||
"--intra", fmt.Sprint(r.config.MinFrames),
|
||||
)
|
||||
if r.config.Quantization != 0 {
|
||||
args = append(args, "-qp", fmt.Sprint(r.config.Quantization))
|
||||
|
|
Loading…
Reference in New Issue