mirror of https://bitbucket.org/ausocean/av.git
Revid CLI accepts MJPEG as an input codec
The ffmpeg command uses the input codec value (H264 or mjpeg). However, it does not yet capture in mjpeg correctly.
This commit is contained in:
parent
ec0e19aec3
commit
d5191d9daf
|
@ -202,6 +202,8 @@ func handleFlags() config.Config {
|
|||
cfg.InputCodec = codecutil.PCM
|
||||
case "ADPCM":
|
||||
cfg.InputCodec = codecutil.ADPCM
|
||||
case "MJPEG":
|
||||
cfg.InputCodec = codecutil.MJPEG
|
||||
default:
|
||||
log.Log(logger.Error, pkg+"bad input codec argument")
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"bitbucket.org/ausocean/av/codec/codecutil"
|
||||
"bitbucket.org/ausocean/av/device"
|
||||
"bitbucket.org/ausocean/av/revid/config"
|
||||
"bitbucket.org/ausocean/utils/logger"
|
||||
|
@ -115,10 +116,22 @@ func (w *Webcam) Set(c config.Config) error {
|
|||
func (w *Webcam) Start() error {
|
||||
args := []string{
|
||||
"-i", w.cfg.InputPath,
|
||||
"-f", "h264",
|
||||
"-r", fmt.Sprint(w.cfg.FrameRate),
|
||||
}
|
||||
|
||||
switch w.cfg.InputCodec {
|
||||
default:
|
||||
return fmt.Errorf("revid: invalid input codec: %v", w.cfg.InputCodec)
|
||||
case codecutil.H264:
|
||||
args = append(args,
|
||||
"-f", "h264",
|
||||
)
|
||||
case codecutil.MJPEG:
|
||||
args = append(args,
|
||||
"-f", "mjpeg",
|
||||
)
|
||||
}
|
||||
|
||||
br := w.cfg.Bitrate * 1000
|
||||
args = append(args,
|
||||
"-b:v", fmt.Sprint(br),
|
||||
|
@ -129,6 +142,7 @@ func (w *Webcam) Start() error {
|
|||
)
|
||||
|
||||
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