# Unable to use the encoder libx264 for windows

**URL:** <https://forum.opencv.org/t/unable-to-use-the-encoder-libx264-for-windows/16025>\
**Category:** Python\
**Tags:** ffmpeg, videoio, build\
**Created:** [January 2, 2024, 10:47am UTC](https://forum.opencv.org/t/unable-to-use-the-encoder-libx264-for-windows/16025 "2024-01-02T10:47:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 2, 2024, 1:11pm UTC](https://forum.opencv.org/t/unable-to-use-the-encoder-libx264-for-windows/16025/2 "2024-01-02T13:11:31Z")

</div>

I don’t think this is implemented see

> [@How to have OpenCV built process use self-built ffmpeg?](https://forum.opencv.org/t/how-to-have-opencv-built-process-use-self-built-ffmpeg/15561):
>
> Building OpenCV in “default” way (CMake/ Code::Blocks/ mingw-64) it uses a prebuilt ffmpeg, wrapped in “opencv\_videoio\_ffmpeg480\_64.dll”. My CMake’s output: 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: NO DirectShow: YES But this ffmpeg seems to offer only “rudimentary” (video) codecs. Especially the most-used h264 codec with acceptable qu…

and

> <https://github.com/opencv/opencv/issues/24570>
>
> \### System Information
> 
> OpenCV version: 4.8.0
> Operating System / Platform: Wi…ndows 7-64
> Compiler & compiler version: mingw-64
> 
> CMake
> Code::Blocks
> 
> \### Detailed description
> 
> Built OpenCV v.4.8.0 with tools as above
> 
> Used prebuild ffmpeg backend.
> (\[Detailed description\](https://forum.opencv.org/t/error-your-platform-doesnt-suppport-hardware-accelerated-av1-decoding-when-i-use-cv2-videocapture/9605/14)) and \[this\](https://forum.opencv.org/t/how-to-have-opencv-built-process-use-self-built-ffmpeg/15561/1).
> 
> 
> 
> 
> \### Steps to reproduce
> 
> Using the VideoWriter, and setting ffmpeg's crf-option before
> 
> \`\`\`
> \_putenv ("OPENCV\_FFMPEG\_WRITER\_OPTIONS=crf;18");
> VideoWriter VW ("Output.mp4", CAP\_FFMPEG, VideoWriter::fourcc('a','v','c','1'), capt.get(CAP\_PROP\_FPS), refS);
> \`\`\`
> 
> generates always h264 default crf 23.
> See lines
> \[DEBUG:0@0.065\] and
> \[OPENCV:FFMPEG:32\] in the following (bolding doesn't seem to work in code):
> 
> \`\`\`
> \[DEBUG:0@0.008\] global videoio\_registry.cpp:218 VideoBackendRegistry VIDEOIO: Builtin backends(8): FFMPEG(1000); GSTREAMER(990); INTEL\_MFX(980); MSMF(970); DSHOW(960); CV\_IMAGES(950); CV\_MJPEG(940); UEYE(930)
> \[DEBUG:0@0.008\] global videoio\_registry.cpp:242 VideoBackendRegistry VIDEOIO: Available backends(8): FFMPEG(1000); GSTREAMER(990); INTEL\_MFX(980); MSMF(970); DSHOW(960); CV\_IMAGES(950); CV\_MJPEG(940); UEYE(930)
> \[INFO:0@0.008\] global videoio\_registry.cpp:244 VideoBackendRegistry VIDEOIO: Enabled backends(8, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL\_MFX(980); MSMF(970); DSHOW(960); CV\_IMAGES(950); CV\_MJPEG(940); UEYE(930)
> \[OPENCV:FFMPEG:40\] Reinit context to 1280x720, pix\_fmt: yuv420p
> \[DEBUG:0@0.061\] global cap\_ffmpeg\_impl.hpp:1182 open FFMPEG: stream\[0\] is video stream with codecID=27 width=1280 height=720
> \[DEBUG:0@0.061\] global cap\_ffmpeg\_hw.hpp:934 HWAccelIterator FFMPEG: allowed acceleration types (none): ''
> \[DEBUG:0@0.065\] global cap\_ffmpeg\_impl.hpp:2773 open Selected pixel format: bgr24
> \*\*\[DEBUG:0@0.065\] global cap\_ffmpeg\_impl.hpp:2980 open VIDEOIO/FFMPEG: using writer options from environment: crf;18\*\*
> \[DEBUG:0@0.065\] global cap\_ffmpeg\_hw.hpp:934 HWAccelIterator FFMPEG: allowed acceleration types (none): ''
> \[OPENCV:FFMPEG:32\] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
> \[OPENCV:FFMPEG:32\] profile High, level 3.1, 4:2:0, 8-bit
> \[OPENCV:FFMPEG:32\] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy\_rd=1.00:0.00 mixed\_ref=1 me\_range=16 chroma\_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast\_pskip=1 chroma\_qp\_offset=-2 threads=12 lookahead\_threads=2 sliced\_threads=0 nr=0 decimate=1 interlaced=0 bluray\_compat=0 constrained\_intra=0 bframes=3 b\_pyramid=2 b\_adapt=1 b\_bias=0 direct=1 weightb=1 open\_gop=0 weightp=2 keyint=250 keyint\_min=25 scenecut=40 intra\_refresh=0 rc\_lookahead=40 rc=crf mbtree=1 \*\*crf=23.0\*\* qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip\_ratio=1.40 aq=1:1.00
> \[OPENCV:FFMPEG:40\] Reinit context to 1280x720, pix\_fmt: yuv420p
> \[DEBUG:0@0.082\] global cap\_ffmpeg\_impl.hpp:1609 retrieveFrame Input picture format: yuv420p
> \[DEBUG:0@0.085\] global parallel.cpp:107 createDefaultParallelForAPI core(parallel): Initializing parallel backend...
> \[DEBUG:0@0.085\] global registry\_parallel.impl.hpp:69 ParallelBackendRegistry core(parallel): Builtin backends(3): ONETBB(1000); TBB(990); OPENMP(980)
> \[DEBUG:0@0.085\] global registry\_parallel.impl.hpp:94 ParallelBackendRegistry core(parallel): Available backends(3): ONETBB(1000); TBB(990); OPENMP(980)
> \[INFO:0@0.085\] global registry\_parallel.impl.hpp:96 ParallelBackendRegistry core(parallel): Enabled backends(3, sorted by priority): ONETBB(1000); TBB(990); OPENMP(980)
> \[DEBUG:0@0.085\] global parallel.cpp:65 createParallelForAPI core(parallel): trying backend: ONETBB (priority=1000)
> \[DEBUG:0@0.085\] global plugin\_parallel\_wrapper.impl.hpp:233 getPluginCandidates Found 2 plugin(s) for ONETBB
> \[INFO:0@0.085\] global plugin\_loader.impl.hpp:67 libraryLoad load D:\\Guido\\develop\\opencv\\build\\bin\\opencv\_core\_parallel\_onetbb480\_64.dll =\> FAILED
> \[INFO:0@0.086\] global plugin\_loader.impl.hpp:67 libraryLoad load opencv\_core\_parallel\_onetbb480\_64.dll =\> FAILED
> \[DEBUG:0@0.086\] global parallel.cpp:65 createParallelForAPI core(parallel): trying backend: TBB (priority=990)
> \[DEBUG:0@0.086\] global plugin\_parallel\_wrapper.impl.hpp:233 getPluginCandidates Found 2 plugin(s) for TBB
> \[INFO:0@0.086\] global plugin\_loader.impl.hpp:67 libraryLoad load D:\\Guido\\develop\\opencv\\build\\bin\\opencv\_core\_parallel\_tbb480\_64.dll =\> FAILED
> \[INFO:0@0.086\] global plugin\_loader.impl.hpp:67 libraryLoad load opencv\_core\_parallel\_tbb480\_64.dll =\> FAILED
> \[DEBUG:0@0.086\] global parallel.cpp:65 createParallelForAPI core(parallel): trying backend: OPENMP (priority=980)
> \[DEBUG:0@0.086\] global plugin\_parallel\_wrapper.impl.hpp:233 getPluginCandidates Found 2 plugin(s) for OPENMP
> \[INFO:0@0.086\] global plugin\_loader.impl.hpp:67 libraryLoad load D:\\Guido\\develop\\opencv\\build\\bin\\opencv\_core\_parallel\_openmp480\_64.dll =\> FAILED
> \[INFO:0@0.086\] global plugin\_loader.impl.hpp:67 libraryLoad load opencv\_core\_parallel\_openmp480\_64.dll =\> FAILED
> \[DEBUG:0@0.086\] global parallel.cpp:93 createParallelForAPI core(parallel): fallback on builtin code
> \[DEBUG:0@0.117\] global cap\_ffmpeg\_impl.hpp:1609 retrieveFrame Input picture format: yuv420p
> \[DEBUG:0@0.146\] global cap\_ffmpeg\_impl.hpp:1609 retrieveFrame Input picture format: yuv420p
> ...
> \`\`\`
> 
> (Codec hevc always generated (near) lossless, no matter what crf is set.)
> 
> \### Issue submission checklist
> 
> \- \[X\] I report the issue, it's not a question
> \- \[X\] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
> \- \[X\] I updated to the latest OpenCV version and the issue is still there
> \- \[x\] There is reproducer code and related data files (videos, images, onnx, etc)

---

_[View the full topic](https://forum.opencv.org/t/unable-to-use-the-encoder-libx264-for-windows/16025)._
