OpenCV VideoWriter crashing plugin
AnsweredHi,
I'm trying to use cv::VideoWriter in my plugin code to create a video, but everytime I try to create a VideoWriter object, the plugin never gets called.
I've included:
#include <opencv2/core.hpp>
#include <opencv2/dnn/dnn.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv2/videoio.hpp>
Code line that causes problem (somewhere within DeviceAgent::pushUncompressedVideoFrame function):
cv::VideoWriter outputVideo;
If I comment out the above line of code, plugin works fine and gets unprocessed frames from the Meta Server.
When I add the code, it doesn't create the Engine. There are no errors, but the plugin just doesn't get called.
Am I missing some libraries for supporting videos? I have ffmpeg on my system and my Opencv build info shows this:
General configuration for OpenCV 4.1.2 =====================================
Version control: unknown
Extra modules:
Location (extra): /home/forest/.conan/data/opencv/4.1.2/_/_/build/ff5c398d37be7adabdc0604de5791a626311d6d2/contrib/modules
Version control (extra): unknown
Platform:
Timestamp: 2022-07-21T06:02:04Z
Host: Linux 5.4.0-110-generic x86_64
CMake: 3.16.3
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
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 (14 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (27 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (3 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++:
Built as dynamic libs?: NO
C++ Compiler: /usr/bin/c++ (ver 9.4.0)
C++ flags (Release): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,-Bsymbolic,-znoexecstack -Wl,-Bsymbolic -m64 -Wl,--gc-sections
Linker flags (Debug): -Wl,-Bsymbolic,-znoexecstack -Wl,-Bsymbolic -m64 -Wl,--gc-sections
ccache: NO
Precompiled headers: NO
Extra dependencies: /home/forest/.conan/data/zlib/1.2.12/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libz.a ade /home/forest/.conan/data/libjpeg/9d/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libjpeg.a dl m pthread rt
3rdparty dependencies:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: freetype python_tests world
Disabled by dependency: -
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv hdf java js matlab ovis python2 python3 sfm ts viz
Applications: -
Documentation: NO
Non-free algorithms: NO
GUI:
Media I/O:
ZLib: /home/forest/.conan/data/zlib/1.2.12/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libz.a (ver )
JPEG: (ver 90)
HDR: NO
SUNRASTER: NO
PXM: NO
PFM: NO
Video I/O:
FFMPEG: YES (find_package)
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: YES (4.4)
Parallel framework: pthreads
Trace: YES (built-in)
Other third-party libraries:
Custom HAL: NO
Protobuf: /home/forest/.conan/data/protobuf/3.17.1/_/_/package/7627fae1426bcc12a67dba7c7207b1bccf05e5fd/lib/libprotoc.a /home/forest/.conan/data/protobuf/3.17.1/_/_/package/7627fae1426bcc12a67dba7c7207b1bccf05e5fd/lib/libprotobuf.a (3.17.1)
Python (for build): NO
Install to: /home/forest/.conan/data/opencv/4.1.2/_/_/package/ff5c398d37be7adabdc0604de5791a626311d6d2
=====================================
Any pointers would be appreciated!
-
Hi Smita,
Increase logLevel to DEBUG and check what happens with plugin library on server startup. It is likely mediaserver fails to load the library due to missing dependency or similar error. Please refer to support article explaining how to increase log level - https://support.networkoptix.com/hc/en-us/articles/236033688-How-to-change-software-logging-level-and-how-to-get-logs
Please sign in to leave a comment.
Comments
2 comments