Hello, I'm trying to use OpenCV with Intel Media SDK backend to write a programm which can write video by intel gpu with H264 very fast.
I used code from OpenCV tutorial for Intel Media SDK backend.
int fourcc = VideoWriter::fourcc('H', '2', '6', '4'); VideoWriter writer(filename, CAP_INTEL_MFX, fourcc, fps, frameSize, isColor=true);
However, the video files that have been written are very large. For about 1 minute the file is already 300 MB large.
In gstreamer I can set parameters for H.264, and with ffmpeg in terminal I can also set parameters for H.264. But how can I set parameters in OpenCV? Or is there any other reason that the files are so large?
If someone here has experience with Media SDK in OpenCV, please tell me how you have worked with it. Thanks!
- Development Tools
- Intel® Media SDK
- Intel® Media Server Studio
- Media Processing
You have answered one of my questions in your other post, I am still not clear your process to build the MediaSDK backend enabled OpenCV application.
Before you build the application, you should rebuild OpenCV library in order to add Media SDK to OpenCV:
OpenCV should be rebuilt for this:
- Download and unpack sources: https://github.com/opencv/opencv/archive/4.0.0-openvino.zip
- Install Visual Studio, cmake and MediaSDK (do not forget to set environment variable INTELMEDIASDKROOT)
- Create build directory and run following commands in it (CMD console, assuming VS2015):
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
- cmake -G”Visual Studio 14 2015 Win64” -DCMAKE_INSTALL_PREFIX=install -DWITH_MFX=ON ..\opencv
- cmake --build . --config Release --target install
- set OpenCV_DIR environment variable to point to <build>/install folder (OpenCVConfig.cmake file should be located there).
My understanding is, you have to build your application after you did this.