videoio: use oneVPL load mechanism, encoder bitrate estimation#20614
videoio: use oneVPL load mechanism, encoder bitrate estimation#20614alalek merged 5 commits intoopencv:masterfrom
Conversation
| @@ -18,6 +18,7 @@ | |||
| # include <vpl/mfxvideo++.h> | |||
There was a problem hiding this comment.
Need to add version check into CMake scripts (for which versions we want to support).
mfxvideo++.h file is missing in case of old VPL_VERSION=2021.1.11
There was a problem hiding this comment.
I've added the check. Verified it with oneVPL 2021.1.1-66, 2021.2.2-212, 2021.4.0-328 from oneAPI and 2021.4.0 from GPGPU release. Support of 2021.1 has been successfully disabled. Additionally I've found that oneVPL has changed versioning scheme and 2021.4.0 is now "2.4", thus slightly more complex condition.
There was a problem hiding this comment.
I've found that oneVPL has changed versioning scheme and 2021.4.0 is now "2.4"
🤦♂️
Confirmed.
VPL_CONFIG=C:/Program Files (x86)/Intel/oneAPI/vpl/2021.4.0/lib/cmake/vpl/VPLConfig.cmake
...
VPL_VERSION=2.4
(enabled "Custom Win" builder, vpl-inspect dump is available on "init" step)
alalek
left a comment
There was a problem hiding this comment.
It make sense to eliminate/suppress deprecation build warnings.
| else if (codecId == MFX_CODEC_HEVC) | ||
| { | ||
| bitrate = (mp * 63 + 41) * pow(fps, 0.60f); | ||
| } |
There was a problem hiding this comment.
Do you know what is wrong with .h265 tests on "Custom Win" builder?
There was a problem hiding this comment.
I'm not sure what the problem is. In my tests on laptop with UHD 620 (27.20.100.9466) and oneVPL 2021.4.0 from oneAPI all MFX tests are green. Perhaps some combinations of HW / Driver / oneVPL are not working very well.
There was a problem hiding this comment.
I've increased bitrate slightly for HEVC. Let's see, maybe it will help.
There was a problem hiding this comment.
Looks like there is mess in frames order.
Attached captured frames and encoded videos of failed test cases: pr20614.zip
BTW, encoded videos are broken (check ffmpeg -i 1.265 -r 1/1 frame_%05d.png)
There was a problem hiding this comment.
I don't see suspicious messages in the ffmpeg output:
$ ffmpeg -i 1.265 -r 1/1 frame_%05d.png
ffmpeg version 4.3.2-0+deb11u1ubuntu1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Ubuntu 10.2.1-20ubuntu1)
configuration: --prefix=/usr --extra-version=0+deb11u1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, hevc, from '1.265':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuv420p(tv), 640x480 [SAR 1:1 DAR 4:3], 1 fps, 1 tbr, 1200k tbn, 1 tbc
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'frame_%05d.png':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: png, rgb24, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
Metadata:
encoder : Lavc58.91.100 png
frame= 20 fps=0.0 q=-0.0 Lsize=N/A time=00:00:20.00 bitrate=N/A speed= 837x
video:342kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Perhaps the video is too short and have challenging contents. We can try to increase bitrate even more for this codec, what do you think?
There was a problem hiding this comment.
encoded videos are broken
I mean in this two stage tests of encoding + decoding, the first encoding part is broken and provides incorrect results (check frame.png images).
There was a problem hiding this comment.
Aah, yes. It is usually the encoding which breaks in these tests 😃, that's why I tried to increase the bitrate. I don't see what else we can do here, maybe upgrading the driver on the test machine would help.
45b1624 to
2165573
Compare
videoio: use oneVPL load mechanism, encoder bitrate estimation * videoio: updated oneVPL support - use mfxLoad * videoio: advanced bitrate estimation for MFX encoder * videoio: improved MediaSDK/oneVPL/libva detection * videoio(ffmpeg): don't try oneVPL * videoio(test): tune checks of videoio_mfx.read_write_raw tests Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Troubleshooting:
(Linux) crash with following message might be caused by outdated kernel (observed with Linux 4.4.0)
need to upgrade Linux kernel