mirror of https://bitbucket.org/ausocean/av.git
revid: fixed raspivid args and logging
This commit is contained in:
parent
c4d0f2ccbc
commit
d17f7c87e9
|
@ -36,6 +36,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/rtmp"
|
"bitbucket.org/ausocean/av/rtmp"
|
||||||
|
@ -421,39 +422,32 @@ func (r *Revid) startRaspivid() error {
|
||||||
r.config.Logger.Log(smartlogger.Info, "Starting raspivid!")
|
r.config.Logger.Log(smartlogger.Info, "Starting raspivid!")
|
||||||
switch r.config.InputCodec {
|
switch r.config.InputCodec {
|
||||||
case H264:
|
case H264:
|
||||||
// FIXME(saxon): consider using a map right from the start to store
|
args := []string{
|
||||||
// the raspivid args
|
"-cd", "H264",
|
||||||
raspiArgs := make(map[string]string)
|
"-o", "-",
|
||||||
raspiArgs["-cd"] = "H264"
|
"-n",
|
||||||
raspiArgs["-o"] = "-"
|
"-t", runContinuously,
|
||||||
raspiArgs["-n"] = ""
|
"-b", r.config.Bitrate,
|
||||||
raspiArgs["-t"] = runContinuously
|
"-w", r.config.Width,
|
||||||
raspiArgs["-b"] = r.config.Bitrate
|
"-h", r.config.Height,
|
||||||
raspiArgs["-w"] = r.config.Width
|
"-fps", r.config.FrameRate,
|
||||||
raspiArgs["-h"] = r.config.Height
|
"-ih",
|
||||||
raspiArgs["-fps"] = r.config.FrameRate
|
"-g", r.config.IntraRefreshPeriod,
|
||||||
raspiArgs["-ih"] = ""
|
}
|
||||||
raspiArgs["-g"] = r.config.IntraRefreshPeriod
|
|
||||||
|
|
||||||
if r.config.QuantizationMode == QuantizationOn {
|
if r.config.QuantizationMode == QuantizationOn {
|
||||||
raspiArgs["-qp"] = r.config.Quantization
|
args = append(args, "-qp", r.config.Quantization)
|
||||||
}
|
}
|
||||||
if r.config.HorizontalFlip == Yes {
|
if r.config.HorizontalFlip == Yes {
|
||||||
raspiArgs["-hf"] = strconv.Itoa(int(r.config.HorizontalFlip))
|
args = append(args, "-hf")
|
||||||
}
|
}
|
||||||
if r.config.VerticalFlip == Yes {
|
if r.config.VerticalFlip == Yes {
|
||||||
raspiArgs["-vf"] = strconv.Itoa(int(r.config.VerticalFlip))
|
args = append(args, "-vf")
|
||||||
}
|
}
|
||||||
// Log all the args and create []string
|
// Log all the args and create []string
|
||||||
args := make([]string, 0)
|
argsStr := strings.Join(args, " ")
|
||||||
for i := range raspiArgs {
|
r.config.Logger.Log(smartlogger.Info, "Raspivid args", "raspividArgs", argsStr)
|
||||||
r.config.Logger.Log(smartlogger.Info, "Raspivid arg", i, raspiArgs[i])
|
r.cmd = exec.Command("raspivid", argsStr)
|
||||||
// First append the flag
|
|
||||||
args = append(args, i)
|
|
||||||
// and now append any values for the flag
|
|
||||||
args = append(args, raspiArgs[i])
|
|
||||||
}
|
|
||||||
r.cmd = exec.Command("raspivid", args...)
|
|
||||||
|
|
||||||
case Mjpeg:
|
case Mjpeg:
|
||||||
// FIXME(saxon): do above in this case too
|
// FIXME(saxon): do above in this case too
|
||||||
|
|
Loading…
Reference in New Issue