gocv icon indicating copy to clipboard operation
gocv copied to clipboard

VideoCaptureFPS Does not work

Open llianc7 opened this issue 2 years ago • 3 comments

When I set VideoCaptureFPS property it does do changed.

Description

I wanna change the frame rate of reading video.

Steps to Reproduce

here is my code:

package main

import (
	"log"

	"gocv.io/x/gocv"
)

func main() {

	webcam, _ := gocv.OpenVideoCapture("test.mp4")

	webcam.Set(gocv.VideoCaptureFPS, 30)
	log.Printf("video rate: %f", webcam.Get(gocv.VideoCaptureFPS))
}

output:

2021/12/07 21:05:53 video rate: 60.042750

Your Environment

  • ubuntu 20.04
  • OpenCV version used:
  • How did you install OpenCV?
  • GoCV version used:
  • Go version: go version go1.15.15 linux/amd64
  • Did you run the env.sh or env.cmd script before trying to go run or go build? N

llianc7 avatar Dec 07 '21 13:12 llianc7

after search by google, I have got this: https://stackoverflow.com/questions/52068277/change-frame-rate-in-opencv-3-4-2

wgjtyu avatar Feb 28 '22 14:02 wgjtyu

this may help us https://github.com/hybridgroup/gocv/blob/release/videoio.go#L379

wgjtyu avatar Mar 01 '22 04:03 wgjtyu

You should use webca.Grab(webcam.Get(gocv.VideoCaptureFPS) - yourFps) to skip frames before calling webcam.Read()

jiekechoo avatar Apr 04 '24 05:04 jiekechoo