From 70802022bb80a5754981b6898069fbefb6331d77 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 4 Dec 2019 11:40:12 +1030 Subject: [PATCH] revid/revid.go MPEG lexer enabled and encoder options set for v4l --- revid/revid.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 786b75f5..d0bc73f3 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -191,7 +191,15 @@ func (r *Revid) reset(c config.Config) error { panic("unknown input codec for raspivid input") } case config.InputFile, config.InputV4L: - st = mts.EncodeH264 + switch r.cfg.InputCodec { + case codecutil.H264: + st = mts.EncodeH264 + case codecutil.MJPEG: + st = mts.EncodeMJPEG + encOptions = append(encOptions, mts.PacketBasedPSI(int(r.cfg.MinFrames))) + default: + panic("unknown input codec for v4l or input file input") + } case config.InputRTSP: switch r.cfg.InputCodec { case codecutil.H265: @@ -329,7 +337,12 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io. case config.InputV4L: r.input = webcam.New(r.cfg.Logger) - r.lexTo = h264.Lex + switch r.cfg.InputCodec { + case codecutil.H264: + r.lexTo = h264.Lex + case codecutil.MJPEG: + r.lexTo = mjpeg.Lex + } case config.InputFile: r.input = file.New()