Skip to content

Commit d16b2ac

Browse files
committed
Better logging for gocv-receive
Print ffmpeg stderr
1 parent b5d27eb commit d16b2ac

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gocv-receive/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package main
44

55
import (
6+
"bufio"
67
"fmt"
78
"image"
89
"image/color"
@@ -29,11 +30,19 @@ func main() {
2930
ffmpeg := exec.Command("ffmpeg", "-i", "pipe:0", "-pix_fmt", "bgr24", "-s", strconv.Itoa(frameX)+"x"+strconv.Itoa(frameY), "-f", "rawvideo", "pipe:1") //nolint
3031
ffmpegIn, _ := ffmpeg.StdinPipe()
3132
ffmpegOut, _ := ffmpeg.StdoutPipe()
33+
ffmpegErr, _ := ffmpeg.StderrPipe()
3234

3335
if err := ffmpeg.Start(); err != nil {
3436
panic(err)
3537
}
3638

39+
go func() {
40+
scanner := bufio.NewScanner(ffmpegErr)
41+
for scanner.Scan() {
42+
fmt.Println(scanner.Text())
43+
}
44+
}()
45+
3746
createWebRTCConn(ffmpegIn)
3847
startGoCVMotionDetect(ffmpegOut)
3948
}

0 commit comments

Comments
 (0)