2022-02-05 14:23:32 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
|
|
|
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
|
|
|
|
PKG_NAME="ffmpeg"
|
|
|
|
PKG_LICENSE="LGPLv2.1+"
|
|
|
|
PKG_SITE="https://ffmpeg.org"
|
2022-12-09 13:54:53 +00:00
|
|
|
PKG_DEPENDS_TARGET="toolchain zlib bzip2 openssl speex"
|
2022-02-05 14:23:32 +00:00
|
|
|
PKG_LONGDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
|
2022-11-01 21:12:05 +00:00
|
|
|
|
2023-08-24 09:53:35 +00:00
|
|
|
PKG_VERSION="6.0"
|
2022-12-09 13:54:53 +00:00
|
|
|
PKG_URL="http://ffmpeg.org/releases/ffmpeg-${PKG_VERSION}.tar.xz"
|
|
|
|
PKG_PATCH_DIRS="kodi libreelec"
|
|
|
|
|
2023-08-24 09:53:35 +00:00
|
|
|
PKG_PATCH_DIRS+=" v4l2-request v4l2-drmprime"
|
2022-12-09 13:54:53 +00:00
|
|
|
|
|
|
|
post_unpack() {
|
|
|
|
# Fix FFmpeg version
|
|
|
|
if [ "${PROJECT}" = "Amlogic" ]; then
|
|
|
|
echo "${PKG_FFMPEG_BRANCH}-${PKG_VERSION:0:7}" > ${PKG_BUILD}/VERSION
|
|
|
|
else
|
|
|
|
echo "${PKG_VERSION}" > ${PKG_BUILD}/RELEASE
|
|
|
|
fi
|
|
|
|
}
|
2022-07-12 10:52:40 +00:00
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
# Dependencies
|
|
|
|
get_graphicdrivers
|
|
|
|
|
|
|
|
PKG_FFMPEG_HWACCEL="--enable-hwaccels"
|
|
|
|
|
2023-03-18 13:43:37 +00:00
|
|
|
case ${DEVICE} in
|
2023-10-11 13:09:32 +00:00
|
|
|
RK3588)
|
2023-03-18 13:43:37 +00:00
|
|
|
V4L2_SUPPORT=no
|
|
|
|
;;
|
2023-10-11 21:33:44 +00:00
|
|
|
*)
|
|
|
|
case ${PROJECT} in
|
|
|
|
Rockchip)
|
|
|
|
PKG_PATCH_DIRS+=" vf-deinterlace-v4l2m2m"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2023-03-18 13:43:37 +00:00
|
|
|
esac
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
if [ "${V4L2_SUPPORT}" = "yes" ]; then
|
|
|
|
PKG_DEPENDS_TARGET+=" libdrm"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory libdrm)"
|
|
|
|
PKG_FFMPEG_V4L2="--enable-v4l2_m2m --enable-libdrm"
|
|
|
|
|
2023-10-07 11:04:40 +00:00
|
|
|
case ${PROJECT} in
|
|
|
|
Amlogic|PC|Rockchip)
|
|
|
|
PKG_V4L2_REQUEST="yes"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
PKG_V4L2_REQUEST="no"
|
|
|
|
;;
|
|
|
|
esac
|
2023-09-13 18:36:41 +00:00
|
|
|
|
|
|
|
if [ "${PKG_V4L2_REQUEST}" = "yes" ]; then
|
|
|
|
PKG_DEPENDS_TARGET+=" systemd"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory systemd)"
|
|
|
|
PKG_FFMPEG_V4L2+=" --enable-libudev --enable-v4l2-request"
|
|
|
|
else
|
|
|
|
PKG_FFMPEG_V4L2+=" --disable-libudev --disable-v4l2-request"
|
|
|
|
fi
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
if [ "${PKG_V4L2_REQUEST}" = "yes" ]; then
|
|
|
|
PKG_DEPENDS_TARGET+=" systemd"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory systemd)"
|
|
|
|
PKG_FFMPEG_V4L2+=" --enable-libudev --enable-v4l2-request"
|
2022-07-12 10:52:40 +00:00
|
|
|
else
|
|
|
|
PKG_FFMPEG_V4L2+=" --disable-libudev --disable-v4l2-request"
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
else
|
2022-07-12 10:52:40 +00:00
|
|
|
PKG_FFMPEG_V4L2="--disable-v4l2_m2m --disable-libudev --disable-v4l2-request"
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${VAAPI_SUPPORT}" = "yes" ]; then
|
|
|
|
PKG_DEPENDS_TARGET+=" libva"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory libva)"
|
|
|
|
PKG_FFMPEG_VAAPI="--enable-vaapi"
|
|
|
|
else
|
|
|
|
PKG_FFMPEG_VAAPI="--disable-vaapi"
|
|
|
|
fi
|
|
|
|
|
2023-09-13 18:36:41 +00:00
|
|
|
if [ "${DISPLAYSERVER}" != "wl" ]; then
|
2022-07-12 10:52:40 +00:00
|
|
|
PKG_DEPENDS_TARGET+=" libdrm"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory libdrm)"
|
|
|
|
PKG_FFMPEG_VAAPI=" --enable-libdrm"
|
|
|
|
fi
|
|
|
|
|
2023-09-13 18:36:41 +00:00
|
|
|
if [ "${VDPAU_SUPPORT}" = "yes" -a "${DISPLAYSERVER}" = "wl" ]; then
|
2022-02-05 14:23:32 +00:00
|
|
|
PKG_DEPENDS_TARGET+=" libvdpau"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory libvdpau)"
|
|
|
|
PKG_FFMPEG_VDPAU="--enable-vdpau"
|
|
|
|
else
|
|
|
|
PKG_FFMPEG_VDPAU="--disable-vdpau"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if build_with_debug; then
|
|
|
|
PKG_FFMPEG_DEBUG="--enable-debug --disable-stripping"
|
|
|
|
else
|
|
|
|
PKG_FFMPEG_DEBUG="--disable-debug --enable-stripping"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if target_has_feature neon; then
|
|
|
|
PKG_FFMPEG_FPU="--enable-neon"
|
|
|
|
else
|
|
|
|
PKG_FFMPEG_FPU="--disable-neon"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${TARGET_ARCH}" = "x86_64" ]; then
|
|
|
|
PKG_DEPENDS_TARGET+=" nasm:host"
|
|
|
|
fi
|
|
|
|
|
2023-08-29 12:43:12 +00:00
|
|
|
case ${PROJECT} in
|
|
|
|
Rockchip)
|
|
|
|
PKG_DEPENDS_TARGET+=" rkmpp"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-07-12 10:52:40 +00:00
|
|
|
if target_has_feature "(neon|sse)"; then
|
|
|
|
PKG_DEPENDS_TARGET+=" dav1d"
|
|
|
|
PKG_NEED_UNPACK+=" $(get_pkg_directory dav1d)"
|
|
|
|
PKG_FFMPEG_AV1="--enable-libdav1d"
|
|
|
|
else
|
|
|
|
PKG_FFMPEG_AV1="--disable-libdav1d"
|
|
|
|
fi
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
pre_configure_target() {
|
|
|
|
cd ${PKG_BUILD}
|
|
|
|
rm -rf .${TARGET_NAME}
|
|
|
|
}
|
|
|
|
|
2022-07-12 10:52:40 +00:00
|
|
|
if [ "${FFMPEG_TESTING}" = "yes" ]; then
|
|
|
|
PKG_FFMPEG_TESTING="--enable-encoder=wrapped_avframe --enable-muxer=null"
|
|
|
|
if [ "${PROJECT}" = "RPi" ]; then
|
|
|
|
PKG_FFMPEG_TESTING+=" --enable-vout-drm --enable-outdev=vout_drm"
|
|
|
|
fi
|
2022-11-01 21:12:05 +00:00
|
|
|
else
|
|
|
|
PKG_FFMPEG_TESTING="--disable-programs"
|
2022-07-12 10:52:40 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
configure_target() {
|
|
|
|
./configure --prefix="/usr" \
|
|
|
|
--cpu="${TARGET_CPU}" \
|
|
|
|
--arch="${TARGET_ARCH}" \
|
|
|
|
--enable-cross-compile \
|
|
|
|
--cross-prefix="${TARGET_PREFIX}" \
|
|
|
|
--sysroot="${SYSROOT_PREFIX}" \
|
|
|
|
--sysinclude="${SYSROOT_PREFIX}/usr/include" \
|
|
|
|
--target-os="linux" \
|
|
|
|
--nm="${NM}" \
|
|
|
|
--ar="${AR}" \
|
|
|
|
--as="${CC}" \
|
|
|
|
--cc="${CC}" \
|
|
|
|
--ld="${CC}" \
|
|
|
|
--host-cc="${HOST_CC}" \
|
|
|
|
--host-cflags="${HOST_CFLAGS}" \
|
|
|
|
--host-ldflags="${HOST_LDFLAGS}" \
|
|
|
|
--extra-cflags="${CFLAGS}" \
|
|
|
|
--extra-ldflags="${LDFLAGS}" \
|
|
|
|
--extra-libs="${PKG_FFMPEG_LIBS}" \
|
|
|
|
--disable-static \
|
|
|
|
--enable-shared \
|
2022-11-01 21:12:05 +00:00
|
|
|
--enable-version3 \
|
2022-02-05 14:23:32 +00:00
|
|
|
--enable-logging \
|
|
|
|
--disable-doc \
|
|
|
|
${PKG_FFMPEG_DEBUG} \
|
|
|
|
--enable-pic \
|
|
|
|
--pkg-config="${TOOLCHAIN}/bin/pkg-config" \
|
|
|
|
--enable-optimizations \
|
|
|
|
--disable-extra-warnings \
|
|
|
|
--enable-avdevice \
|
|
|
|
--enable-avcodec \
|
|
|
|
--enable-avformat \
|
|
|
|
--enable-swscale \
|
|
|
|
--enable-postproc \
|
|
|
|
--enable-avfilter \
|
|
|
|
--disable-devices \
|
|
|
|
--enable-pthreads \
|
|
|
|
--enable-network \
|
2022-12-09 13:54:53 +00:00
|
|
|
--disable-gnutls --enable-openssl \
|
2022-02-05 14:23:32 +00:00
|
|
|
--disable-gray \
|
|
|
|
--enable-swscale-alpha \
|
|
|
|
--disable-small \
|
|
|
|
--enable-dct \
|
|
|
|
--enable-fft \
|
|
|
|
--enable-mdct \
|
|
|
|
--enable-rdft \
|
|
|
|
--disable-crystalhd \
|
|
|
|
${PKG_FFMPEG_V4L2} \
|
|
|
|
${PKG_FFMPEG_VAAPI} \
|
|
|
|
${PKG_FFMPEG_VDPAU} \
|
|
|
|
${PKG_FFMPEG_RPI} \
|
|
|
|
--enable-runtime-cpudetect \
|
|
|
|
--disable-hardcoded-tables \
|
|
|
|
--disable-encoders \
|
|
|
|
--enable-encoder=ac3 \
|
|
|
|
--enable-encoder=aac \
|
|
|
|
--enable-encoder=wmav2 \
|
|
|
|
--enable-encoder=mjpeg \
|
|
|
|
--enable-encoder=png \
|
|
|
|
${PKG_FFMPEG_HWACCEL} \
|
|
|
|
--disable-muxers \
|
|
|
|
--enable-muxer=spdif \
|
|
|
|
--enable-muxer=adts \
|
|
|
|
--enable-muxer=asf \
|
|
|
|
--enable-muxer=ipod \
|
|
|
|
--enable-muxer=mpegts \
|
|
|
|
--enable-demuxers \
|
|
|
|
--enable-parsers \
|
|
|
|
--enable-bsfs \
|
|
|
|
--enable-protocol=http \
|
|
|
|
--disable-indevs \
|
|
|
|
--disable-outdevs \
|
|
|
|
--enable-filters \
|
|
|
|
--disable-avisynth \
|
|
|
|
--enable-bzlib \
|
|
|
|
--disable-lzma \
|
|
|
|
--disable-alsa \
|
|
|
|
--disable-frei0r \
|
|
|
|
--disable-libopencore-amrnb \
|
|
|
|
--disable-libopencore-amrwb \
|
|
|
|
--disable-libopencv \
|
|
|
|
--disable-libdc1394 \
|
|
|
|
--disable-libfreetype \
|
|
|
|
--disable-libgsm \
|
|
|
|
--disable-libmp3lame \
|
|
|
|
--disable-libopenjpeg \
|
|
|
|
--disable-librtmp \
|
|
|
|
${PKG_FFMPEG_AV1} \
|
|
|
|
--enable-libspeex \
|
|
|
|
--disable-libtheora \
|
|
|
|
--disable-libvo-amrwbenc \
|
|
|
|
--disable-libvorbis \
|
|
|
|
--disable-libvpx \
|
2022-07-12 10:52:40 +00:00
|
|
|
--disable-libx264 \
|
2022-02-05 14:23:32 +00:00
|
|
|
--disable-libxavs \
|
|
|
|
--disable-libxvid \
|
|
|
|
--enable-zlib \
|
|
|
|
--enable-asm \
|
|
|
|
--disable-altivec \
|
|
|
|
${PKG_FFMPEG_FPU} \
|
2022-07-12 10:52:40 +00:00
|
|
|
--disable-symver \
|
|
|
|
${PKG_FFMPEG_TESTING}
|
2022-02-05 14:23:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
post_makeinstall_target() {
|
|
|
|
rm -rf ${INSTALL}/usr/share/ffmpeg/examples
|
|
|
|
}
|