Added ffmpeg check in VideoWriter
This commit is contained in:
parent
c03552383a
commit
b647a774cd
3 changed files with 6 additions and 2 deletions
|
@ -63,6 +63,7 @@ func getCameraData(device string, camera *Camera) {
|
||||||
"-i", device,
|
"-i", device,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
camera.cmd = cmd
|
||||||
pipe, err := cmd.StderrPipe()
|
pipe, err := cmd.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
4
utils.go
4
utils.go
|
@ -91,13 +91,13 @@ func parseDevices(buffer []byte) []string {
|
||||||
devices := make([]string, 0)
|
devices := make([]string, 0)
|
||||||
bufferstr := string(buffer)
|
bufferstr := string(buffer)
|
||||||
|
|
||||||
index := strings.Index(bufferstr, "DirectShow video devices")
|
index := strings.Index(bufferstr, "DirectShow video device")
|
||||||
if index == -1 {
|
if index == -1 {
|
||||||
return devices
|
return devices
|
||||||
}
|
}
|
||||||
bufferstr = bufferstr[index:]
|
bufferstr = bufferstr[index:]
|
||||||
|
|
||||||
index = strings.Index(bufferstr, "DirectShow audio devices")
|
index = strings.Index(bufferstr, "DirectShow audio device")
|
||||||
if index != -1 {
|
if index != -1 {
|
||||||
bufferstr = bufferstr[:index]
|
bufferstr = bufferstr[:index]
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ type Options struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewVideoWriter(filename string, width, height int, options *Options) *VideoWriter {
|
func NewVideoWriter(filename string, width, height int, options *Options) *VideoWriter {
|
||||||
|
// Check if ffmpeg is installed on the users machine.
|
||||||
|
checkExists("ffmpeg")
|
||||||
|
|
||||||
writer := VideoWriter{filename: filename}
|
writer := VideoWriter{filename: filename}
|
||||||
|
|
||||||
writer.width = width
|
writer.width = width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue