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_PROTOCOLS
:= \
203 file http icecast rtp tcp udp
206 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(BUILD_VARIANT
)/$(PKG_NAME
)-$(PKG_VERSION
)
208 PKG_CONFIG_DEPENDS
:= \
209 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_
%,$(FFMPEG_CUSTOM_ENCODERS
)) \
210 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_
%,$(FFMPEG_CUSTOM_DECODERS
)) \
211 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
212 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
213 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_
%,$(FFMPEG_CUSTOM_PARSERS
)) \
214 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_
%,$(FFMPEG_CUSTOM_PROTOCOLS
))
216 include $(INCLUDE_DIR
)/package.mk
218 define Package
/ffmpeg
/Default
220 URL
:=https
://ffmpeg.org
/
221 DEPENDS
+= +libpthread
224 define Package
/ffmpeg
/Default
/description
225 FFmpeg is a a software package that can record
, convert and stream digital
226 audio and video in numerous formats.
230 define Package
/ffmpeg
231 $(call Package
/ffmpeg
/Default
)
235 DEPENDS
+= +libffmpeg-full
239 define Package
/ffmpeg
/description
240 $(call Package
/ffmpeg
/Default
/description
)
242 This package contains the FFmpeg command line tool.
246 define Package
/ffprobe
247 $(call Package
/ffmpeg
/Default
)
250 TITLE
+= CLI media identifier
251 DEPENDS
+= +libffmpeg-full
255 define Package
/ffprobe
/description
256 $(call Package
/ffmpeg
/Default
/description
)
258 This package contains the FFprobe command line tool.
262 define Package
/ffserver
263 $(call Package
/ffserver
/Default
)
266 TITLE
+= streaming server
267 DEPENDS
+= +libffmpeg-full
271 define Package
/ffserver
/description
272 $(call Package
/ffmpeg
/Default
/description
)
274 This package contains the FFmpeg streaming server.
277 define Package
/libffmpeg
/Default
278 $(call Package
/ffmpeg
/Default
)
282 DEPENDS
+= +libpthread
+zlib
+libbz2
287 define Package
/libffmpeg-custom
288 $(call Package
/libffmpeg
/Default
)
290 DEPENDS
+= +FFMPEG_CUSTOM_SELECT_libopus
:libopus \
291 +PACKAGE_libx264
:libx264
+PACKAGE_lame-lib
:lame-lib \
292 +FFMPEG_CUSTOM_SELECT_libshine
:shine \
293 +PACKAGE_fdk-aac
:fdk-aac
298 define Package
/libffmpeg-custom
/config
299 source
"$(SOURCE)/Config.in"
302 define Package
/libffmpeg-custom
/description
303 $(call Package
/ffmpeg
/Default
/description
)
305 This package contains customized FFmpeg shared libraries.
309 define Package
/libffmpeg-audio-dec
310 $(call Package
/libffmpeg
/Default
)
312 DEPENDS
+= @BUILD_PATENTED
316 define Package
/libffmpeg-audio-dec
/description
317 $(call Package
/ffmpeg
/Default
/description
)
319 This package contains FFmpeg shared libraries for audio decoding
323 define Package
/libffmpeg-full
324 $(call Package
/libffmpeg
/Default
)
326 DEPENDS
+= @BUILD_PATENTED
+alsa-lib
+PACKAGE_libopus
:libopus
327 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
328 DEPENDS
+= +PACKAGE_shine
:shine
330 DEPENDS
+= +PACKAGE_lame-lib
:lame-lib
+PACKAGE_libx264
:libx264
336 define Package
/libffmpeg-full
/description
337 $(call Package
/ffmpeg
/Default
/description
)
339 This package contains full-featured FFmpeg shared libraries.
343 define Package
/libffmpeg-mini
344 $(call Package
/libffmpeg
/Default
)
346 DEPENDS
+= @BUILD_PATENTED
350 define Package
/libffmpeg-mini
/description
351 $(call Package
/ffmpeg
/Default
/description
)
353 This package contains minimal-featured FFmpeg shared libraries.
358 CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
359 LDFLAGS
="$(TARGET_LDFLAGS)" \
361 --enable-cross-compile \
362 --cross-prefix
="$(TARGET_CROSS)" \
366 --pkg-config
="pkg-config" \
379 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
387 --disable-inline-asm \
389 --disable-mipsdspr2 \
393 --disable-fast-unaligned \
394 --disable-runtime-cpudetect
396 else ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
398 --disable-runtime-cpudetect
399 # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
400 else ifneq ($(findstring powerpc
,$(CONFIG_ARCH
)),)
405 # selectively disable optimizations according to arch/cpu type
406 ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
407 ifneq ($(findstring vfp
,$(CONFIG_TARGET_OPTIMIZATION
)),)
408 FFMPEG_CONFIGURE
+= --enable-vfp
410 FFMPEG_CONFIGURE
+= --disable-vfp
412 ifneq ($(findstring neon
,$(CONFIG_TARGET_OPTIMIZATION
)),)
417 FFMPEG_CONFIGURE
+= --disable-neon
422 ifneq ($(CONFIG_YASM
),y
)
423 FFMPEG_CONFIGURE
+= --disable-yasm
427 ifeq ($(BUILD_VARIANT
),full
)
429 --enable-avresample \
430 $(if
$(CONFIG_PACKAGE_libopus
),--enable-libopus
)
431 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
435 $(if
$(CONFIG_PACKAGE_shine
),--enable-libshine
)
437 ifeq ($(ARCH
),x86_64
)
438 FFMPEG_CONFIGURE
+= --enable-hardcoded-tables
440 FFMPEG_CONFIGURE
+= --enable-small
445 $(if
$(CONFIG_PACKAGE_lame-lib
),--enable-libmp3lame
) \
446 $(if
$(CONFIG_PACKAGE_libx264
),--enable-libx264
)
450 ifeq ($(BUILD_VARIANT
),custom
)
454 $(if
$($(3)_
$(c
)),--enable-
$(1)="$(c)") \
457 ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE
),y
)
459 --enable-hardcoded-tables
465 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL
),y
)
466 FFMPEG_CONFIGURE
+= --enable-gpl
469 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3
),y
)
470 FFMPEG_CONFIGURE
+= --enable-version3
473 ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE
),y
)
474 FFMPEG_CONFIGURE
+= --enable-nonfree
481 --disable-swresample \
483 --disable-everything \
484 $(call FFMPEG_ENABLE
,encoder
,$(FFMPEG_CUSTOM_ENCODERS
),CONFIG_FFMPEG_CUSTOM_ENCODER
) \
485 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_CUSTOM_DECODERS
),CONFIG_FFMPEG_CUSTOM_DECODER
) \
486 $(call FFMPEG_ENABLE
,muxer
,$(FFMPEG_CUSTOM_MUXERS
),CONFIG_FFMPEG_CUSTOM_MUXER
) \
487 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_CUSTOM_DEMUXERS
),CONFIG_FFMPEG_CUSTOM_DEMUXER
) \
488 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_CUSTOM_PARSERS
),CONFIG_FFMPEG_CUSTOM_PARSER
) \
489 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_CUSTOM_PROTOCOLS
),CONFIG_FFMPEG_CUSTOM_PROTOCOL
) \
491 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm
),y
)
493 --enable-decoder
=adpcm_ima_wav \
494 --enable-decoder
=adpcm_ima_qt \
495 --enable-decoder
=adpcm_ms
498 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac
),y
)
500 --enable-libfdk-aac
--enable-encoder
=libfdk_aac
503 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame
),y
)
505 --enable-libmp3lame
--enable-encoder
=libmp3lame
508 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus
),y
)
510 --enable-libopus
--enable-decoder
=libopus
--enable-encoder
=libopus
513 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine
),y
)
515 --enable-libshine
--enable-encoder
=libshine
518 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264
),y
)
520 --enable-libx264
--enable-encoder
=libx264
525 ifeq ($(BUILD_VARIANT
),audio-dec
)
529 --enable-
$(1)="$(c)" \
539 --disable-swresample \
541 --disable-everything \
542 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_AUDIO_DECODERS
)) \
543 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_AUDIO_DEMUXERS
)) \
544 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
545 --disable-decoder
=pcm_bluray
,pcm_dvd \
549 ifeq ($(BUILD_VARIANT
),mini
)
553 --enable-
$(1)="$(c)" \
563 --disable-swresample \
565 --disable-everything \
566 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
567 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
568 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
))
571 ifneq ($(CONFIG_TARGET_x86
),)
572 TARGET_CFLAGS
+= -fomit-frame-pointer
575 define Build
/Configure
576 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
580 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
581 DESTDIR
="$(PKG_INSTALL_DIR)" \
585 define Build
/InstallDev
/custom
586 $(INSTALL_DIR
) $(1)/usr
/include
587 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
588 $(INSTALL_DIR
) $(1)/usr
/lib
589 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
590 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
591 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
594 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
595 define Build
/InstallDev
/full
596 $(INSTALL_DIR
) $(1)/usr
/include
597 $(INSTALL_DIR
) $(1)/usr
/lib
598 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
599 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
} $(1)/usr
/include/
600 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
601 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
602 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
603 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpostproc
$(1)/usr
/include/
604 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.
{a
,so
*} $(1)/usr
/lib
/
605 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libpostproc.
pc $(1)/usr
/lib
/pkgconfig
/
609 define Build
/InstallDev
/mini
610 $(INSTALL_DIR
) $(1)/usr
/include
611 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
612 $(INSTALL_DIR
) $(1)/usr
/lib
613 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
614 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
615 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
618 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
620 # XXX: attempt at installing "best" dev files available
621 ifeq ($(BUILD_VARIANT
),custom
)
622 # XXX: only install "custom" dev files if -full & -mini are not selected
623 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
624 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
627 ifeq ($(BUILD_VARIANT
),audio-dec
)
628 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
629 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
630 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
633 ifeq ($(BUILD_VARIANT
),full
)
634 # XXX: always install "full" dev files if -full is selected
635 Build
/InstallDev
= $(Build
/InstallDev
/full
)
637 ifeq ($(BUILD_VARIANT
),mini
)
638 # XXX: only install "mini" dev files if -full is not selected
639 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
640 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
644 define Package
/ffmpeg
/install
645 $(INSTALL_DIR
) $(1)/usr
/bin
646 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
649 define Package
/ffprobe
/install
650 $(INSTALL_DIR
) $(1)/usr
/bin
651 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
654 define Package
/ffserver
/install
655 $(INSTALL_DIR
) $(1)/usr
/bin
656 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
659 define Package
/libffmpeg-custom
/install
660 $(INSTALL_DIR
) $(1)/usr
/lib
661 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
664 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
665 define Package
/libffmpeg-full
/install
666 $(INSTALL_DIR
) $(1)/usr
/lib
667 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
668 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
669 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.so.
* $(1)/usr
/lib
/
673 define Package
/libffmpeg-mini
/install
674 $(INSTALL_DIR
) $(1)/usr
/lib
675 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
678 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
680 $(eval
$(call BuildPackage
,ffmpeg
))
681 $(eval
$(call BuildPackage
,ffprobe
))
682 $(eval
$(call BuildPackage
,ffserver
))
683 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
684 $(eval
$(call BuildPackage
,libffmpeg-full
))
685 $(eval
$(call BuildPackage
,libffmpeg-mini
))
686 ifneq ($(CONFIG_ALL
),y
)
687 $(eval
$(call BuildPackage
,libffmpeg-custom
))