mirror of https://bitbucket.org/ausocean/av.git
Got a RevidCLI written, just need to test
This commit is contained in:
parent
4ae6919cae
commit
6f82735ab2
|
@ -41,7 +41,6 @@ type Config struct {
|
||||||
Input uint8
|
Input uint8
|
||||||
InputCodec uint8
|
InputCodec uint8
|
||||||
Output uint8
|
Output uint8
|
||||||
RtmpEncodingMethod uint8
|
|
||||||
RtmpMethod uint8
|
RtmpMethod uint8
|
||||||
Packetization uint8
|
Packetization uint8
|
||||||
QuantizationMode uint8
|
QuantizationMode uint8
|
||||||
|
@ -187,7 +186,7 @@ func (config *Config) Validate(r *revidInst) error {
|
||||||
case Ffmpeg:
|
case Ffmpeg:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
r.Log(Warning, "No RTMP encoding method defined, defautling to ffmpeg!")
|
r.Log(Warning, "No RTMP encoding method defined, defautling to ffmpeg!")
|
||||||
config.RtmpEncodingMethod = Ffmpeg
|
config.RtmpMethod = Ffmpeg
|
||||||
default:
|
default:
|
||||||
return errors.New("Bad rtmp method defined in config!")
|
return errors.New("Bad rtmp method defined in config!")
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
inputPtr = 0
|
||||||
|
inputCodecPtr = 1
|
||||||
|
outputPtr = 2
|
||||||
|
rtmpMethodPtr = 3
|
||||||
|
packetisationPtr = 4
|
||||||
|
quantizationModePtr = 5
|
||||||
|
verbosityPtr = 6
|
||||||
|
framesPerClipPrt = 7
|
||||||
|
rtmpUrlPtr = 8
|
||||||
|
bitratePtr = 9
|
||||||
|
outputFileNamePtr = 10
|
||||||
|
inputFileNamePtr = 11
|
||||||
|
heightPtr = 12
|
||||||
|
widthPtr = 13
|
||||||
|
frameRatePtr = 14
|
||||||
|
httpAddressPtr = 15
|
||||||
|
quantizationPtr = 18
|
||||||
|
timeoutPtr = 19
|
||||||
|
intraRefreshPeriodPtr = 20
|
||||||
|
sleepTime = 2 * 43200
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flagNames := [19][2]string{
|
||||||
|
{"Input", "The input type"},
|
||||||
|
{"InputCodec", "The codec of the input"},
|
||||||
|
{"Output", "The output type"},
|
||||||
|
{"RtmpMethod", "The method used to send over rtmp (ffmpeg or librtmp)"},
|
||||||
|
{"Packetization", "The method of data packetisation"},
|
||||||
|
{"QuantizationMode", "The level of quantization"},
|
||||||
|
{"Verbosity", "Verbosity on or off"},
|
||||||
|
{"FramesPerClip", "Number of frames per clip sent"},
|
||||||
|
{"RtmpUrl", "Url of rtmp endpoint"},
|
||||||
|
{"Bitrate", "Bitrate of recorded video"},
|
||||||
|
{"OutputFileName", "The directory of the output file"},
|
||||||
|
{"InputFileName", "The directory of the input file"},
|
||||||
|
{"Height", "Height in pixels"},
|
||||||
|
{"Width", "Width in pixels"},
|
||||||
|
{"FrameRate", "Frame rate of captured video"},
|
||||||
|
{"HttpAddress", "Destination address of http posts"},
|
||||||
|
{"Quantization", "Desired quantization value"},
|
||||||
|
{"Timeout", "Http timeout in seconds"},
|
||||||
|
{"IntraRefreshPeriod", "The IntraRefreshPeriod i.e. how many keyframes we send"},
|
||||||
|
}
|
||||||
|
|
||||||
|
var flags [20](*string)
|
||||||
|
for i := 0; i < 20; i++ {
|
||||||
|
flags[i] = flag.String(flagNames[i][0], "", flagNames[i][1])
|
||||||
|
}
|
||||||
|
|
||||||
|
flag.Parse()
|
||||||
|
config := Config{}
|
||||||
|
|
||||||
|
switch flags[inputPtr] {
|
||||||
|
case "Raspivid":
|
||||||
|
config.Input = Raspivid
|
||||||
|
case "Rtp":
|
||||||
|
config.Input = Rtp
|
||||||
|
case "File":
|
||||||
|
config.Input = File
|
||||||
|
}
|
||||||
|
|
||||||
|
switch flags[inputCodecPtr] {
|
||||||
|
case "H264Codec":
|
||||||
|
config.InputCodec = H264Codec
|
||||||
|
}
|
||||||
|
|
||||||
|
switch flags[outputPtr] {
|
||||||
|
case "File":
|
||||||
|
config.Output = File
|
||||||
|
case "Http":
|
||||||
|
config.Output = Http
|
||||||
|
case "Rtmp":
|
||||||
|
config.Output = Rtmp
|
||||||
|
}
|
||||||
|
|
||||||
|
switch flags[rtmpMethodPtr] {
|
||||||
|
case "Ffmpeg":
|
||||||
|
config.RtmpMethod = Ffmpeg
|
||||||
|
case "LibRtmp":
|
||||||
|
config.RtmpMethod = LibRtmp
|
||||||
|
}
|
||||||
|
|
||||||
|
switch flags[packetisationPtr] {
|
||||||
|
case "None":
|
||||||
|
config.Packetisation = None
|
||||||
|
case "Rtp":
|
||||||
|
config.Packetisation = Rtp
|
||||||
|
case "Flv":
|
||||||
|
config.Packetisation = Flv
|
||||||
|
}
|
||||||
|
|
||||||
|
switch flags[quantisationModePtr] {
|
||||||
|
case "QuantizationOn":
|
||||||
|
config.Quantization = QuantizationOn
|
||||||
|
case "QuantizationOff":
|
||||||
|
config.Quantization = QuantizationOff
|
||||||
|
}
|
||||||
|
|
||||||
|
switch flags[verbosityPtr] {
|
||||||
|
case "No":
|
||||||
|
config.Verbosity = No
|
||||||
|
case "Yes":
|
||||||
|
config.Verbosity = Yes
|
||||||
|
}
|
||||||
|
|
||||||
|
config.FramesPerClip = flags[framesPerClipPtr]
|
||||||
|
config.RtmpUrl = flags[rtmpUrlPtr]
|
||||||
|
config.Bitrate = flags[bitratePtr]
|
||||||
|
config.OutputFileName = flags[outputFileNamePtr]
|
||||||
|
config.InputFileName = flags[inputFileNamePtr]
|
||||||
|
config.Height = flags[heightPtr]
|
||||||
|
config.Width = flags[widthPtr]
|
||||||
|
config.FrameRate = flags[frameRatePtr]
|
||||||
|
config.HttpAddress = flags[httpAddressPtr]
|
||||||
|
config.Quantization = flags[quantisationPtr]
|
||||||
|
config.Timeout = flags[timeoutPtr]
|
||||||
|
config.IntraRefreshPeriod = flags[intraRefreshPeriodPtr]
|
||||||
|
|
||||||
|
revidInst, err := NewRevidInstance(config)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
revidInst.Start()
|
||||||
|
time.Sleep(sleepTime * time.Second)
|
||||||
|
revidInst.Stop()
|
||||||
|
}
|
Loading…
Reference in New Issue