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_MD5SUM
:=7a35bd97bd7253305bf5c0af5f9dd3ce
18 PKG_HASH
:=3751cebb5c71a861288267769114d12b966a7703a686a325d90a93707f3a6d9f
19 PKG_MAINTAINER
:=Ted Hess
<thess@kitschensync.net
>, \
20 Ian Leonard
<antonlacon@gmail.com
>
22 PKG_LICENSE
:=LGPL-2.1
+ GPL-2
+ LGPL-3
23 PKG_LICENSE_FILES
:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
25 FFMPEG_CUSTOM_ENCODERS
:= \
37 FFMPEG_CUSTOM_DECODERS
:= \
68 FFMPEG_CUSTOM_MUXERS
:= \
81 FFMPEG_CUSTOM_DEMUXERS
:= \
109 FFMPEG_CUSTOM_PARSERS
:= \
120 FFMPEG_CUSTOM_PROTOCOLS
:= \
121 file http icecast pipe rtp tcp udp
123 FFMPEG_MINI_DECODERS
:= \
142 FFMPEG_MINI_DEMUXERS
:= \
152 FFMPEG_MINI_PROTOCOLS
:= \
155 FFMPEG_AUDIO_DECODERS
:= \
180 FFMPEG_AUDIO_DEMUXERS
:= \
203 FFMPEG_AUDIO_PARSERS
:= \
211 FFMPEG_AUDIO_PROTOCOLS
:= \
212 file http icecast rtp tcp udp
215 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(BUILD_VARIANT
)/$(PKG_NAME
)-$(PKG_VERSION
)
217 PKG_CONFIG_DEPENDS
:= \
218 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_
%,$(FFMPEG_CUSTOM_ENCODERS
)) \
219 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_
%,$(FFMPEG_CUSTOM_DECODERS
)) \
220 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
221 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
222 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_
%,$(FFMPEG_CUSTOM_PARSERS
)) \
223 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_
%,$(FFMPEG_CUSTOM_PROTOCOLS
))
225 include $(INCLUDE_DIR
)/package.mk
227 define Package
/ffmpeg
/Default
229 URL
:=https
://ffmpeg.org
/
230 DEPENDS
+= +libpthread
233 define Package
/ffmpeg
/Default
/description
234 FFmpeg is a a software package that can record
, convert and stream digital
235 audio and video in numerous formats.
239 define Package
/ffmpeg
240 $(call Package
/ffmpeg
/Default
)
244 DEPENDS
+= +libffmpeg-full
248 define Package
/ffmpeg
/description
249 $(call Package
/ffmpeg
/Default
/description
)
251 This package contains the FFmpeg command line tool.
255 define Package
/ffprobe
256 $(call Package
/ffmpeg
/Default
)
259 TITLE
+= CLI media identifier
260 DEPENDS
+= +libffmpeg-full
264 define Package
/ffprobe
/description
265 $(call Package
/ffmpeg
/Default
/description
)
267 This package contains the FFprobe command line tool.
271 define Package
/ffserver
272 $(call Package
/ffserver
/Default
)
275 TITLE
+= streaming server
276 DEPENDS
+= +libffmpeg-full
280 define Package
/ffserver
/description
281 $(call Package
/ffmpeg
/Default
/description
)
283 This package contains the FFmpeg streaming server.
286 define Package
/libffmpeg
/Default
287 $(call Package
/ffmpeg
/Default
)
291 DEPENDS
+= +libpthread
+zlib
+libbz2
296 define Package
/libffmpeg-custom
297 $(call Package
/libffmpeg
/Default
)
299 DEPENDS
+= +FFMPEG_CUSTOM_SELECT_libopus
:libopus \
300 +PACKAGE_libx264
:libx264
+PACKAGE_lame-lib
:lame-lib \
301 +FFMPEG_CUSTOM_SELECT_libshine
:shine \
302 +PACKAGE_fdk-aac
:fdk-aac
307 define Package
/libffmpeg-custom
/config
308 source
"$(SOURCE)/Config.in"
311 define Package
/libffmpeg-custom
/description
312 $(call Package
/ffmpeg
/Default
/description
)
314 This package contains customized FFmpeg shared libraries.
318 define Package
/libffmpeg-audio-dec
319 $(call Package
/libffmpeg
/Default
)
321 DEPENDS
+= @BUILD_PATENTED
325 define Package
/libffmpeg-audio-dec
/description
326 $(call Package
/ffmpeg
/Default
/description
)
328 This package contains FFmpeg shared libraries for audio decoding
332 define Package
/libffmpeg-full
333 $(call Package
/libffmpeg
/Default
)
335 DEPENDS
+= @BUILD_PATENTED
+alsa-lib
+PACKAGE_libopus
:libopus
336 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
337 DEPENDS
+= +PACKAGE_shine
:shine
339 DEPENDS
+= +PACKAGE_lame-lib
:lame-lib
+PACKAGE_libx264
:libx264
345 define Package
/libffmpeg-full
/description
346 $(call Package
/ffmpeg
/Default
/description
)
348 This package contains full-featured FFmpeg shared libraries.
352 define Package
/libffmpeg-mini
353 $(call Package
/libffmpeg
/Default
)
355 DEPENDS
+= @BUILD_PATENTED
359 define Package
/libffmpeg-mini
/description
360 $(call Package
/ffmpeg
/Default
/description
)
362 This package contains minimal-featured FFmpeg shared libraries.
367 CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
368 LDFLAGS
="$(TARGET_LDFLAGS)" \
370 --enable-cross-compile \
371 --cross-prefix
="$(TARGET_CROSS)" \
375 --pkg-config
="pkg-config" \
390 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
391 FFMPEG_CONFIGURE
+= \
396 --disable-amd3dnowext \
414 --disable-inline-asm \
416 --disable-mipsdspr2 \
420 --disable-fast-unaligned \
421 --disable-runtime-cpudetect
423 else ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
424 FFMPEG_CONFIGURE
+= \
425 --disable-runtime-cpudetect
426 # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
427 else ifneq ($(findstring powerpc
,$(CONFIG_ARCH
)),)
428 FFMPEG_CONFIGURE
+= \
432 # selectively disable optimizations according to arch/cpu type
433 ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
434 ifneq ($(findstring vfp
,$(CONFIG_TARGET_OPTIMIZATION
)),)
441 ifneq ($(findstring neon
,$(CONFIG_TARGET_OPTIMIZATION
)),)
452 ifneq ($(CONFIG_YASM
),y
)
453 FFMPEG_CONFIGURE
+= \
458 ifeq ($(BUILD_VARIANT
),full
)
460 $(if
$(CONFIG_PACKAGE_libopus
),--enable-libopus
)
461 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
465 $(if
$(CONFIG_PACKAGE_shine
),--enable-libshine
)
471 $(if
$(CONFIG_PACKAGE_lame-lib
),--enable-libmp3lame
) \
472 $(if
$(CONFIG_PACKAGE_libx264
),--enable-libx264
)
476 ifeq ($(BUILD_VARIANT
),custom
)
480 $(if
$($(3)_
$(c
)),--enable-
$(1)="$(c)") \
483 ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE
),y
)
485 --enable-hardcoded-tables
491 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL
),y
)
492 FFMPEG_CONFIGURE
+= --enable-gpl
495 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3
),y
)
496 FFMPEG_CONFIGURE
+= --enable-version3
499 ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE
),y
)
500 FFMPEG_CONFIGURE
+= --enable-nonfree
507 --disable-swresample \
509 --disable-everything \
510 $(call FFMPEG_ENABLE
,encoder
,$(FFMPEG_CUSTOM_ENCODERS
),CONFIG_FFMPEG_CUSTOM_ENCODER
) \
511 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_CUSTOM_DECODERS
),CONFIG_FFMPEG_CUSTOM_DECODER
) \
512 $(call FFMPEG_ENABLE
,muxer
,$(FFMPEG_CUSTOM_MUXERS
),CONFIG_FFMPEG_CUSTOM_MUXER
) \
513 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_CUSTOM_DEMUXERS
),CONFIG_FFMPEG_CUSTOM_DEMUXER
) \
514 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_CUSTOM_PARSERS
),CONFIG_FFMPEG_CUSTOM_PARSER
) \
515 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_CUSTOM_PROTOCOLS
),CONFIG_FFMPEG_CUSTOM_PROTOCOL
) \
517 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm
),y
)
519 --enable-decoder
=adpcm_ima_wav \
520 --enable-decoder
=adpcm_ima_qt \
521 --enable-decoder
=adpcm_ms
524 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac
),y
)
526 --enable-libfdk-aac
--enable-encoder
=libfdk_aac
529 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame
),y
)
531 --enable-libmp3lame
--enable-encoder
=libmp3lame
534 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus
),y
)
536 --enable-libopus
--enable-decoder
=libopus
--enable-encoder
=libopus
539 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine
),y
)
541 --enable-libshine
--enable-encoder
=libshine
544 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264
),y
)
546 --enable-libx264
--enable-encoder
=libx264
551 ifeq ($(BUILD_VARIANT
),audio-dec
)
555 --enable-
$(1)="$(c)" \
565 --disable-swresample \
567 --disable-everything \
568 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_AUDIO_DECODERS
)) \
569 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_AUDIO_DEMUXERS
)) \
570 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_AUDIO_PARSERS
)) \
571 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
572 --disable-decoder
=pcm_bluray
,pcm_dvd \
576 ifeq ($(BUILD_VARIANT
),mini
)
580 --enable-
$(1)="$(c)" \
590 --disable-swresample \
592 --disable-everything \
593 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
594 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
595 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
))
598 ifneq ($(CONFIG_TARGET_x86
),)
599 TARGET_CFLAGS
+= -fomit-frame-pointer
602 define Build
/Configure
603 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
607 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
608 DESTDIR
="$(PKG_INSTALL_DIR)" \
612 define Build
/InstallDev
/custom
613 $(INSTALL_DIR
) $(1)/usr
/include
614 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
615 $(INSTALL_DIR
) $(1)/usr
/lib
616 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
617 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
618 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
621 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
622 define Build
/InstallDev
/full
623 $(INSTALL_DIR
) $(1)/usr
/include
624 $(INSTALL_DIR
) $(1)/usr
/lib
625 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
626 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
} $(1)/usr
/include/
627 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
628 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
629 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
630 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpostproc
$(1)/usr
/include/
631 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.
{a
,so
*} $(1)/usr
/lib
/
632 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libpostproc.
pc $(1)/usr
/lib
/pkgconfig
/
636 define Build
/InstallDev
/mini
637 $(INSTALL_DIR
) $(1)/usr
/include
638 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
639 $(INSTALL_DIR
) $(1)/usr
/lib
640 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
641 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
642 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
645 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
647 # XXX: attempt at installing "best" dev files available
648 ifeq ($(BUILD_VARIANT
),custom
)
649 # XXX: only install "custom" dev files if -full & -mini are not selected
650 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
651 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
654 ifeq ($(BUILD_VARIANT
),audio-dec
)
655 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
656 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
657 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
660 ifeq ($(BUILD_VARIANT
),full
)
661 # XXX: always install "full" dev files if -full is selected
662 Build
/InstallDev
= $(Build
/InstallDev
/full
)
664 ifeq ($(BUILD_VARIANT
),mini
)
665 # XXX: only install "mini" dev files if -full is not selected
666 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
667 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
671 define Package
/ffmpeg
/install
672 $(INSTALL_DIR
) $(1)/usr
/bin
673 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
676 define Package
/ffprobe
/install
677 $(INSTALL_DIR
) $(1)/usr
/bin
678 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
681 define Package
/ffserver
/install
682 $(INSTALL_DIR
) $(1)/usr
/bin
683 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
686 define Package
/libffmpeg-custom
/install
687 $(INSTALL_DIR
) $(1)/usr
/lib
688 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
691 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
692 define Package
/libffmpeg-full
/install
693 $(INSTALL_DIR
) $(1)/usr
/lib
694 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
695 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
696 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.so.
* $(1)/usr
/lib
/
700 define Package
/libffmpeg-mini
/install
701 $(INSTALL_DIR
) $(1)/usr
/lib
702 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
705 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
707 $(eval
$(call BuildPackage
,ffmpeg
))
708 $(eval
$(call BuildPackage
,ffprobe
))
709 $(eval
$(call BuildPackage
,ffserver
))
710 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
711 $(eval
$(call BuildPackage
,libffmpeg-full
))
712 $(eval
$(call BuildPackage
,libffmpeg-mini
))
713 ifneq ($(CONFIG_ALL
),y
)
714 $(eval
$(call BuildPackage
,libffmpeg-custom
))