| | |
| | | gb := false |
| | | if m == GB28181 { |
| | | gb = true |
| | | } else { |
| | | } else if m != Rtsp { |
| | | return nil, errors.New("there is no this mode, try capture.Rtsp/capture.GB28181") |
| | | } |
| | | |
| | |
| | | Width: w, |
| | | Height: h, |
| | | GB: gb, |
| | | CPU: false, |
| | | CPU: true, |
| | | } |
| | | gf := goffmpeg.New(conf) |
| | | |
| | |
| | | var err2 error |
| | | for { |
| | | |
| | | data, wid, hei := gf.GetPicDecoder() |
| | | data, wid, hei, _ := gf.GetPicDecoder() |
| | | if wid > 0 && hei > 0 { |
| | | img, err := gocv.NewMatFromBytes(hei, wid, gocv.MatTypeCV8UC3, data) |
| | | if err != nil { |
| | |
| | | time.Sleep(time.Second) |
| | | } |
| | | } |
| | | gf.Free() |
| | | |
| | | if tryTime > maxTry { |
| | | err := fmt.Sprintf("try %d times to capture image, is url correct?\n", tryTime) |