Skip to content

feature: Extend VideoWriter to accept vector of parameters#16766

Merged
alalek merged 8 commits intoopencv:masterfrom
VadimLevin:dev/vlevin/video_writer_params_constructor
Apr 28, 2020
Merged

feature: Extend VideoWriter to accept vector of parameters#16766
alalek merged 8 commits intoopencv:masterfrom
VadimLevin:dev/vlevin/video_writer_params_constructor

Conversation

@VadimLevin
Copy link
Copy Markdown
Contributor

@VadimLevin VadimLevin commented Mar 10, 2020

  • Added additional constructor and open method for VideoWriter
    those accept a vector of parameters
  • Moved the actual implementation of the VideoWriter::open to the general method
    which accepts a vector of parameters
  • Propagate parsed parameters map up to actual video backend construction

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
build_image:Custom=centos:7
buildworker:Custom=linux-1

force_builders=Custom Win
build_image:Custom Win=msvs2019

@VadimLevin VadimLevin force-pushed the dev/vlevin/video_writer_params_constructor branch 2 times, most recently from ae035fd to 192620f Compare March 10, 2020 08:51
@asmorkalov
Copy link
Copy Markdown
Contributor

@vpisarev @alalek Can we merge the patch?

Copy link
Copy Markdown
Contributor

@vpisarev vpisarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ready to merge, I think 👍

 - Add additional constructor and `open` method for `VideoWriter`
   those accept a vector of parameters
 - Move actual implementation of the `VideoWriter::open` to general method
   which accepts vector of parameters
 - Propagate parsed parameters map up to actual video backend construction
@VadimLevin VadimLevin force-pushed the dev/vlevin/video_writer_params_constructor branch from 192620f to e9b918e Compare April 20, 2020 09:29
@VadimLevin VadimLevin force-pushed the dev/vlevin/video_writer_params_constructor branch from e9b918e to ef3a44a Compare April 20, 2020 09:57
@VadimLevin VadimLevin force-pushed the dev/vlevin/video_writer_params_constructor branch from 9abd2e2 to 7c2c8a8 Compare April 20, 2020 12:31
@VadimLevin VadimLevin requested a review from alalek April 20, 2020 13:30
@param frameSize Size of the video frames.
@param isColor If it is not zero, the encoder will expect and encode color frames, otherwise it
will work with grayscale frames (the flag is currently supported on Windows only).
will work with grayscale frames (the flag is ignored on MSMF and Intel MFX backends).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the flag is ignored

It is better to keep here common information only.
Backend-specific information should be moved on dedicated pages (there is huge amount of implementation details)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does (the flag may be ignored by some backends. For more information refer to backend implementation) sound better?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep this info in a single place (to avoid manual maintenance in different places).

See here:
https://github.com/opencv/opencv/blame/4.3.0/modules/videoio/doc/videoio_overview.markdown#L27

I believe the header of properties enumeration should be enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, got it!

@jomade
Copy link
Copy Markdown

jomade commented Sep 17, 2021

Hi!
With these changes - is it really possible to set VIDEOWRITER_PROP_IS_COLOR =0? I mean, the parameter list accepts only the "identifier" VIDEOWRITER_PROP_IS_COLOR but no value to that property. I think one should integrate a VIDEOWRITER_PROP_IS_GRAYSCALE or sth like that to be able to actually use this flag.

@alalek
Copy link
Copy Markdown
Member

alalek commented Sep 17, 2021

Enum's documentation clearly states which values are accepted.
Passed values are pairs of ints.
Also check implementation of bool VideoWriter::open on this PR's diff.

@jomade
Copy link
Copy Markdown

jomade commented Sep 17, 2021

Sorry, I didn't check the first doxygen-comment of the overloaded function. And from the API with const std::vector<int>& params it was not clear to me that this would be pairs. I would have expected sth like const std::vector<std::pair<int, int>>. Sorry for the noise.

@asmorkalov
Copy link
Copy Markdown
Contributor

@jomade The std::verctor can be easily wrapped to Python, Java and other supported language bindings. It's the main reson why, it's not vector of pair, map or other structures.

a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
…er_params_constructor

* feature: Extend VideoWriter to accept vector of parameters

 - Add additional constructor and `open` method for `VideoWriter`
   those accept a vector of parameters
 - Move actual implementation of the `VideoWriter::open` to general method
   which accepts vector of parameters
 - Propagate parsed parameters map up to actual video backend construction

* fix: Change VideoWriter constructor description to suppress doc warning

* refactor: Rollback newlines changes

* feature: Changed VideoWriter parameters workflow

* feature: Log unused parameters in VideoWriter open

* doc: Fix VideoWriter `isColor` parameter description

* fix: int to bool VC++ conversion warning

* doc: Remove information about `isColor` flag usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants