Unable to read h264 video on PiZero with C++ static build

I took a look at your latest cmake configuration log. that issue seems to be it.

it says “Specify ‘pkgcfg_lib_FFMPEG_something’ manually”. if it says that, I believe doing that would solve that issue. I can’t predict if another layer of errors will show up after that.

perhaps reconsider wanting to get a static build. that is simply not a normal use-case for OpenCV.

Thanks @crackwitz.

Just a general thinking… Could you tell me if I’m wrong?

  • My goal is to compile a program statically so as I can easily deploy it on different Pi Zeros.
  • I sucessfully built statically a program but the program has an error while reading a h264 video
  • I failed to compile statically opencv WITH FFMPEG

==> Is it possible to get rid of FFMPEG and use GSTREAMER (or other) to read this h264 video with opencv? If yes, I think this could solve my problem…

gstreamer can be used to read video files.

the problem is always whether those libraries will allow themselves to be linked statically as well, even if you can get OpenCV linked statically. it’s a legal question unfortunately.

dynamic linking isn’t such a problem. you just have to package/ship all the dependencies (except those you can fully expect to be on another system, such as libc), and then make sure your program can find them.

random google result: Distributing a C++ program on Linux | pvigier’s blog

OK @crackwitz, I will test a last time a static compilation with gstreamer instead of FFMPEG and keep you informed.
If it doesn’t work, I will come back to a more standard compilation (which works on PiZero) with shared libraries.

Thanks a lot for your help.

Just a message to conlude.
I did not succeed in running my code without errors even if the static compilation has worked without errors.
So I compiled opencv in the standard way for PiZero (dynamic linking) and I’ve moved all needed libs to others PiZero for deploying my program.
Thanks again to all for all your answers.

will only build static opencv libs. you still have a dynamic dependancy to gstreamer, ffmpeg, and whatever gui you’re using