-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Pass cv::VideoCaptureProperties to VideoReader FFmpeg source #3139
Pass cv::VideoCaptureProperties to VideoReader FFmpeg source #3139
Conversation
…luding checks to ensure codec used in input video file is supported on the current device.
…o update_nvcuvid_codecs
# Conflicts: # modules/cudacodec/include/opencv2/cudacodec.hpp # modules/cudacodec/src/video_decoder.cpp
…zation. Include test for VideoReader but not for VideoCapture, assume pass through successful. Use propertyId instead of c++ keyword property. Remove unecessary error checks (parsers error is dependant on source) and output more informative exception.
…sed and initialization fails and add test for this.
@return Value for the specified property. Value 0 is returned when querying a property that is | ||
not supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value 0 is returned when querying a property that is not supported.
BTW, Zero is not a good "non-supported" value due to conflict with regular values of supported properties. It would be changed in the future somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed both get methods to return the status to avoid magic numbers.
@@ -176,6 +178,16 @@ void cv::cudacodec::detail::FFmpegVideoSource::updateFormat(const FormatInfo& vi | |||
format_.valid = true; | |||
} | |||
|
|||
double cv::cudacodec::detail::FFmpegVideoSource::get(const int propId) const | |||
{ | |||
if (videoCaptureParams.size() % 2 != 0) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CV_Assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it should have failed earlier if true.
…ith VideoCapture::get Fix documentation.
*/ | ||
CV_WRAP virtual int get(const VideoReaderProps propertyId, const int propertyVal = -1) const = 0; | ||
CV_WRAP virtual bool get(const VideoReaderProps propertyId, double& propertyValOut, const int propertyVal = -1) const = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CV_WRAP
It needs to add CV_OUT specifier:
CV_OUT double& propertyValOut
const int propertyVal = -1
Perhaps we don't need this anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Allow initialization properties
CAP_PROP_OPEN_TIMEOUT_MSEC
,CAP_PROP_READ_TIMEOUT_MSEC
etc. to be passed to the FFmpeg backend which is used bycv::cudacodec::VideoReader
.See #3138
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.