2 # Copyright (C) 2006-2017 OpenWrt.org
3 # Copyright (C) 2017 Ian Leonard <antonlacon@gmail.com>
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
15 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.xz
16 PKG_SOURCE_URL
:=https
://ffmpeg.org
/releases
/
17 PKG_HASH
:=28e75fc32485a88035a7ebf0a956a1e5c7e93b440dd4bbd6bc30c7268cf34fe9
18 PKG_MAINTAINER
:=Ted Hess
<thess@kitschensync.net
>, \
19 Ian Leonard
<antonlacon@gmail.com
>
21 PKG_LICENSE
:=LGPL-2.1
+ GPL-2
+ LGPL-3
22 PKG_LICENSE_FILES
:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
24 FFMPEG_CUSTOM_ENCODERS
:= \
36 FFMPEG_CUSTOM_DECODERS
:= \
67 FFMPEG_CUSTOM_MUXERS
:= \
80 FFMPEG_CUSTOM_DEMUXERS
:= \
108 FFMPEG_CUSTOM_PARSERS
:= \
119 FFMPEG_CUSTOM_PROTOCOLS
:= \
120 file http icecast pipe rtp tcp udp
122 FFMPEG_MINI_DECODERS
:= \
141 FFMPEG_MINI_DEMUXERS
:= \
151 FFMPEG_MINI_PROTOCOLS
:= \
154 FFMPEG_AUDIO_DECODERS
:= \
179 FFMPEG_AUDIO_DEMUXERS
:= \
202 FFMPEG_AUDIO_PARSERS
:= \
210 FFMPEG_AUDIO_PROTOCOLS
:= \
211 file http icecast rtp tcp udp
214 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(BUILD_VARIANT
)/$(PKG_NAME
)-$(PKG_VERSION
)
216 PKG_CONFIG_DEPENDS
:= \
217 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_
%,$(FFMPEG_CUSTOM_ENCODERS
)) \
218 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_
%,$(FFMPEG_CUSTOM_DECODERS
)) \
219 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
220 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
221 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_
%,$(FFMPEG_CUSTOM_PARSERS
)) \
222 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_
%,$(FFMPEG_CUSTOM_PROTOCOLS
))
224 include $(INCLUDE_DIR
)/package.mk
226 define Package
/ffmpeg
/Default
228 URL
:=https
://ffmpeg.org
/
229 DEPENDS
+= +libpthread
232 define Package
/ffmpeg
/Default
/description
233 FFmpeg is a a software package that can record
, convert and stream digital
234 audio and video in numerous formats.
238 define Package
/ffmpeg
239 $(call Package
/ffmpeg
/Default
)
243 DEPENDS
+= +libffmpeg-full
247 define Package
/ffmpeg
/description
248 $(call Package
/ffmpeg
/Default
/description
)
250 This package contains the FFmpeg command line tool.
254 define Package
/ffprobe
255 $(call Package
/ffmpeg
/Default
)
258 TITLE
+= CLI media identifier
259 DEPENDS
+= +libffmpeg-full
263 define Package
/ffprobe
/description
264 $(call Package
/ffmpeg
/Default
/description
)
266 This package contains the FFprobe command line tool.
270 define Package
/ffserver
271 $(call Package
/ffserver
/Default
)
274 TITLE
+= streaming server
275 DEPENDS
+= +libffmpeg-full
279 define Package
/ffserver
/description
280 $(call Package
/ffmpeg
/Default
/description
)
282 This package contains the FFmpeg streaming server.
285 define Package
/libffmpeg
/Default
286 $(call Package
/ffmpeg
/Default
)
290 DEPENDS
+= +libpthread
+zlib
+libbz2
295 define Package
/libffmpeg-custom
296 $(call Package
/libffmpeg
/Default
)
298 DEPENDS
+= +FFMPEG_CUSTOM_SELECT_libopus
:libopus \
299 +PACKAGE_libx264
:libx264
+PACKAGE_lame-lib
:lame-lib \
300 +FFMPEG_CUSTOM_SELECT_libshine
:shine \
301 +PACKAGE_fdk-aac
:fdk-aac
306 define Package
/libffmpeg-custom
/config
307 source
"$(SOURCE)/Config.in"
310 define Package
/libffmpeg-custom
/description
311 $(call Package
/ffmpeg
/Default
/description
)
313 This package contains customized FFmpeg shared libraries.
317 define Package
/libffmpeg-audio-dec
318 $(call Package
/libffmpeg
/Default
)
320 DEPENDS
+= @BUILD_PATENTED
324 define Package
/libffmpeg-audio-dec
/description
325 $(call Package
/ffmpeg
/Default
/description
)
327 This package contains FFmpeg shared libraries for audio decoding
331 define Package
/libffmpeg-full
332 $(call Package
/libffmpeg
/Default
)
334 DEPENDS
+= @BUILD_PATENTED
+alsa-lib
+PACKAGE_libopus
:libopus
335 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
336 DEPENDS
+= +PACKAGE_shine
:shine
338 DEPENDS
+= +PACKAGE_lame-lib
:lame-lib
+PACKAGE_libx264
:libx264
344 define Package
/libffmpeg-full
/description
345 $(call Package
/ffmpeg
/Default
/description
)
347 This package contains full-featured FFmpeg shared libraries.
351 define Package
/libffmpeg-mini
352 $(call Package
/libffmpeg
/Default
)
354 DEPENDS
+= @BUILD_PATENTED
358 define Package
/libffmpeg-mini
/description
359 $(call Package
/ffmpeg
/Default
/description
)
361 This package contains minimal-featured FFmpeg shared libraries.
366 CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
367 LDFLAGS
="$(TARGET_LDFLAGS)" \
369 --enable-cross-compile \
370 --cross-prefix
="$(TARGET_CROSS)" \
374 --pkg-config
="pkg-config" \
387 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
395 --disable-inline-asm \
397 --disable-mipsdspr2 \
401 --disable-fast-unaligned \
402 --disable-runtime-cpudetect
404 else ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
406 --disable-runtime-cpudetect
407 # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
408 else ifneq ($(findstring powerpc
,$(CONFIG_ARCH
)),)
413 # selectively disable optimizations according to arch/cpu type
414 ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
415 ifneq ($(findstring vfp
,$(CONFIG_TARGET_OPTIMIZATION
)),)
416 FFMPEG_CONFIGURE
+= --enable-vfp
418 FFMPEG_CONFIGURE
+= --disable-vfp
420 ifneq ($(findstring neon
,$(CONFIG_TARGET_OPTIMIZATION
)),)
425 FFMPEG_CONFIGURE
+= --disable-neon
430 ifneq ($(CONFIG_YASM
),y
)
431 FFMPEG_CONFIGURE
+= --disable-yasm
435 ifeq ($(BUILD_VARIANT
),full
)
437 --enable-avresample \
438 $(if
$(CONFIG_PACKAGE_libopus
),--enable-libopus
)
439 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
443 $(if
$(CONFIG_PACKAGE_shine
),--enable-libshine
)
445 ifeq ($(ARCH
),x86_64
)
446 FFMPEG_CONFIGURE
+= --enable-hardcoded-tables
448 FFMPEG_CONFIGURE
+= --enable-small
453 $(if
$(CONFIG_PACKAGE_lame-lib
),--enable-libmp3lame
) \
454 $(if
$(CONFIG_PACKAGE_libx264
),--enable-libx264
)
458 ifeq ($(BUILD_VARIANT
),custom
)
462 $(if
$($(3)_
$(c
)),--enable-
$(1)="$(c)") \
465 ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE
),y
)
467 --enable-hardcoded-tables
473 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL
),y
)
474 FFMPEG_CONFIGURE
+= --enable-gpl
477 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3
),y
)
478 FFMPEG_CONFIGURE
+= --enable-version3
481 ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE
),y
)
482 FFMPEG_CONFIGURE
+= --enable-nonfree
489 --disable-swresample \
491 --disable-everything \
492 $(call FFMPEG_ENABLE
,encoder
,$(FFMPEG_CUSTOM_ENCODERS
),CONFIG_FFMPEG_CUSTOM_ENCODER
) \
493 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_CUSTOM_DECODERS
),CONFIG_FFMPEG_CUSTOM_DECODER
) \
494 $(call FFMPEG_ENABLE
,muxer
,$(FFMPEG_CUSTOM_MUXERS
),CONFIG_FFMPEG_CUSTOM_MUXER
) \
495 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_CUSTOM_DEMUXERS
),CONFIG_FFMPEG_CUSTOM_DEMUXER
) \
496 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_CUSTOM_PARSERS
),CONFIG_FFMPEG_CUSTOM_PARSER
) \
497 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_CUSTOM_PROTOCOLS
),CONFIG_FFMPEG_CUSTOM_PROTOCOL
) \
499 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm
),y
)
501 --enable-decoder
=adpcm_ima_wav \
502 --enable-decoder
=adpcm_ima_qt \
503 --enable-decoder
=adpcm_ms
506 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac
),y
)
508 --enable-libfdk-aac
--enable-encoder
=libfdk_aac
511 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame
),y
)
513 --enable-libmp3lame
--enable-encoder
=libmp3lame
516 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus
),y
)
518 --enable-libopus
--enable-decoder
=libopus
--enable-encoder
=libopus
521 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine
),y
)
523 --enable-libshine
--enable-encoder
=libshine
526 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264
),y
)
528 --enable-libx264
--enable-encoder
=libx264
533 ifeq ($(BUILD_VARIANT
),audio-dec
)
537 --enable-
$(1)="$(c)" \
547 --disable-swresample \
549 --disable-everything \
550 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_AUDIO_DECODERS
)) \
551 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_AUDIO_DEMUXERS
)) \
552 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_AUDIO_PARSERS
)) \
553 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
554 --disable-decoder
=pcm_bluray
,pcm_dvd \
558 ifeq ($(BUILD_VARIANT
),mini
)
562 --enable-
$(1)="$(c)" \
572 --disable-swresample \
574 --disable-everything \
575 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
576 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
577 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
))
580 ifneq ($(CONFIG_TARGET_x86
),)
581 TARGET_CFLAGS
+= -fomit-frame-pointer
584 define Build
/Configure
585 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
589 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
590 DESTDIR
="$(PKG_INSTALL_DIR)" \
594 define Build
/InstallDev
/custom
595 $(INSTALL_DIR
) $(1)/usr
/include
596 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
597 $(INSTALL_DIR
) $(1)/usr
/lib
598 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
599 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
600 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
603 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
604 define Build
/InstallDev
/full
605 $(INSTALL_DIR
) $(1)/usr
/include
606 $(INSTALL_DIR
) $(1)/usr
/lib
607 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
608 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
} $(1)/usr
/include/
609 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
610 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
611 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
612 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpostproc
$(1)/usr
/include/
613 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.
{a
,so
*} $(1)/usr
/lib
/
614 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libpostproc.
pc $(1)/usr
/lib
/pkgconfig
/
618 define Build
/InstallDev
/mini
619 $(INSTALL_DIR
) $(1)/usr
/include
620 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
621 $(INSTALL_DIR
) $(1)/usr
/lib
622 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
623 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
624 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
627 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
629 # XXX: attempt at installing "best" dev files available
630 ifeq ($(BUILD_VARIANT
),custom
)
631 # XXX: only install "custom" dev files if -full & -mini are not selected
632 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
633 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
636 ifeq ($(BUILD_VARIANT
),audio-dec
)
637 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
638 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
639 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
642 ifeq ($(BUILD_VARIANT
),full
)
643 # XXX: always install "full" dev files if -full is selected
644 Build
/InstallDev
= $(Build
/InstallDev
/full
)
646 ifeq ($(BUILD_VARIANT
),mini
)
647 # XXX: only install "mini" dev files if -full is not selected
648 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
649 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
653 define Package
/ffmpeg
/install
654 $(INSTALL_DIR
) $(1)/usr
/bin
655 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
658 define Package
/ffprobe
/install
659 $(INSTALL_DIR
) $(1)/usr
/bin
660 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
663 define Package
/ffserver
/install
664 $(INSTALL_DIR
) $(1)/usr
/bin
665 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
668 define Package
/libffmpeg-custom
/install
669 $(INSTALL_DIR
) $(1)/usr
/lib
670 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
673 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
674 define Package
/libffmpeg-full
/install
675 $(INSTALL_DIR
) $(1)/usr
/lib
676 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
677 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
678 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.so.
* $(1)/usr
/lib
/
682 define Package
/libffmpeg-mini
/install
683 $(INSTALL_DIR
) $(1)/usr
/lib
684 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
687 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
689 $(eval
$(call BuildPackage
,ffmpeg
))
690 $(eval
$(call BuildPackage
,ffprobe
))
691 $(eval
$(call BuildPackage
,ffserver
))
692 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
693 $(eval
$(call BuildPackage
,libffmpeg-full
))
694 $(eval
$(call BuildPackage
,libffmpeg-mini
))
695 ifneq ($(CONFIG_ALL
),y
)
696 $(eval
$(call BuildPackage
,libffmpeg-custom
))