Last active
October 17, 2023 14:11
-
-
Save Nullkooland/e2bc2ceca504d49dc3af8f78bf0849de to your computer and use it in GitHub Desktop.
Cross-compile FFmpeg for rockchip ARM platform using LLVM toolchain on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ARCH=armv7 | |
export CPU=armv7-a | |
export OS=linux | |
export TARGET=armv7-linux-gnueabihf | |
export SYSROOT=../sysroot | |
export PREFIX=/usr | |
export TOOLCHAIN=/usr/local/opt/llvm/bin | |
export CC=$TOOLCHAIN/clang | |
export CXX=$TOOLCHAIN/clang++ | |
export LD=$TOOLCHAIN/clang | |
export NM=$TOOLCHAIN/llvm-nm | |
export AS=$TOOLCHAIN/llvm-as | |
export AR=$TOOLCHAIN/llvm-ar | |
export RANLIB=$TOOLCHAIN/llvm-ranlib | |
export STRIP=$TOOLCHAIN/llvm-strip | |
export PKG_CONFIG=$(which pkg-config) | |
export PKG_CONFIG_LIBDIR=$SYSROOT/usr/lib/arm-linux-gnueabihf/pkgconfig | |
export PKG_CONFIG_SYSROOT_DIR=$SYSROOT | |
export TARGET_BUILD_DIR=$SYSROOT/home/firefly/ffmpeg | |
./configure \ | |
--enable-cross-compile --prefix=$PREFIX --cross-prefix=$TOOLCHAIN \ | |
--cc=$CC --cxx=$CXX --ld=$LD --nm=$NM --strip=$STRIP --ranlib=$RANLIB \ | |
--arch=$ARCH --cpu=$CPU --target-os=$OS --sysroot=$SYSROOT \ | |
--extra-cflags="--target=$TARGET -march=$CPU" \ | |
--extra-ldflags="--target=$TARGET -march=$CPU -fuse-ld=lld" \ | |
--pkg-config=$PKG_CONFIG --target-path=$TARGET_BUILD_DIR \ | |
--disable-static --enable-shared --enable-pic --enable-hardcoded-tables \ | |
--enable-gpl --enable-nonfree --enable-version3 \ | |
--disable-armv5te --disable-armv6 --disable-armv6t2 \ | |
--enable-rkmpp --enable-libdrm \ | |
--disable-doc --disable-htmlpages --disable-txtpages --disable-manpages --disable-podpages \ | |
--disable-encoders --enable-encoder=rawvideo --enable-encoder=wrapped_avframe \ | |
--disable-muxers --enable-muxer=null --enable-muxer=rtp --enable-muxer=rtsp --enable-demuxer=rawvideo --enable-muxer=mov --enable-muxer=mp4 \ | |
--disable-decoders --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=h264_rkmpp --enable-decoder=hevc_rkmpp --enable-decoder=vp9_rkmpp \ | |
--disable-filters --enable-filter=anull --enable-filter=null --enable-filter=aresample --enable-filter=pad --enable-filter=scale --enable-filter=overlay --enable-filter=amix --enable-filter=aresample \ | |
--disable-demuxers --enable-demuxer=sdp --enable-demuxer=matroska --enable-demuxer=rtp --enable-demuxer=rtsp --enable-demuxer=h264 --enable-demuxer=hevc --enable-demuxer=rawvideo --enable-demuxer=mpc --enable-demuxer=mov \ | |
--disable-parsers --enable-parser=mpeg4video --enable-parser=aac --enable-parser=h264 --enable-parser=hevc --enable-parser=vp9 \ | |
--disable-protocols --enable-protocol=file --enable-protocol=unix --enable-protocol=tcp --enable-protocol=udp --enable-protocol=udplite --enable-protocol=rtp --enable-protocol=async \ | |
--disable-bsfs --enable-bsf=null --enable-bsf=aac_adtstoasc --enable-bsf=h264_metadata --enable-bsf=h264_mp4toannexb --enable-bsf=hevc_metadata --enable-bsf=hevc_mp4toannexb --enable-bsf=vp9_metadata \ | |
--disable-indevs --enable-indev=v4l2 \ | |
--disable-outdevs --enable-outdev=v4l2 --enable-outdev=fbdev \ | |
--disable-hwaccels \ |
Does this enable hardware Encoding, Decoding or both for ffmpeg on rockchip arm?
Does this enable hardware Encoding, Decoding or both for ffmpeg on rockchip arm?
Unfortunately, HW encoding is not supported. You may need to use mpp APIs directly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A cautionary tale about
sshfs
: You NEED to specify-o follow_symlinks,transform_symlinks
when mounting the remote target rootfs to aSYSROOT
directory on the host. For Debian-based systems, some system shared libraries are symlinked to absolute paths, for instance/usr/lib/$arch/libm.so -> /lib/$arch/libm.so.6
, which causes big problem for cross-compilation since the compiler cannot locate those libraries (their symlinks are now pointing to the absolute paths on the host OS). If the compiler cannot find the shared libraries, it would try to use their static counterparts and causes subtle link errors. Make sure to specify thesshfs
options to map those absolute paths symlinks to relative paths.