blob: 162eb414b1bb5a8b308627ff1e88dc616d783eae [file] [log] [blame]
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video."
2DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \
3 mux, demux, stream, filter and play pretty much anything that humans and machines \
4 have created. It supports the most obscure ancient formats up to the cutting edge."
5HOMEPAGE = "https://www.ffmpeg.org/"
6SECTION = "libs"
7
8LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG"
9LICENSE:${PN} = "GPL-2.0-or-later"
10LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
11LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
12LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
13LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
14LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
15LICENSE:libpostproc = "GPL-2.0-or-later"
16LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
17LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}"
18LICENSE_FLAGS = "commercial"
19
20LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
21 file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
22 file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
23 file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
24
25SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz"
26
27SRC_URI[sha256sum] = "488c76e57dd9b3bee901f71d5c95eaf1db4a5a31fe46a28654e837144207c270"
28
29# https://nvd.nist.gov/vuln/detail/CVE-2023-39018
30# https://github.com/bramp/ffmpeg-cli-wrapper/issues/291
31# https://security-tracker.debian.org/tracker/CVE-2023-39018
32# https://bugzilla.suse.com/show_bug.cgi?id=CVE-2023-39018
33CVE_STATUS[CVE-2023-39018] = "cpe-incorrect: This issue belongs to ffmpeg-cli-wrapper \
34(Java wrapper around the FFmpeg CLI) and not ffmepg itself."
35
36# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
37ARM_INSTRUCTION_SET:armv4 = "arm"
38ARM_INSTRUCTION_SET:armv5 = "arm"
39ARM_INSTRUCTION_SET:armv6 = "arm"
40
41# Should be API compatible with libav (which was a fork of ffmpeg)
42# libpostproc was previously packaged from a separate recipe
43PROVIDES = "libav libpostproc"
44
45DEPENDS = "nasm-native"
46
47inherit autotools pkgconfig
48
49PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \
50 alsa bzlib lzma theora zlib \
51 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}"
52
53# libraries to build in addition to avutil
54PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
55PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter"
56PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec"
57PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat"
58PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample"
59PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale"
60PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc"
61
62# features to support
63PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
64PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec,"
65PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2"
66PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac"
67PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"
68PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
69PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
70PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus"
71PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
72PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz"
73PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk"
74PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
75PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
76PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
77PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
78PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt"
79PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg"
80PACKAGECONFIG[v4l2] = "--enable-libv4l2,--disable-libv4l2,v4l-utils"
81PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
82PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
83PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
84PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
85PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265"
86PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb"
87PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
88PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib"
89
90# Check codecs that require --enable-nonfree
91USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}"
92
93def cpu(d):
94 for arg in (d.getVar('TUNE_CCARGS') or '').split():
95 if arg.startswith('-mcpu='):
96 return arg[6:]
97 return 'generic'
98
99EXTRA_OECONF = " \
100 --disable-stripping \
101 --enable-pic \
102 --enable-shared \
103 --enable-pthreads \
104 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
105 \
106 --cross-prefix=${TARGET_PREFIX} \
107 \
108 --ld='${CCLD}' \
109 --cc='${CC}' \
110 --cxx='${CXX}' \
111 --arch=${TARGET_ARCH} \
112 --target-os='linux' \
113 --enable-cross-compile \
114 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \
115 --extra-ldflags='${LDFLAGS}' \
116 --sysroot='${STAGING_DIR_TARGET}' \
117 ${EXTRA_FFCONF} \
118 --libdir=${libdir} \
119 --shlibdir=${libdir} \
120 --datadir=${datadir}/ffmpeg \
121 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
122 --cpu=${@cpu(d)} \
123 --pkg-config=pkg-config \
124"
125
126EXTRA_OECONF:append:linux-gnux32 = " --disable-asm"
127
128EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
129EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
130EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}"
131EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}"
132EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \
133 --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa"
134EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic --disable-rvv --disable-asm"
135EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic"
136EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic"
137EXTRA_OECONF:append:armv7a = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}"
138EXTRA_OECONF:append:armv7ve = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}"
139
140# gold crashes on x86, another solution is to --disable-asm but thats more hacky
141# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684
142
143LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
144LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd ', '', d)}"
145
146EXTRA_OEMAKE = "V=1"
147
148do_configure() {
149 export TMPDIR="${B}/tmp"
150 mkdir -p ${B}/tmp
151 ${S}/configure ${EXTRA_OECONF}
152 sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=${TARGET_DBGSRC_DIR} --debug-prefix-map=${B}=${TARGET_DBGSRC_DIR},g" ${B}/ffbuild/config.mak
153}
154
155# patch out build host paths for reproducibility
156do_compile:prepend:class-target() {
157 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
158}
159
160PACKAGES =+ "libavcodec \
161 libavdevice \
162 libavfilter \
163 libavformat \
164 libavutil \
165 libpostproc \
166 libswresample \
167 libswscale"
168
169FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}"
170FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}"
171FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}"
172FILES:libavformat = "${libdir}/libavformat${SOLIBS}"
173FILES:libavutil = "${libdir}/libavutil${SOLIBS}"
174FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}"
175FILES:libswresample = "${libdir}/libswresample${SOLIBS}"
176FILES:libswscale = "${libdir}/libswscale${SOLIBS}"
177
178# ffmpeg disables PIC on some platforms (e.g. x86-32)
179INSANE_SKIP:${MLPREFIX}libavcodec = "textrel"
180INSANE_SKIP:${MLPREFIX}libavdevice = "textrel"
181INSANE_SKIP:${MLPREFIX}libavfilter = "textrel"
182INSANE_SKIP:${MLPREFIX}libavformat = "textrel"
183INSANE_SKIP:${MLPREFIX}libavutil = "textrel"
184INSANE_SKIP:${MLPREFIX}libswscale = "textrel"
185INSANE_SKIP:${MLPREFIX}libswresample = "textrel"
186INSANE_SKIP:${MLPREFIX}libpostproc = "textrel"