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,10 +114,14 @@ func (w *Webcam) Set(c config.Config) error {
|
||||||
// Start will build the required arguments for ffmpeg and then execute the
|
// Start will build the required arguments for ffmpeg and then execute the
|
||||||
// command, piping video output where we can read using the Read method.
|
// command, piping video output where we can read using the Read method.
|
||||||
func (w *Webcam) Start() error {
|
func (w *Webcam) Start() error {
|
||||||
|
br := w.cfg.Bitrate * 1000
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"-i", w.cfg.InputPath,
|
"-i", w.cfg.InputPath,
|
||||||
"-r", fmt.Sprint(w.cfg.FrameRate),
|
"-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 {
|
switch w.cfg.InputCodec {
|
||||||
default:
|
default:
|
||||||
|
@ -125,6 +129,8 @@ func (w *Webcam) Start() error {
|
||||||
case codecutil.H264:
|
case codecutil.H264:
|
||||||
args = append(args,
|
args = append(args,
|
||||||
"-f", "h264",
|
"-f", "h264",
|
||||||
|
"-maxrate", fmt.Sprint(br),
|
||||||
|
"-bufsize", fmt.Sprint(br/2),
|
||||||
)
|
)
|
||||||
case codecutil.MJPEG:
|
case codecutil.MJPEG:
|
||||||
args = append(args,
|
args = append(args,
|
||||||
|
@ -132,17 +138,11 @@ func (w *Webcam) Start() error {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
br := w.cfg.Bitrate * 1000
|
|
||||||
args = append(args,
|
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, " "))
|
w.log.Log(logger.Info, pkg+"ffmpeg args", "args", strings.Join(args, " "))
|
||||||
fmt.Printf("%v", args) // !!!!
|
|
||||||
w.cmd = exec.Command("ffmpeg", args...)
|
w.cmd = exec.Command("ffmpeg", args...)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in New Issue