revid: adding audio config parameters

This commit is contained in:
Trek H 2019-04-23 19:05:47 +09:30
parent 20c9e6c409
commit c51e0ec168
3 changed files with 36 additions and 31 deletions
cmd/revid-cli
revid

View File

@ -255,6 +255,7 @@ func handleFlags() revid.Config {
cfg.Height = *heightPtr
cfg.Width = *widthPtr
cfg.FrameRate = *frameRatePtr
cfg.SampleRate = *sampleRatePtr
cfg.HttpAddress = *httpAddressPtr
cfg.Quantization = *quantizationPtr
cfg.IntraRefreshPeriod = *intraRefreshPeriodPtr

View File

@ -36,46 +36,50 @@ import (
// Config provides parameters relevant to a revid instance. A new config must
// be passed to the constructor.
type Config struct {
Logger Logger
LogLevel int8
Input uint8
InputCodec uint8
Outputs []uint8
RtmpMethod uint8
Packetization uint8
// Quantize specifies whether the input to
// revid will have constant or variable
// bitrate.
Quantize bool
// FlipHorizonatla and FlipVertical specify
// whether video frames should be flipped.
FlipHorizontal bool
FlipVertical bool
FramesPerClip uint
// IO
Input uint8
InputCodec uint8
Outputs []uint8
RtmpMethod uint8
Packetization uint8
Quantize bool // Determines whether input to revid will have constant or variable bitrate.
RtmpUrl string
Bitrate uint
OutputPath string
InputPath string
Height uint
Width uint
FrameRate uint
SampleRate uint
Rate float64
HttpAddress string
Quantization uint
IntraRefreshPeriod uint
RtpAddress string
Logger Logger
SendRetry bool
BurstPeriod uint
Rotation uint
Brightness uint
Saturation int
Exposure string
AutoWhiteBalance string
WriteRate float64 // How many times a second revid encoders will be written to.
// Video
Height uint
Width uint
FrameRate uint
FramesPerClip uint
BurstPeriod uint
// Transformation
FlipHorizontal bool
FlipVertical bool
Rotation uint
// Color correction
Brightness uint
Saturation int
Exposure string
AutoWhiteBalance string
// Audio
SampleRate uint // Frame rate in Hz.
Period int // How many seconds to record at a time.
Channels int // Number of audio channels, 1 for mono, 2 for stereo.
BitDepth int // Sample bit depth, 16-bit by default.
}
// Possible modes for raspivid --exposure parameter.
@ -144,7 +148,7 @@ const (
defaultPacketization = Flv
defaultFrameRate = 25
defaultSampleRate = 48000
defaultRate = 25
defaultWriteRate = 25
defaultWidth = 1280
defaultHeight = 720
defaultIntraRefreshPeriod = 100

View File

@ -676,7 +676,7 @@ func (r *Revid) setupInputForFile() error {
// startAudioInput is used to start capturing audio from an audio device and processing it.
func (r *Revid) startAudioInput() error {
ai := NewAudioInput(audioParams)
ai := NewAudioInput()
go r.processFrom(ai, time.Second/time.Duration(r.config.Rate))
return nil