greetings,
i’m running into an error when i try to open and read an mp4 video, something about ‘missing a plugin’.
here is the program :
#include <iostream>
#include <filesystem>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
if (!filesystem::exists(argv[1])) {
cerr << "Video file not found: " << argv[1] << "\n";
return 1;
}
VideoCapture cap(argv[1]);
if (cap.isOpened()) {
cap.release();
cout << "OK!\n";
} else {
cerr << argv[1] << ": can't open video for reading\n";
}
}
running the program :
$ opencvread /data/ocr/1777366691553627/danse.mp4
[ INFO:0@0.009] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/videoio_registry.cpp (223) VideoBackendRegistry VIDEOIO: Enabled backends(7, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL_MFX(980); V4L2(970); CV_IMAGES(960); CV_MJPEG(950); UEYE(940)
[ INFO:0@0.010] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/backend_plugin.cpp (369) getPluginCandidates VideoIO plugin (FFMPEG): glob is 'libopencv_videoio_ffmpeg*.so', 1 location(s)
[ INFO:0@0.013] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/backend_plugin.cpp (379) getPluginCandidates - /usr/lib64: 0
[ INFO:0@0.013] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/backend_plugin.cpp (383) getPluginCandidates Found 0 plugin(s) for FFMPEG
[ INFO:0@0.018] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_gstreamer.cpp (1104) open OpenCV | GStreamer: /data/ocr/1777366691553627/danse.mp4
[ INFO:0@0.018] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_gstreamer.cpp (1137) open OpenCV | GStreamer: mode - FILE
[ WARN:0@0.036] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_gstreamer.cpp (2386) handleMessage OpenCV | GStreamer warning: your GStreamer installation is missing a required plugin
[ WARN:0@0.036] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_gstreamer.cpp (2401) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module qtdemux0 reported: Internal data stream error.
[ WARN:0@0.038] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_gstreamer.cpp (1356) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@0.038] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_gstreamer.cpp (862) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
MFX: Can't initialize session
[ INFO:0@0.038] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_images.cpp (282) icvExtractPattern Pattern: /data/ocr/1777366691553627/danse.mp%01d @ 4
[ INFO:0@0.040] global /builddir/build/BUILD/opencv-4.6.0/modules/videoio/src/cap_images.cpp (313) open CAP_IMAGES: Stop scanning. Can't read image file: /data/ocr/1777366691553627/danse.mp4
/data/ocr/1777366691553627/danse.mp4: can't open video for reading
(the error “warning: your GStreamer installation is missing a required plugin” sure is helpful…
)
i’ve verified that gstream’s libraries are installed :
$ sudo dnf list installed | grep -i gstream
gstreamer1.x86_64 1.22.12-3.el9 @appstream
gstreamer1-plugin-libav.x86_64 1.22.1-1.el9 @epel
gstreamer1-plugins-base.x86_64 1.22.12-5.el9_7 @appstream
gstreamer1-plugins-good.x86_64 1.22.12-5.el9_7 @appstream
i found the following when calling cv::getBuildInformation() :
Video I/O:
DC1394: NO
GStreamer: YES (1.18.4)
v4l/v4l2: YES (linux/videodev2.h)
Intel Media SDK: YES (/lib64/libmfx.so -lstdc++ /lib64/libdl.a /lib64/libva.so /lib64/libva-drm.so)
can anyone tell me what’s going wrong and how i can fix the problem?
what “required plugin”? where could this be?
reading MP4 video is pretty fundamental, i’m surprised it would be problematic right out of the box.
many thanks