Rk3399 solves the problem that opencv crossover cannot save video using ffmpeg
OPENCV Cross cannot be used FFMPEG The main reason for saving videos is :opencv Even if you don’t use ffmpeg It can also be compiled normally videoio modular , So the problem is compiling opencv when videoio Module not found ffmpeg, Here’s the picture :
resolvent :
1、 To write toolchain.cmake, among ffmpeg Installed to /opt/sysroot/usr, also /opt/sysroot/usr/lib/pkgconfig There is ffmpeg relevant pc file .
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_PROCESSOR aarch64 )
set( CMAKE_C_COMPILER aarch64-linux-gnu-gcc )
set( CMAKE_CXX_COMPILER aarch64-linux-gnu-g++ )
set( CMAKE_FIND_ROOT_PATH "/opt/sysroot/usr")
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
2、 install :pkg-config
apt-get install pkg-config
3、 add to PKG_CONFIG_PATH environment variable
export PKG_CONFIG_PATH=/opt/sysroot/usr/lib/pkgconfig
echo $PKG_CONFIG_PATH // Check whether the settings are effective
4、 perform cmake-gui, choice toolchain.cmake Cross compile file compilation , And check the compile option
5、cmake-gui adopt Add Entry Button to add OPENCV_ENABLE_PKG_CONFIG, choose bool type , tick .
6、 Click again Configure, You can see ffmpeg Found :
7、 And then click generate ==> make ==> make install; Finish compiling .
Read more here: Source link