# Video writing is too slow in OpenCV

**URL:** <https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882>\
**Category:** C++\
**Tags:** cuda, videoio, nvidia, cudacodec\
**Created:** [December 18, 2023, 8:11am UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882 "2023-12-18T08:11:13Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [December 18, 2023, 8:11am UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/1 "2023-12-18T08:11:13Z")

</div>

Hi Technical Team,

Environment used for my task: Windows 11  
CUDA toolkits: 12.1  
GPU Name : NVIDIA T1200 Laptop GPU  
OpenCV 4.8.0

I have build OpenCV with CUDA support using CMake GUI for C++.

My requirement is “write 4K video @60 FPS”

Current state is “I am able to write @10 FPS only”

Method1:  
To achieve this, I tried to enable Hardware acceleration as below, but it is crashing

```
		cv::VideoWriter VideoWriter;

		VideoWriter.open("fileName.mp4"
                        , cv::VideoWriter::fourcc('m','p','4','v')
                        , 60
                        , cv::Size(3840, 2160)
                        , {cv::VIDEOWRITER_PROP_HW_ACCELERATION, cv::VIDEO_ACCELERATION_ANY}
                        )
						
		VideoWriter.write(imageMat);

```

If I disable “{cv::VIDEOWRITER\_PROP\_HW\_ACCELERATION, cv::VIDEO\_ACCELERATION\_ANY}”, it is working but video writing is too slow.

Method2:  
Here I have used CUDA write, here also it is crashing and the error is below

“OpenCV: terminate handler is called! The last OpenCV error is:  
OpenCV(4.8.0) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform)  
in throw\_no\_cuda, file C:\opencv\opencv-4.8.0\modules\core\include\opencv2/core/private.cuda.hpp, line 112”

```
cv::Ptr<cv::cudacodec::VideoWriter> d_writer;
cv::cuda::GpuMat d_frame;

d_writer = cv::cudacodec::createVideoWriter("fileName.mp4" 
                                            ,cv::Size(3840, 2160)
					,cv::cudacodec::Codec::H264
					,30
					,cv::cudacodec::ColorFormat::RGB
					);	

d_frame.upload(imageMat);
d_writer->write(d_frame);

```

My questions are:

Is any other software needs to be installed to enable hardware acceleration?  
What is wrong in method2?

Regards,  
Ratheesh

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [December 18, 2023, 10:25am UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/2 "2023-12-18T10:25:30Z")

</div>

