mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #19460 from mikhail-nikolskiy:videoio-hw
videoio: HW decode/encode in FFMPEG backend; new properties with support in FFMPEG/GST/MSMF * HW acceleration in FFMPEG backend * fixes on Windows, remove D3D9 * HW acceleration in FFMPEG backend * fixes on Windows, remove D3D9 * improve va test * Copyright * check LIBAVUTIL_BUILD >= AV_VERSION_INT(55, 78, 100) // FFMPEG 3.4+ * CAP_MSMF test on .mp4 * .mp4 in test * improve va test * Copyright * check LIBAVUTIL_BUILD >= AV_VERSION_INT(55, 78, 100) // FFMPEG 3.4+ * CAP_MSMF test on .mp4 * .mp4 in test * .avi for GStreamer test * revert changes around seek() * cv_writer_open_with_params * params.warnUnusedParameters * VideoCaptureParameters in GStreamer * open_with_params * params->getUnused * Reduce PSNR threshold 33->32 (other tests use 30) * require FFMPEG 4.0+; PSNR 30 as in other tests * GStreamer AVI-demux plugin not installed in Ubuntu test environment? * fix build on very old ffmpeg * fix build on very old ffmpeg * fix build issues * fix build issues (static_cast) * FFMPEG built on Windows without H264 encoder? * fix for write_nothing test on VAAPI * fix warnings * fix cv_writer_get_prop in plugins * use avcodec_get_hw_frames_parameters; more robust fallback to SW codecs * internal function hw_check_device() for device check/logging * two separate tests for HW read and write * image size 640x480 in encode test * WITH_VA=ON (only .h headers used in OpenCV, no linkage dependency) * exception on VP9 SW encoder? * rebase master; refine info message * videoio: fix FFmpeg standalone plugin build * videoio(ffmpeg): eliminate MSVC build warnings * address review comments * videoio(hw): update videocapture_acceleration.read test - remove parallel decoding by SW code path - check PSNR against the original generated image * videoio: minor fixes * videoio(test): disable unsupported MSMF cases (SW and HW) * videoio(test): update PSNR thresholds for HW acceleration read * videoio(test): update debug messages * "hw_acceleration" whitelisting parameter * little optimization in test * D3D11VA supports decoders, doesn't support encoders * videoio(test): adjust PSNR threshold in write_read_position tests * videoio(ffmpeg): fix rejecting on acceleration device name mismatch * videoio(ffmpeg): fix compilation USE_AV_HW_CODECS=0, add more debug logging * videoio: rework VideoAccelerationType behavior - enum is not a bitset - default value is backend specific - only '_NONE' and '_ANY' may fallback on software processing - specific H/W acceleration doesn't fallback on software processing. It fails if there is no support for specified H/W acceleration. * videoio(test): fix for current FFmpeg wrapper Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f70e80a6ba
commit
7bcb51eded
@@ -78,7 +78,7 @@ namespace cv
|
||||
//! @{
|
||||
|
||||
|
||||
/** @brief %VideoCapture API backends identifier.
|
||||
/** @brief cv::VideoCapture API backends identifier.
|
||||
|
||||
Select preferred API for a capture object.
|
||||
To be used in the VideoCapture::VideoCapture() constructor or VideoCapture::open()
|
||||
@@ -124,7 +124,7 @@ enum VideoCaptureAPIs {
|
||||
CAP_UEYE = 2500, //!< uEye Camera API
|
||||
};
|
||||
|
||||
/** @brief %VideoCapture generic properties identifier.
|
||||
/** @brief cv::VideoCapture generic properties identifier.
|
||||
|
||||
Reading / writing properties involves many layers. Some unexpected result might happens along this chain.
|
||||
Effective behaviour depends from device hardware, driver and API Backend.
|
||||
@@ -182,12 +182,14 @@ enum VideoCaptureProperties {
|
||||
CAP_PROP_BITRATE =47, //!< (read-only) Video bitrate in kbits/s
|
||||
CAP_PROP_ORIENTATION_META=48, //!< (read-only) Frame rotation defined by stream meta (applicable for FFmpeg back-end only)
|
||||
CAP_PROP_ORIENTATION_AUTO=49, //!< if true - rotates output frames of CvCapture considering video file's metadata (applicable for FFmpeg back-end only) (https://github.com/opencv/opencv/issues/15499)
|
||||
CAP_PROP_HW_ACCELERATION=50, //!< (**open-only**) Hardware acceleration type (see #VideoAccelerationType). Setting supported only via `params` parameter in cv::VideoCapture constructor / .open() method. Default value is backend-specific.
|
||||
CAP_PROP_HW_DEVICE =51, //!< (**open-only**) Hardware device index (select GPU if multiple available)
|
||||
#ifndef CV_DOXYGEN
|
||||
CV__CAP_PROP_LATEST
|
||||
#endif
|
||||
};
|
||||
|
||||
/** @brief %VideoWriter generic properties identifier.
|
||||
/** @brief cv::VideoWriter generic properties identifier.
|
||||
@sa VideoWriter::get(), VideoWriter::set()
|
||||
*/
|
||||
enum VideoWriterProperties {
|
||||
@@ -196,7 +198,12 @@ enum VideoWriterProperties {
|
||||
VIDEOWRITER_PROP_NSTRIPES = 3, //!< Number of stripes for parallel encoding. -1 for auto detection.
|
||||
VIDEOWRITER_PROP_IS_COLOR = 4, //!< If it is not zero, the encoder will expect and encode color frames, otherwise it
|
||||
//!< will work with grayscale frames.
|
||||
VIDEOWRITER_PROP_DEPTH = 5 //!< Defaults to CV_8U.
|
||||
VIDEOWRITER_PROP_DEPTH = 5, //!< Defaults to CV_8U.
|
||||
VIDEOWRITER_PROP_HW_ACCELERATION = 6, //!< (**open-only**) Hardware acceleration type (see #VideoAccelerationType). Setting supported only via `params` parameter in VideoWriter constructor / .open() method. Default value is backend-specific.
|
||||
VIDEOWRITER_PROP_HW_DEVICE = 7, //!< (**open-only**) Hardware device index (select GPU if multiple available)
|
||||
#ifndef CV_DOXYGEN
|
||||
CV__VIDEOWRITER_PROP_LATEST
|
||||
#endif
|
||||
};
|
||||
|
||||
//! @} videoio_flags_base
|
||||
@@ -204,6 +211,26 @@ enum VideoWriterProperties {
|
||||
//! @addtogroup videoio_flags_others
|
||||
//! @{
|
||||
|
||||
/** @brief Video Acceleration type
|
||||
*
|
||||
* Used as value in #CAP_PROP_HW_ACCELERATION and #VIDEOWRITER_PROP_HW_ACCELERATION
|
||||
*
|
||||
* @note In case of FFmpeg backend, it translated to enum AVHWDeviceType (https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/hwcontext.h)
|
||||
*/
|
||||
enum VideoAccelerationType
|
||||
{
|
||||
VIDEO_ACCELERATION_NONE = 0, //!< Do not require any specific H/W acceleration, prefer software processing.
|
||||
//!< Reading of this value means that special H/W accelerated handling is not added or not detected by OpenCV.
|
||||
|
||||
VIDEO_ACCELERATION_ANY = 1, //!< Prefer to use H/W acceleration. If no one supported, then fallback to software processing.
|
||||
//!< @note H/W acceleration may require special configuration of used environment.
|
||||
//!< @note Results in encoding scenario may differ between software and hardware accelerated encoders.
|
||||
|
||||
VIDEO_ACCELERATION_D3D11 = 2, //!< DirectX 11
|
||||
VIDEO_ACCELERATION_VAAPI = 3, //!< VAAPI
|
||||
VIDEO_ACCELERATION_MFX = 4, //!< libmfx (Intel MediaSDK/oneVPL)
|
||||
};
|
||||
|
||||
/** @name IEEE 1394 drivers
|
||||
@{
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user