mirror of
https://github.com/opencv/opencv.git
synced 2025-08-05 22:19:14 +08:00
Merge pull request #26473 from opencv-pushbot:gitee/alalek/update_ffmpeg_5.x
ffmpeg/5.x: update FFmpeg wrapper 2024.11
This commit is contained in:
commit
5a3e18973b
12
3rdparty/ffmpeg/ffmpeg.cmake
vendored
12
3rdparty/ffmpeg/ffmpeg.cmake
vendored
@ -1,9 +1,9 @@
|
||||
# Binaries branch name: ffmpeg/4.x_20240522
|
||||
# Binaries were created for OpenCV: 8393885a39dac1e650bf5d0aaff84c04ad8bcdd3
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "394dca6ceb3085c979415e6385996b6570e94153")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "bdfbd1efb295f3e54c07d2cb7a843bf9")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "bfef029900f788480a363d6dc05c4f0e")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "8862c87496e2e8c375965e1277dee1c7")
|
||||
# Binaries branch name: ffmpeg/5.x_20241121
|
||||
# Binaries were created for OpenCV: ce7c0f0e651dbd7991f2c6a2327f2697f2102296
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "b2b3a3188ebbe73492ce4554c12b416512a5dec3")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "6e9aa1b8796e9ac19fca4278523c5dff")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "0fe534d69035e3801bc88418611019b4")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "e09efc33312d1173be8a9446f3b088fe")
|
||||
|
||||
function(download_win_ffmpeg script_var)
|
||||
set(${script_var} "" PARENT_SCOPE)
|
||||
|
@ -145,7 +145,6 @@ protected:
|
||||
|
||||
bool checkCompatibility(const OpenCV_API_Header& api_header, unsigned int abi_version, unsigned int api_version, bool checkMinorOpenCVVersion)
|
||||
{
|
||||
#if 0 // FIXIT: OpenCV 5.0
|
||||
if (api_header.opencv_version_major != CV_VERSION_MAJOR)
|
||||
{
|
||||
CV_LOG_ERROR(NULL, "Video I/O: wrong OpenCV major version used by plugin '" << api_header.api_description << "': " <<
|
||||
@ -162,9 +161,6 @@ protected:
|
||||
cv::format("%d.%d, OpenCV version is '" CV_VERSION "'", api_header.opencv_version_major, api_header.opencv_version_minor))
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
CV_UNUSED(checkMinorOpenCVVersion);
|
||||
#endif
|
||||
CV_LOG_INFO(NULL, "Video I/O: initialized '" << api_header.api_description << "': built with "
|
||||
<< cv::format("OpenCV %d.%d (ABI/API = %d/%d)",
|
||||
api_header.opencv_version_major, api_header.opencv_version_minor,
|
||||
|
@ -356,7 +356,15 @@ CvResult CV_API_CALL cv_capture_set_prop(CvPluginCapture handle, int prop, doubl
|
||||
try
|
||||
{
|
||||
CvCapture_FFMPEG_proxy* instance = (CvCapture_FFMPEG_proxy*)handle;
|
||||
return instance->setProperty(prop, val) ? CV_ERROR_OK : CV_ERROR_FAIL;
|
||||
if (instance->setProperty(prop, val))
|
||||
{
|
||||
return CV_ERROR_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_INFO(NULL, "FFmpeg: Unsupported property or value: prop=" << prop << " val=" << val);
|
||||
return CV_ERROR_FAIL;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@ -508,16 +516,46 @@ CvResult CV_API_CALL cv_writer_get_prop(CvPluginWriter handle, int prop, CV_OUT
|
||||
*val = instance->getProperty(prop);
|
||||
return CV_ERROR_OK;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
|
||||
return CV_ERROR_FAIL;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
|
||||
return CV_ERROR_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
CvResult CV_API_CALL cv_writer_set_prop(CvPluginWriter /*handle*/, int /*prop*/, double /*val*/)
|
||||
CvResult CV_API_CALL cv_writer_set_prop(CvPluginWriter handle, int prop, double val)
|
||||
{
|
||||
return CV_ERROR_FAIL;
|
||||
if (!handle)
|
||||
return CV_ERROR_FAIL;
|
||||
try
|
||||
{
|
||||
CvVideoWriter_FFMPEG_proxy* instance = (CvVideoWriter_FFMPEG_proxy*)handle;
|
||||
if (instance->setProperty(prop, val))
|
||||
{
|
||||
return CV_ERROR_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_LOG_INFO(NULL, "FFmpeg: Unsupported property or value: prop=" << prop << " val=" << val);
|
||||
return CV_ERROR_FAIL;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
|
||||
return CV_ERROR_FAIL;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
|
||||
return CV_ERROR_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -296,10 +296,6 @@ INSTANTIATE_TEST_CASE_P(/**/, videoio_container_get, testing::ValuesIn(videoio_c
|
||||
typedef tuple<string, string, int, int, bool, bool> videoio_encapsulate_params_t;
|
||||
typedef testing::TestWithParam< videoio_encapsulate_params_t > videoio_encapsulate;
|
||||
|
||||
#if defined(WIN32) // remove when FFmpeg wrapper includes PR25874
|
||||
#define WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE
|
||||
#endif
|
||||
|
||||
TEST_P(videoio_encapsulate, write)
|
||||
{
|
||||
const VideoCaptureAPIs api = CAP_FFMPEG;
|
||||
@ -331,11 +327,10 @@ TEST_P(videoio_encapsulate, write)
|
||||
Mat rawFrame;
|
||||
for (int i = 0; i < nFrames; i++) {
|
||||
ASSERT_TRUE(capRaw.read(rawFrame));
|
||||
#if !defined(WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE)
|
||||
if (setPts && i == 0) {
|
||||
ASSERT_TRUE(container.set(VIDEOWRITER_PROP_DTS_DELAY, capRaw.get(CAP_PROP_DTS_DELAY)));
|
||||
double dts = capRaw.get(CAP_PROP_DTS_DELAY);
|
||||
ASSERT_TRUE(container.set(VIDEOWRITER_PROP_DTS_DELAY, dts)) << "dts=" << dts;
|
||||
}
|
||||
#endif
|
||||
ASSERT_FALSE(rawFrame.empty());
|
||||
if (i == 0 && mpeg4) {
|
||||
Mat tmp = rawFrame.clone();
|
||||
@ -346,11 +341,10 @@ TEST_P(videoio_encapsulate, write)
|
||||
memcpy(rawFrame.data, extraData.data, extraData.total());
|
||||
memcpy(rawFrame.data + extraData.total(), tmp.data, tmp.total());
|
||||
}
|
||||
#if !defined(WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE)
|
||||
if (setPts) {
|
||||
ASSERT_TRUE(container.set(VIDEOWRITER_PROP_PTS, capRaw.get(CAP_PROP_PTS)));
|
||||
double pts = capRaw.get(CAP_PROP_PTS);
|
||||
ASSERT_TRUE(container.set(VIDEOWRITER_PROP_PTS, pts)) << "pts=" << pts;
|
||||
}
|
||||
#endif
|
||||
container.write(rawFrame);
|
||||
}
|
||||
container.release();
|
||||
@ -381,11 +375,9 @@ TEST_P(videoio_encapsulate, write)
|
||||
const bool keyFrameActual = capActualRaw.get(CAP_PROP_LRF_HAS_KEY_FRAME) == 1.;
|
||||
const bool keyFrameReference = idrPeriod ? i % idrPeriod == 0 : 1;
|
||||
ASSERT_EQ(keyFrameReference, keyFrameActual);
|
||||
#if !defined(WIN32_WAIT_FOR_FFMPEG_WRAPPER_UPDATE)
|
||||
if (tsWorking) {
|
||||
ASSERT_EQ(round(capReference.get(CAP_PROP_POS_MSEC)), round(capActual.get(CAP_PROP_POS_MSEC)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user