> [@Ratheesh](#):
>
> Is any other software needs to be installed to enable hardware acceleration?  
> What is wrong in method2?

You need to install Nvidia Video Codec SDK. On windows,

> - **Optional** - To **decode** video on the GPU with the [Nvidia Video Codec SDK](https://developer.nvidia.com/nvidia-video-codec-sdk):
> 
> 1. Register and [download](https://developer.nvidia.com/nvidia-video-codec-sdk#Download) the latest version of the **Complete Video Codec SDK xx.x Package**.
> 2. Extract and copy the contents of **Interface** and **Lib** to the **include** and **lib** directories inside your CUDA installation.

from

> **[Build OpenCV (including Python) with CUDA on Windows: Comprehensive Guide...](https://www.jamesbowley.co.uk/qmd/opencv_cuda_python_windows.html#prerequisites)**
>
> Guide to building OpenCV (including Python bindings) with CUDA (optionally the Nvidia Video Codec SDK and cuDNN) from within Visual Studio or from the command line using the Ninja build system.

If you want your 4k files in container formats, mp4 etc. then you will have to wait until OpenCV 4.9.0 is released as _opencv\_videoio\_ffmpeg480\_64.dll_ hasn’t been updated yet to include

> <https://github.com/opencv/opencv_contrib/pull/3569>
>
> Where supported, allows the raw encoded video output from Nvidia's hardware deco…der to be encapsulated in a suitable (mp4/mkv/etc.) container.
> 
> Dependant on https://github.com/opencv/opencv/pull/24363.
> 
> Fixes https://github.com/opencv/opencv\_contrib/issues/3556
> \### Pull Request Readiness Checklist
> 
> See details at https://github.com/opencv/opencv/wiki/How\_to\_contribute#making-a-good-pull-request
> 
> \- \[x\] I agree to contribute to the project under Apache 2 License.
> \- \[x\] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
> \- \[x\] The PR is proposed to the proper branch
> \- \[x\] There is a reference to the original bug report and related work
> \- \[x\] There is accuracy test, performance test and test data in opencv\_extra repository, if applicable
> Patch to opencv\_extra has the same branch name.
> \- \[x\] The feature is well documented and sample code can be built with the project CMake

---

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [December 26, 2023, 12:39pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/3 "2023-12-26T12:39:24Z")

</div>

Hi,

Thanks for your response.

For the method :2, I have followed your suggestion ( Extract and copy the contents of **Interface** and **Lib** to the **include** and **lib** directories inside ) (Refer the screenshot

 ![nvendec](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/5/5ee660b27db4dbd0e5485c72e1924e57b09e6f72.png)  
). I am still facing the below error

“OpenCV: terminate handler is called! The last OpenCV error is:  
OpenCV(4.8.0) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform)  
in throw\_no\_cuda, file C:\opencv\opencv-4.8.0\modules\core\include\opencv2/core/private.cuda.hpp, line 112”  
Also i have set environment variable like below

 ![envOpenCV](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/0/0ca9a76dbf6d52f5c5e0bc2bf521b62933d8c228.png)

My questions:  
am i doing anything wrong here? or any other parameters needs to be initialized for cv::cudacodec::createVideoWriter?

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [December 26, 2023, 2:44pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/4 "2023-12-26T14:44:50Z")

</div>

> [@Ratheesh](#):
>
> I am still facing the below error
> 
> “OpenCV: terminate handler is called! The last OpenCV error is:  
> OpenCV(4.8.0) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform)  
> in throw\_no\_cuda, file C:\opencv\opencv-4.8.0\modules\core\include\opencv2/core/private.cuda.hpp, line 112”

I notice above I did not say and rebuild OpenCV so I’m guessing you didn’t? If not rebuild it and if so check your CMake configuration output for errors and confirm that the Nvidia section contains and entry for NVCUVID and NVCUVENC. e.g.

```auto
-- NVIDIA CUDA: YES (ver 12.3, CUFFT CUBLAS NVCUVID NVCUVENC)
-- NVIDIA GPU arch: 50 52 60 61 70 75 80 86 89 90
-- NVIDIA PTX archs: 90

```

All of this is in the guide I linked to.

> [@Ratheesh](#):
>
> Also i have set environment variable like below

You don’t need to set any environmental variables, `OPENCV_FFMPEG_WRITER_OPTIONS` is for `cv::VideoWriter` not `cv::cuda::VideoWriter`.

---

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [December 26, 2023, 4:09pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/5 "2023-12-26T16:09:56Z")

</div>

Hi,  
Thankyou for your response.

Yes, I did not rebuild OpenCV.  
I dont know the way to check “CMake configuration output for errors”. (or Kindly let me know, How do i check “CMake configuration output for errors”. )

But I have executed below code

void GuiHandler::deviceInfo()  
{  
std::cout \<\< cv::getBuildInformation()\<\< std::endl;  
}

The Output is:

![nvidiaArchOp](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/9/9921771134cbcde9f7cd0b94cb92a26cda377691.png)

I understood that setting of Environment variable “OPENCV\_FFMPEG\_WRITER\_OPTIONS” is useful for `cv::VideoWriter` and it is not useful for `cv::cuda::VideoWriter`.

---

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [December 27, 2023, 5:46pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/6 "2023-12-27T17:46:51Z")

</div>

Hi, I have rebuild the OpenCV but now i am getting below error, Could you please help me to solve this error?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/4/4d28c1ce81c7baefd29d34f1b2c13bb6d441ee97.png)

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [December 28, 2023, 5:57am UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/7 "2023-12-28T05:57:11Z")

</div>

Please post the text not images and include all of the output from `getBuildInformation`.

Those variables were introduced after OpenCV 4.8.0 so it is likely you are using main 4.8.0 and one of the latest commits from the contrib branch. Use commits from the tip of the 4.x branch in both repos or the 4.8.0 tag on both branches.

---

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [December 28, 2023, 4:51pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/8 "2023-12-28T16:51:24Z")

</div>

Hi,

Thankyou for your response.

After following your instruction (used proper opencv\_contrib-4.8.0 ), The above mentioned error is not coming and no crashing issue.

As per my need, It is creating the video file in .mp4 file but this file is not playable. Refer the below image for this.

![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/9/94e9b4c545aa110a7c9d734573550e3345a50499.png)

I am giving the code again for your reference

cv::Ptrcv::cudacodec::VideoWriter d\_writer;  
cv::cuda::GpuMat d\_frame;

d\_writer = cv::cudacodec::createVideoWriter(“fileName.mp4”  
,cv::Size(3840, 2160)  
,cv::cudacodec::Codec::H264  
,30  
,cv::cudacodec::ColorFormat::RGB  
);

d\_frame.upload(imageMat);  
d\_writer-\>write(d\_frame);

My question:  
is something missed in the configuration?  
is .mp4 container supported for H264 codec?

Note:  
Below is the full output for cv::getBuildInformation(); function execution

General configuration for OpenCV 4.8.0 =====================================  
Version control: unknown

Extra modules:  
Location (extra): C:/opencv/cudaSDK/opencv\_contrib-4.8.0/modules  
Version control (extra): unknown

Platform:  
Timestamp: 2023-12-28T09:16:09Z  
Host: Windows 10.0.22000 AMD64  
CMake: 3.27.7  
CMake generator: Visual Studio 16 2019  
CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe  
MSVC: 1929  
Configuration: Release

CPU/HW features:  
Baseline: SSE SSE2 SSE3  
requested: SSE3  
Dispatched code generation: SSE4\_1 SSE4\_2 FP16 AVX AVX2 AVX512\_SKX  
requested: SSE4\_1 SSE4\_2 AVX FP16 AVX2 AVX512\_SKX  
SSE4\_1 (18 files): + SSSE3 SSE4\_1  
SSE4\_2 (2 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2  
FP16 (1 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 FP16 AVX  
AVX (8 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 AVX  
AVX2 (37 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 FP16 FMA3 AVX AVX2  
AVX512\_SKX (8 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 FP16 FMA3 AVX AVX2 AVX\_512F AVX512\_COMMON AVX512\_SKX

C/C++:  
Built as dynamic libs?: YES  
C++ standard: 11  
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe (ver 19.29.30151.0)  
C++ flags (Release): /DWIN32 /D\_WINDOWS /W4 /GR /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /MD /O2 /Ob2 /DNDEBUG  
C++ flags (Debug): /DWIN32 /D\_WINDOWS /W4 /GR /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /MDd /Zi /Ob0 /Od /RTC1  
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe  
C flags (Release): /DWIN32 /D\_WINDOWS /W3 /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /MD /O2 /Ob2 /DNDEBUG  
C flags (Debug): /DWIN32 /D\_WINDOWS /W3 /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /MDd /Zi /Ob0 /Od /RTC1  
Linker flags (Release): /machine:x64 /INCREMENTAL:NO  
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL  
ccache: NO  
Precompiled headers: NO  
Extra dependencies: cudart\_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/lib/x64  
3rdparty dependencies:

OpenCV modules:  
To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn\_objdetect dnn\_superres dpm face features2d flann fuzzy gapi hfs highgui img\_hash imgcodecs imgproc intensity\_transform line\_descriptor mcc ml objdetect optflow phase\_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured\_light superres surface\_matching text tracking ts video videoio videostab wechat\_qrcode world xfeatures2d ximgproc xobjdetect xphoto  
Disabled: -  
Disabled by dependency: -  
Unavailable: alphamat cvv freetype hdf java julia matlab ovis python2 python3 sfm viz  
Applications: tests perf\_tests apps  
Documentation: NO  
Non-free algorithms: NO

Windows RT support: NO

GUI:  
Win32 UI: YES  
VTK support: NO

Media I/O:  
ZLib: build (ver 1.2.13)  
JPEG: build-libjpeg-turbo (ver 2.1.3-62)  
SIMD Support Request: YES  
SIMD Support: NO  
WEBP: build (ver encoder: 0x020f)  
PNG: build (ver 1.6.37)  
TIFF: build (ver 42 - 4.2.0)  
JPEG 2000: build (ver 2.5.0)  
OpenEXR: build (ver 2.3.0)  
HDR: YES  
SUNRASTER: YES  
PXM: YES  
PFM: YES

Video I/O:  
DC1394: NO  
FFMPEG: YES (prebuilt binaries)  
avcodec: YES (58.134.100)  
avformat: YES (58.76.100)  
avutil: YES (56.70.100)  
swscale: YES (5.9.100)  
avresample: YES (4.0.0)  
GStreamer: YES (1.21.1)  
DirectShow: YES  
Media Foundation: YES  
DXVA: YES

Parallel framework: Concurrency

Trace: YES (with Intel ITT)

Other third-party libraries:  
Intel IPP: 2021.8 [2021.8.0]  
at: C:/opencv/cudaSDK/build/3rdparty/ippicv/ippicv\_win/icv  
Intel IPP IW: sources (2021.8.0)  
at: C:/opencv/cudaSDK/build/3rdparty/ippicv/ippicv\_win/iw  
Lapack: NO  
Eigen: NO  
Custom HAL: NO  
Protobuf: build (3.19.1)  
Flatbuffers: builtin/3rdparty (23.5.9)

NVIDIA CUDA: YES (ver 12.1, CUFFT CUBLAS NVCUVID NVCUVENC FAST\_MATH)  
NVIDIA GPU arch: 75  
NVIDIA PTX archs:

cuDNN: YES (ver 8.9.6)

OpenCL: YES (NVD3D11)  
Include path: C:/opencv/cudaSDK/opencv-4.8.0/3rdparty/include/opencl/1.2  
Link libraries: Dynamic load

Python (for build): NO

Java:  
ant: NO  
Java: NO  
JNI: NO  
Java wrappers: NO  
Java tests: NO

## Install to: C:/opencv/cudaSDK/build/install

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [December 28, 2023, 5:56pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/9 "2023-12-28T17:56:28Z")

</div>

> [@Ratheesh](#):
>
> My question:  
> is something missed in the configuration?  
> is .mp4 container supported for H264 codec?

You file is a raw h264 encoded file with a .mp4 extension, rename to fileName.h264, play with vlc and see my original comment.

> [@cudawarped](#):
>
> If you want your 4k files in container formats, mp4 etc. then you will have to wait until OpenCV 4.9.0 is released as _opencv\_videoio\_ffmpeg480\_64.dll_ hasn’t been updated yet to include
> 
> [Sign in to GitHub · GitHub](https://github.com/opencv/opencv_contrib/pull/3569https://github.com/opencv/opencv_contrib/pull/3569)

---

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [December 30, 2023, 5:33pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/10 "2023-12-30T17:33:39Z")

</div>

Hi,  
I have build the openCV 4.9.0 and used the respective dll and lib for videoWriter.  
Still the problem was not solved (That means, It is creating the video file in .mp4 file but this file is not directly playable format.). As per your instruction it is playing in VLC player by changing its extension to .h264.

But as per your instruction h264 codec has support to .mp4 container also.

My question: Is something needs to be modified in my above code(earlier chat) ?

Below is the full output for cv::getBuildInformation(); function execution

General configuration for OpenCV 4.9.0 =====================================  
Version control: unknown

Extra modules:  
Location (extra): C:/opencv/490/opencv\_contrib-4.9.0/modules  
Version control (extra): unknown

Platform:  
Timestamp: 2023-12-29T16:58:47Z  
Host: Windows 10.0.22000 AMD64  
CMake: 3.27.7  
CMake generator: Visual Studio 16 2019  
CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe  
MSVC: 1929  
Configuration: Release

CPU/HW features:  
Baseline: SSE SSE2 SSE3  
requested: SSE3  
Dispatched code generation: SSE4\_1 SSE4\_2 FP16 AVX AVX2 AVX512\_SKX  
requested: SSE4\_1 SSE4\_2 AVX FP16 AVX2 AVX512\_SKX  
SSE4\_1 (18 files): + SSSE3 SSE4\_1  
SSE4\_2 (2 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2  
FP16 (1 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 FP16 AVX  
AVX (9 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 AVX  
AVX2 (38 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 FP16 FMA3 AVX AVX2  
AVX512\_SKX (8 files): + SSSE3 SSE4\_1 POPCNT SSE4\_2 FP16 FMA3 AVX AVX2 AVX\_512F AVX512\_COMMON AVX512\_SKX

C/C++:  
Built as dynamic libs?: YES  
C++ standard: 11  
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe (ver 19.29.30151.0)  
C++ flags (Release): /DWIN32 /D\_WINDOWS /W4 /GR /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /O2 /Ob2 /DNDEBUG  
C++ flags (Debug): /DWIN32 /D\_WINDOWS /W4 /GR /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /Zi /Ob0 /Od /RTC1  
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe  
C flags (Release): /DWIN32 /D\_WINDOWS /W3 /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /O2 /Ob2 /DNDEBUG  
C flags (Debug): /DWIN32 /D\_WINDOWS /W3 /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /Zi /Ob0 /Od /RTC1  
Linker flags (Release): /machine:x64 /INCREMENTAL:NO  
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL  
ccache: NO  
Precompiled headers: NO  
Extra dependencies: cudart\_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/lib/x64  
3rdparty dependencies:

OpenCV modules:  
To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn\_objdetect dnn\_superres dpm face features2d flann fuzzy gapi hfs highgui img\_hash imgcodecs imgproc intensity\_transform line\_descriptor mcc ml objdetect optflow phase\_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured\_light superres surface\_matching text tracking ts video videoio videostab wechat\_qrcode world xfeatures2d ximgproc xobjdetect xphoto  
Disabled: -  
Disabled by dependency: -  
Unavailable: alphamat cannops cvv freetype hdf java julia matlab ovis python2 python3 sfm viz  
Applications: tests perf\_tests apps  
Documentation: NO  
Non-free algorithms: NO

Windows RT support: NO

GUI:  
Win32 UI: YES  
VTK support: NO

Media I/O:  
ZLib: build (ver 1.3)  
JPEG: build-libjpeg-turbo (ver 2.1.3-62)  
SIMD Support Request: YES  
SIMD Support: NO  
WEBP: build (ver encoder: 0x020f)  
PNG: build (ver 1.6.37)  
TIFF: build (ver 42 - 4.2.0)  
JPEG 2000: build (ver 2.5.0)  
OpenEXR: build (ver 2.3.0)  
HDR: YES  
SUNRASTER: YES  
PXM: YES  
PFM: YES

Video I/O:  
DC1394: NO  
FFMPEG: YES (prebuilt binaries)  
avcodec: YES (58.134.100)  
avformat: YES (58.76.100)  
avutil: YES (56.70.100)  
swscale: YES (5.9.100)  
avresample: YES (4.0.0)  
GStreamer: YES (1.21.1)  
DirectShow: YES  
Media Foundation: YES  
DXVA: YES

Parallel framework: Concurrency

Trace: YES (with Intel ITT)

Other third-party libraries:  
Intel IPP: 2021.11.0 [2021.11.0]  
at: C:/opencv/490/build/3rdparty/ippicv/ippicv\_win/icv  
Intel IPP IW: sources (2021.11.0)  
at: C:/opencv/490/build/3rdparty/ippicv/ippicv\_win/iw  
Lapack: NO  
Eigen: NO  
Custom HAL: NO  
Protobuf: build (3.19.1)  
Flatbuffers: builtin/3rdparty (23.5.9)

NVIDIA CUDA: YES (ver 12.1, CUFFT CUBLAS NVCUVID NVCUVENC FAST\_MATH)  
NVIDIA GPU arch: 75  
NVIDIA PTX archs: 90

cuDNN: YES (ver 8.9.6)

OpenCL: YES (NVD3D11)  
Include path: C:/opencv/490/opencv-4.9.0/3rdparty/include/opencl/1.2  
Link libraries: Dynamic load

Python (for build): NO

Java:  
ant: NO  
Java: NO  
JNI: NO  
Java wrappers: NO  
Java tests: NO

## Install to: C:/opencv/490/build/install

Thanks  
Ratheesh

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [December 31, 2023, 6:19am UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/12 "2023-12-31T06:19:06Z")

</div>

> [@Ratheesh](#):
>
> I have build the openCV 4.9.0 and used the respective dll and lib for videoWriter.  
> Still the problem was not solved (That means, It is creating the video file in .mp4 file but this file is not directly playable format.). As per your instruction it is playing in VLC player by changing its extension to .h264.
> 
> But as per your instruction h264 codec has support to .mp4 container also.
> 
> My question: Is something needs to be modified in my above code(earlier chat) ?

Sorry that feature needs to be enabled now the FFMpeg shared library for windows has been updated. If you apply the following patch it should work.

> <https://github.com/opencv/opencv_contrib/pull/3615>
>
> Enable disabled windows features (https://github.com/opencv/opencv\_contrib/pull/…3569, https://github.com/opencv/opencv\_contrib/pull/3488, https://github.com/opencv/opencv\_contrib/pull/3542) which are now available in the ffmpeg shared libary.
> 
> \### Pull Request Readiness Checklist
> 
> See details at https://github.com/opencv/opencv/wiki/How\_to\_contribute#making-a-good-pull-request
> 
> \- \[x\] I agree to contribute to the project under Apache 2 License.
> \- \[x\] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
> \- \[x\] The PR is proposed to the proper branch
> \- \[x\] There is a reference to the original bug report and related work
> \- \[x\] There is accuracy test, performance test and test data in opencv\_extra repository, if applicable
> Patch to opencv\_extra has the same branch name.
> \- \[x\] The feature is well documented and sample code can be built with the project CMake

---

<div class="post-metadata">

**Author:** ![Ratheesh](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Ratheesh](https://forum.opencv.org/u/Ratheesh)\
**Post date:** [January 5, 2024, 2:41pm UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/13 "2024-01-05T14:41:06Z")

</div>

Hi,

Thankyou , Yes it is working after applying that patch.

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [January 16, 2024, 9:57am UTC](https://forum.opencv.org/t/video-writing-is-too-slow-in-opencv/15882/14 "2024-01-16T09:57:34Z")

</div>

> [@Ratheesh](#):
>
> Thankyou , Yes it is working after applying that patch.

Its now merged into 4.x so no need for the patch.
