1

I am trying to cross compile opencv with ffmpeg support for an arm board with a buildroot based custom linux. The host is an ubuntu PC.

I want static opencv libraries.

I have downloaded ffmpeg source and crosscompiled it with the following configuration

./configure \
--enable-cross-compile \
--cross-prefix=arm-linux-gnueabihf- \
--target-os=linux \
--arch=arm \
--disable-static \
--enable-shared \
--enable-nonfree \
--enable-ffmpeg \
--enable-gpl \
--enable-swscale \
--enable-pthreads \
--disable-yasm \
--disable-stripping \
--prefix=../build \
--extra-cflags=-I../build/include --extra-ldflags=-L../build/lib

The paths are all correct and ffmpeg is built successfully. Then when I try to configure opencv with cmake-gui, I have to manually specify all paths.
But despite this, opencv configuration is unable to resolve FFMPEG correctly

I have attached the screen shot below

CMAKE-GUI

It cannot resolve ffmpeg versions. I tried to ignore it and build but it fails with linker error

Linking CXX static library ../../lib/libopencv_features2d.a
[ 49%] Built target opencv_features2d
make: *** [all] Error 2
azmath
  • 863
  • 1
  • 11
  • 30
  • Instead of *manually* filling paths to all libraries, it is better to set `FFMPEG_DIR` *environment* variable to the directory where FFMPEG is installed (`<...>/other_libs/ffmpeg/build` in your case), so script `FindFFMPEG.cmake` will be able to detect package *by itself* and fill all needed variables. (Note, that not all variables describing the package are shown in CMake cache). – Tsyvarev Nov 10 '16 at 12:33
  • Thanks, will try and let you know tomorrow – azmath Nov 10 '16 at 12:40
  • I used the option ADD ENTRY in the cmake-gui and pointed it to that path. But on clicking configure, it doesn't resolve anything. All FFMPEG fields stay NO. `FFMPEG: NO codec: NO format: NO util: NO swscale: NO resample: NO gentoo-style: YES` – azmath Nov 11 '16 at 05:12
  • I also set ffmpeg dir environment variable from a separate shell. then restarted cmake-gui and on configure it doesn't detect ffmpeg. Did i build ffmpeg wrong? – azmath Nov 11 '16 at 05:27
  • Hm, there are different `FindFFMPEG.cmake` scripts, probably, OpenCV uses one without checking `FFMPEG_DIR`. You may try to set `CMAKE_PREFIX_PATH` variable, as described in [this answer](http://stackoverflow.com/questions/34795816/hinting-findname-cmake-files-with-a-custom-directory/34797156#34797156): such approach works in most cases. – Tsyvarev Nov 11 '16 at 08:55
  • I decided to install ffmpeg in /usr/arm-linux-gnueabihf directory directly. This helped cmake in detecting ffmpeg automatically but it still is unable to resolve the version. I also used option --disable-pic but no luck. I do get the warning after ffmpeg configure `arm-linux-gnueabihf-pkg-config not found, library detection may fail` – azmath Nov 14 '16 at 06:31

0 Answers0