Compile OpenCV + Gstreamer for others

I created a project which uses OpenCV and Gstreamer (receiving udp stream), It’s working perfectly fine if open with Visual Studio (Run button). But after compiling Release x64 MT and trying I not only need to throw a whole lot of GStreamer .dll files to open my app but even after it opens successfully when It comes to opening a stream I get a warning, because of which my program is not working (Capture return false)

[ WARN:0] global F:\Code\opencv_4.5.1\opencv-4.5.1\modules\videoio\src\cap_gstreamer.cpp (734) cv::GStreamerCapture::open OpenCV | GStreamer warning: Error opening bin: no element "udpsrc"
[ WARN:0] global F:\Code\opencv_4.5.1\opencv-4.5.1\modules\videoio\src\cap_gstreamer.cpp (501) cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

It seems like it can’t find something. My question is :

How to compile my project so any other Windows computer could open it and find all needed files? (bonus points for hiding .dlls)

Thanks

First thing to do is to run Dependency walker (or similar) tool to find required dlls at least:
https://www.dependencywalker.com/

Hopefully it shows you something that just needs copying over.

I think I don’t understand how to use this :sweat:

I opened my program with it, here file [https://we.tl/t-itiZY5mLo5], it doesn’t seem that it detected anything wrong?

It seems like a path to “H:\gstreamer\1.0\x86_64\bin” cause that problem
If I allow my program to use PATH and it’s in there - it’s working, but when I remove it and just copy-paste files from there to my program dir I get that “warning”.
How link those files the other way so it will work?

Dependency Walker has to actually run your program to discover the dependencies.

prepare the environment (PATH) such that your program works correctly, then use Dependency Walker to discover what DLLs it actually needs, and where it got them from.

Ok I make everything working with PATH
Now I Opened my exe with DependancyWalker and “started profiling”, which opened my application successfully
Now I got from that this [https://we.tl/t-zBSbH6Bwz3] but I think it’s changed my application to “CONHOST.EXE” where before was my program name, it’s that how it’s supposed to work?

Ok I found out, for some reason you need o move .dll files from GStreamer /bin folder to your application main directory, and in the previous folder copy GStreamer /lib folder

/MyFolder
   /my app
       /*.dll
       /myapp.exe
   /lib

*.dll-s from " \gstreamer\1.0\x86_64\bin "
/lib from " \gstreamer\1.0\x86_64 "

A whole lot of files, and it’s breaking my directory organization but it’s finally working - I someone found out how to fix that, please let me know :wink: