gocv
gocv copied to clipboard
VideoCaptureFPS Does not work
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
orenv.cmd
script before trying togo run
orgo build
? N
after search by google, I have got this: https://stackoverflow.com/questions/52068277/change-frame-rate-in-opencv-3-4-2
this may help us https://github.com/hybridgroup/gocv/blob/release/videoio.go#L379
You should use webca.Grab(webcam.Get(gocv.VideoCaptureFPS) - yourFps)
to skip frames before calling webcam.Read()