-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VideoWriter's frame rate rounding error #9023
Comments
Hello everyone, I think that I've found the issue around this. On the ffmpeg wrapper there is a small typo in the frame rate rounding. You can find two instances of this in: https://github.com/opencv/opencv/blob/master/modules/videoio/src/cap_ffmpeg_impl.hpp#L1544 and https://github.com/opencv/opencv/blob/master/modules/videoio/src/cap_ffmpeg_impl.hpp#L2377 Before while (fabs((double)frame_rate/frame_rate_base) - fps > 0.001){ After while (fabs(((double)frame_rate/frame_rate_base) - fps) > 0.001){ Using I have trouble testing this on my computer (windows based) because the wrapper is pre-built as a 3rd party component and the build instructions are not that clear on that part. That's why I'm not creating a PR already. Tell me if I can help. |
@WydD Nice catch! Feel free to open PR onto 3.4 branch. It will be tested on OpenCV CI. |
@alalek Thanks for the quick reply. The PR has been created. |
* master: (48 commits) Merge pull request opencv#12649 from sturkmen72:patch-9 ocl: OPENCV_OPENCL_BUILD_EXTRA_OPTIONS parameter Added support for multi-path configuration parameter (env) Fix documentation of cv::cuda::compare dnn(ocl4dnn): drop weights_buf Fix frame rate rounding in ffmpeg wrapper (opencv#9023) 3rdparty/protobuf: fix compilation issue on s390 document imread grayscale behaviour Merge pull request opencv#12667 from cv3d:fix/ts_report Utilize the currently running Python executable fix test failure of cudev * follow the implementation of Luv2RGBfloat in imgproc/src/color_lab.cpp * loosen threshold in cudaimgproc fix typo in FpsMeter.java Fix Python wrapper for GpuMat CUDA: drop OPENCV_TRAITS_ENABLE_DEPRECATED requirement Merge pull request opencv#12658 from chacha21:clr-mutex Update findContours parameter type Merge pull request opencv#12674 from dmatveev:gapi_upd270918 Fix Xcode version parsing error (affects bitcode generation) Merge pull request opencv#12673 from alalek:fix_build_warnings JavaScript bindings for features2d module ...
System information (version)
Detailed description
For the frame rate of the videoWriter, it's supposed to accept a double/float, but it only works when the digit right after the decimal point is larger or equal than 5, otherwise it will be rounded to an integer(For example it works for 25.5 but it will round to 25 when you pass in 25.4).
Here is two examples which I basically just record a 50 frames videos from the camera and output the frame rate of the recorded videos to demonstrate the issue:
Output: 25.6
Output: 25.0
The text was updated successfully, but these errors were encountered: