mirror of https://bitbucket.org/ausocean/av.git
Ffmpeg gets different args for mjpeg encoding
This commit is contained in:
parent
d5191d9daf
commit
48d36c2082
|
@ -114,9 +114,13 @@ func (w *Webcam) Set(c config.Config) error {
|
|||
// Start will build the required arguments for ffmpeg and then execute the
|
||||
// command, piping video output where we can read using the Read method.
|
||||
func (w *Webcam) Start() error {
|
||||
br := w.cfg.Bitrate * 1000
|
||||
|
||||
args := []string{
|
||||
"-i", w.cfg.InputPath,
|
||||
"-r", fmt.Sprint(w.cfg.FrameRate),
|
||||
"-b:v", fmt.Sprint(br),
|
||||
"-s", fmt.Sprintf("%dx%d", w.cfg.Width, w.cfg.Height),
|
||||
}
|
||||
|
||||
switch w.cfg.InputCodec {
|
||||
|
@ -125,6 +129,8 @@ func (w *Webcam) Start() error {
|
|||
case codecutil.H264:
|
||||
args = append(args,
|
||||
"-f", "h264",
|
||||
"-maxrate", fmt.Sprint(br),
|
||||
"-bufsize", fmt.Sprint(br/2),
|
||||
)
|
||||
case codecutil.MJPEG:
|
||||
args = append(args,
|
||||
|
@ -132,17 +138,11 @@ func (w *Webcam) Start() error {
|
|||
)
|
||||
}
|
||||
|
||||
br := w.cfg.Bitrate * 1000
|
||||
args = append(args,
|
||||
"-b:v", fmt.Sprint(br),
|
||||
"-maxrate", fmt.Sprint(br),
|
||||
"-bufsize", fmt.Sprint(br/2),
|
||||
"-s", fmt.Sprintf("%dx%d", w.cfg.Width, w.cfg.Height),
|
||||
"-",
|
||||
)
|
||||
|
||||
w.log.Log(logger.Info, pkg+"ffmpeg args", "args", strings.Join(args, " "))
|
||||
fmt.Printf("%v", args) // !!!!
|
||||
w.cmd = exec.Command("ffmpeg", args...)
|
||||
|
||||
var err error
|
||||
|
|
Loading…
Reference in New Issue