opened 05:54PM - 21 Nov 23 UTC
bug
### 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)