Closed GoogleCodeExporter closed 8 years ago
This should actually not be marked as a defect (as it just follow the get/set
pattern), but as an enhancement (I don't know how to reclassify the bug once
created).
Original comment by adle...@gmail.com
on 9 Mar 2013 at 11:29
Let's look at FFmpegFrameGrabber.getFrameRate():
@Override public double getFrameRate() {
if (video_st == null) {
return super.getFrameRate();
} else {
AVRational r = video_st.r_frame_rate();
return (double)r.num() / r.den();
}
}
and OpenCVFrameGrabber.getFrameRate():
@Override public double getFrameRate() {
return capture == null ? super.getFrameRate() : (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
}
Should they be doing anything differently?
Original comment by samuel.a...@gmail.com
on 10 Mar 2013 at 1:23
There is something strange somewhere. If I specify some huge number for the
framerate, like 1250, I get the message:
The driver changed the time per frame from 1/1250 to 1/226
And getFrameRate() returns 226. However, this webcam in this mode only supports
125 fps (which are the ones I actually am getting).
If I specify a lower value, like 200, getFrameRate() just returns 200.
May there be a different way to retrieve that framerate?
For example (I don't know if it really applies):
http://libav-users.943685.n4.nabble.com/Retrieving-Frames-Per-Second-FPS-td94653
3.html
Original comment by adle...@gmail.com
on 10 Mar 2013 at 1:55
Well the best would be to check what the ffmpeg program does, and if that does
what you need, then to implement something similar in
FFmpegFrameGrabber.getFrameRate()...
Original comment by samuel.a...@gmail.com
on 10 Mar 2013 at 11:22
Issue 391 has been merged into this issue.
Original comment by samuel.a...@gmail.com
on 4 Jan 2014 at 2:15
JavaCV 0.10 now returns the value of `AVStream.avg_frame_rate` instead of
`r_frame_rate`:
https://github.com/bytedeco/javacv/issues/63
I hope this fixes this issue as well. Let me know if you still have problems,
and thanks for reporting!
Original comment by samuel.a...@gmail.com
on 27 Dec 2014 at 3:19
So I had an issue with my piece of garbage foscam returning NaN with the
getFrameRate(). So I adjusted it to the following and now i'm getting an fps
for it and my other cameras. Not sure if it's the right way but it's working
for me right now.
@Override
public double getFrameRate() {
if (video_st == null) {
return super.getFrameRate();
} else {
AVRational r = video_st.avg_frame_rate();
if (Double.isNaN((double) r.num() / r.den()))
r = video_st.r_frame_rate();
return (double) r.num() / r.den();
}
}
Original comment by robert.t...@gmail.com
on 5 Aug 2015 at 2:09
Thanks! I've added the equivalent in this commit:
https://github.com/bytedeco/javacv/commit/98889d4fa3ad25d9b8a4571442b0c2e17b13c4
e4
Let me know that it works, thanks!
Original comment by samuel.a...@gmail.com
on 5 Aug 2015 at 11:20
Original issue reported on code.google.com by
adle...@gmail.com
on 9 Mar 2013 at 8:05