The Wayback Machine - https://web.archive.org/web/20210205152527/https://github.com/opencv/opencv/pull/19460
Skip to content
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

videoio: HW decode/encode in FFMPEG backend; new properties with support in FFMPEG/GST/MSMF #19460

Open
wants to merge 22 commits into
base: master
from

Conversation

@mikhail-nikolskiy
Copy link

@mikhail-nikolskiy mikhail-nikolskiy commented Feb 4, 2021

Overview

  • add support for HW accelerated decode/encode in FFMPEG backend of VideoCapture and VideoWriter APIs under #ifdef check for FFMPEG version >= 3.4
  • introduce new properties CAP_PROP_HW_ACCELERATION, CAP_PROP_HW_DEVICE, VIDEOWRITER_PROP_HW_ACCELERATION, VIDEOWRITER_PROP_HW_DEVICE and enum VideoAccelerationType.
  • new properties supported in three HW-capable backends: ffmpeg, gstreamer, msmf
  • setting new properties supported only via params parameter in VideoCapture/VideoWriter constructor or open() function, not supported in setProperty() call after open() call
  • by default (if property not set) HW acceleration enabled in HW-capable backends for both VideoCapture and VideoWriter
  • if HW accelerated decoder/encoder not found or failed to initilize, VideoCapture/VideoWriter gracefully falls back to SW decoder/encoder. Video acceleration status (HW or SW codec) could be queried via getProperty(CAP_PROP_HW_ACCELERATION) / getProperty(VIDEOWRITER_PROP_HW_ACCELERATION)
  • new sample video_acceleration
  • test iterating three backends and acceleration types

HW acceleration types support matrix, in priority order:

OS Backend VideoCapture VideoWriter
Linux FFMPEG VAAPI, MFX MFX, VAAPI
  GStreamer VAAPI (and others HW plugins) VAAPI (and others HW plugins)
Windows FFMPEG D3D11, MFX MFX
  MSMF D3D11 -

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 Apache 2 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
@asmorkalov asmorkalov mentioned this pull request Feb 5, 2021
0 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants