Added ffmpeg check in VideoWriter

This commit is contained in:
Alex Eidt 2021-12-27 19:37:42 -08:00
parent c03552383a
commit b647a774cd
3 changed files with 6 additions and 2 deletions

View file

@ -63,6 +63,7 @@ func getCameraData(device string, camera *Camera) {
"-i", device,
)
camera.cmd = cmd
pipe, err := cmd.StderrPipe()
if err != nil {
panic(err)

View file

@ -91,13 +91,13 @@ func parseDevices(buffer []byte) []string {
devices := make([]string, 0)
bufferstr := string(buffer)
index := strings.Index(bufferstr, "DirectShow video devices")
index := strings.Index(bufferstr, "DirectShow video device")
if index == -1 {
return devices
}
bufferstr = bufferstr[index:]
index = strings.Index(bufferstr, "DirectShow audio devices")
index = strings.Index(bufferstr, "DirectShow audio device")
if index != -1 {
bufferstr = bufferstr[:index]
}

View file

@ -36,6 +36,9 @@ type Options struct {
}
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.width = width