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
:= \
142 FFMPEG_MINI_DEMUXERS
:= \
153 FFMPEG_MINI_PROTOCOLS
:= \
156 FFMPEG_AUDIO_DECODERS
:= \
181 FFMPEG_AUDIO_DEMUXERS
:= \
204 FFMPEG_AUDIO_PROTOCOLS
:= \
205 file http icecast rtp tcp udp
208 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(BUILD_VARIANT
)/$(PKG_NAME
)-$(PKG_VERSION
)
210 PKG_CONFIG_DEPENDS
:= \
211 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_
%,$(FFMPEG_CUSTOM_ENCODERS
)) \
212 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_
%,$(FFMPEG_CUSTOM_DECODERS
)) \
213 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
214 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
215 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_
%,$(FFMPEG_CUSTOM_PARSERS
)) \
216 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_
%,$(FFMPEG_CUSTOM_PROTOCOLS
))
218 include $(INCLUDE_DIR
)/package.mk
220 define Package
/ffmpeg
/Default
222 URL
:=https
://ffmpeg.org
/
223 DEPENDS
+= +libpthread
226 define Package
/ffmpeg
/Default
/description
227 FFmpeg is a a software package that can record
, convert and stream digital
228 audio and video in numerous formats.
232 define Package
/ffmpeg
233 $(call Package
/ffmpeg
/Default
)
237 DEPENDS
+= +libffmpeg-full
241 define Package
/ffmpeg
/description
242 $(call Package
/ffmpeg
/Default
/description
)
244 This package contains the FFmpeg command line tool.
248 define Package
/ffprobe
249 $(call Package
/ffmpeg
/Default
)
252 TITLE
+= CLI media identifier
253 DEPENDS
+= +libffmpeg-full
257 define Package
/ffprobe
/description
258 $(call Package
/ffmpeg
/Default
/description
)
260 This package contains the FFprobe command line tool.
264 define Package
/ffserver
265 $(call Package
/ffserver
/Default
)
268 TITLE
+= streaming server
269 DEPENDS
+= +libffmpeg-full
273 define Package
/ffserver
/description
274 $(call Package
/ffmpeg
/Default
/description
)
276 This package contains the FFmpeg streaming server.
279 define Package
/libffmpeg
/Default
280 $(call Package
/ffmpeg
/Default
)
284 DEPENDS
+= +libpthread
+zlib
+libbz2
289 define Package
/libffmpeg-custom
290 $(call Package
/libffmpeg
/Default
)
292 DEPENDS
+= +FFMPEG_CUSTOM_SELECT_libopus
:libopus \
293 +PACKAGE_libx264
:libx264
+PACKAGE_lame-lib
:lame-lib \
294 +FFMPEG_CUSTOM_SELECT_libshine
:shine \
295 +PACKAGE_fdk-aac
:fdk-aac
300 define Package
/libffmpeg-custom
/config
301 source
"$(SOURCE)/Config.in"
304 define Package
/libffmpeg-custom
/description
305 $(call Package
/ffmpeg
/Default
/description
)
307 This package contains customized FFmpeg shared libraries.
311 define Package
/libffmpeg-audio-dec
312 $(call Package
/libffmpeg
/Default
)
314 DEPENDS
+= @BUILD_PATENTED
318 define Package
/libffmpeg-audio-dec
/description
319 $(call Package
/ffmpeg
/Default
/description
)
321 This package contains FFmpeg shared libraries for audio decoding
325 define Package
/libffmpeg-full
326 $(call Package
/libffmpeg
/Default
)
328 DEPENDS
+= @BUILD_PATENTED
+alsa-lib
+PACKAGE_libopus
:libopus
329 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
330 DEPENDS
+= +PACKAGE_shine
:shine
332 DEPENDS
+= +PACKAGE_lame-lib
:lame-lib
+PACKAGE_libx264
:libx264
338 define Package
/libffmpeg-full
/description
339 $(call Package
/ffmpeg
/Default
/description
)
341 This package contains full-featured FFmpeg shared libraries.
345 define Package
/libffmpeg-mini
346 $(call Package
/libffmpeg
/Default
)
348 DEPENDS
+= @BUILD_PATENTED
352 define Package
/libffmpeg-mini
/description
353 $(call Package
/ffmpeg
/Default
/description
)
355 This package contains minimal-featured FFmpeg shared libraries.
360 CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
361 LDFLAGS
="$(TARGET_LDFLAGS)" \
363 --enable-cross-compile \
364 --cross-prefix
="$(TARGET_CROSS)" \
368 --pkg-config
="pkg-config" \
381 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
389 --disable-inline-asm \
391 --disable-mipsdspr2 \
395 --disable-fast-unaligned \
396 --disable-runtime-cpudetect
398 else ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
400 --disable-runtime-cpudetect
401 # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
402 else ifneq ($(findstring powerpc
,$(CONFIG_ARCH
)),)
407 # selectively disable optimizations according to arch/cpu type
408 ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
409 FFMPEG_CONFIGURE
+= --enable-lto
411 ifneq ($(findstring vfp
,$(CONFIG_TARGET_OPTIMIZATION
)),)
412 FFMPEG_CONFIGURE
+= --enable-vfp
414 FFMPEG_CONFIGURE
+= --disable-vfp
416 ifneq ($(findstring neon
,$(CONFIG_TARGET_OPTIMIZATION
)),)
421 FFMPEG_CONFIGURE
+= --disable-neon
426 ifeq ($(ARCH
),x86_64
)
427 FFMPEG_CONFIGURE
+= --enable-lto
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
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
553 --disable-decoder
=pcm_bluray
,pcm_dvd \
557 ifeq ($(BUILD_VARIANT
),mini
)
561 --enable-
$(1)="$(c)" \
571 --disable-swresample \
573 --disable-everything \
574 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
575 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
576 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
))
579 ifneq ($(CONFIG_TARGET_x86
),)
580 TARGET_CFLAGS
+= -fomit-frame-pointer
583 define Build
/Configure
584 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
588 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
589 DESTDIR
="$(PKG_INSTALL_DIR)" \
593 define Build
/InstallDev
/custom
594 $(INSTALL_DIR
) $(1)/usr
/include
595 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
596 $(INSTALL_DIR
) $(1)/usr
/lib
597 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
598 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
599 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
602 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
603 define Build
/InstallDev
/full
604 $(INSTALL_DIR
) $(1)/usr
/include
605 $(INSTALL_DIR
) $(1)/usr
/lib
606 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
607 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
} $(1)/usr
/include/
608 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
609 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
610 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
611 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpostproc
$(1)/usr
/include/
612 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.
{a
,so
*} $(1)/usr
/lib
/
613 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libpostproc.
pc $(1)/usr
/lib
/pkgconfig
/
617 define Build
/InstallDev
/mini
618 $(INSTALL_DIR
) $(1)/usr
/include
619 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
620 $(INSTALL_DIR
) $(1)/usr
/lib
621 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
622 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
623 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
626 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
628 # XXX: attempt at installing "best" dev files available
629 ifeq ($(BUILD_VARIANT
),custom
)
630 # XXX: only install "custom" dev files if -full & -mini are not selected
631 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
632 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
635 ifeq ($(BUILD_VARIANT
),audio-dec
)
636 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
637 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
638 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
641 ifeq ($(BUILD_VARIANT
),full
)
642 # XXX: always install "full" dev files if -full is selected
643 Build
/InstallDev
= $(Build
/InstallDev
/full
)
645 ifeq ($(BUILD_VARIANT
),mini
)
646 # XXX: only install "mini" dev files if -full is not selected
647 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
648 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
652 define Package
/ffmpeg
/install
653 $(INSTALL_DIR
) $(1)/usr
/bin
654 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
657 define Package
/ffprobe
/install
658 $(INSTALL_DIR
) $(1)/usr
/bin
659 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
662 define Package
/ffserver
/install
663 $(INSTALL_DIR
) $(1)/usr
/bin
664 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
667 define Package
/libffmpeg-custom
/install
668 $(INSTALL_DIR
) $(1)/usr
/lib
669 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
672 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
673 define Package
/libffmpeg-full
/install
674 $(INSTALL_DIR
) $(1)/usr
/lib
675 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
676 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
677 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.so.
* $(1)/usr
/lib
/
681 define Package
/libffmpeg-mini
/install
682 $(INSTALL_DIR
) $(1)/usr
/lib
683 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
686 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
688 $(eval
$(call BuildPackage
,ffmpeg
))
689 $(eval
$(call BuildPackage
,ffprobe
))
690 $(eval
$(call BuildPackage
,ffserver
))
691 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
692 $(eval
$(call BuildPackage
,libffmpeg-full
))
693 $(eval
$(call BuildPackage
,libffmpeg-mini
))
694 ifneq ($(CONFIG_ALL
),y
)
695 $(eval
$(call BuildPackage
,libffmpeg-custom
))