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 --enable-avresample \
461 $(if
$(CONFIG_PACKAGE_libopus
),--enable-libopus
)
462 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
466 $(if
$(CONFIG_PACKAGE_shine
),--enable-libshine
)
472 $(if
$(CONFIG_PACKAGE_lame-lib
),--enable-libmp3lame
) \
473 $(if
$(CONFIG_PACKAGE_libx264
),--enable-libx264
)
477 ifeq ($(BUILD_VARIANT
),custom
)
481 $(if
$($(3)_
$(c
)),--enable-
$(1)="$(c)") \
484 ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE
),y
)
486 --enable-hardcoded-tables
492 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL
),y
)
493 FFMPEG_CONFIGURE
+= --enable-gpl
496 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3
),y
)
497 FFMPEG_CONFIGURE
+= --enable-version3
500 ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE
),y
)
501 FFMPEG_CONFIGURE
+= --enable-nonfree
508 --disable-swresample \
510 --disable-everything \
511 $(call FFMPEG_ENABLE
,encoder
,$(FFMPEG_CUSTOM_ENCODERS
),CONFIG_FFMPEG_CUSTOM_ENCODER
) \
512 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_CUSTOM_DECODERS
),CONFIG_FFMPEG_CUSTOM_DECODER
) \
513 $(call FFMPEG_ENABLE
,muxer
,$(FFMPEG_CUSTOM_MUXERS
),CONFIG_FFMPEG_CUSTOM_MUXER
) \
514 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_CUSTOM_DEMUXERS
),CONFIG_FFMPEG_CUSTOM_DEMUXER
) \
515 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_CUSTOM_PARSERS
),CONFIG_FFMPEG_CUSTOM_PARSER
) \
516 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_CUSTOM_PROTOCOLS
),CONFIG_FFMPEG_CUSTOM_PROTOCOL
) \
518 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm
),y
)
520 --enable-decoder
=adpcm_ima_wav \
521 --enable-decoder
=adpcm_ima_qt \
522 --enable-decoder
=adpcm_ms
525 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac
),y
)
527 --enable-libfdk-aac
--enable-encoder
=libfdk_aac
530 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame
),y
)
532 --enable-libmp3lame
--enable-encoder
=libmp3lame
535 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus
),y
)
537 --enable-libopus
--enable-decoder
=libopus
--enable-encoder
=libopus
540 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine
),y
)
542 --enable-libshine
--enable-encoder
=libshine
545 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264
),y
)
547 --enable-libx264
--enable-encoder
=libx264
552 ifeq ($(BUILD_VARIANT
),audio-dec
)
556 --enable-
$(1)="$(c)" \
566 --disable-swresample \
568 --disable-everything \
569 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_AUDIO_DECODERS
)) \
570 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_AUDIO_DEMUXERS
)) \
571 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_AUDIO_PARSERS
)) \
572 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
573 --disable-decoder
=pcm_bluray
,pcm_dvd \
577 ifeq ($(BUILD_VARIANT
),mini
)
581 --enable-
$(1)="$(c)" \
591 --disable-swresample \
593 --disable-everything \
594 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
595 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
596 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
))
599 ifneq ($(CONFIG_TARGET_x86
),)
600 TARGET_CFLAGS
+= -fomit-frame-pointer
603 define Build
/Configure
604 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
608 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
609 DESTDIR
="$(PKG_INSTALL_DIR)" \
613 define Build
/InstallDev
/custom
614 $(INSTALL_DIR
) $(1)/usr
/include
615 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
616 $(INSTALL_DIR
) $(1)/usr
/lib
617 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
618 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
619 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
622 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
623 define Build
/InstallDev
/full
624 $(INSTALL_DIR
) $(1)/usr
/include
625 $(INSTALL_DIR
) $(1)/usr
/lib
626 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
627 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
} $(1)/usr
/include/
628 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
629 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
630 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
631 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpostproc
$(1)/usr
/include/
632 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.
{a
,so
*} $(1)/usr
/lib
/
633 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libpostproc.
pc $(1)/usr
/lib
/pkgconfig
/
637 define Build
/InstallDev
/mini
638 $(INSTALL_DIR
) $(1)/usr
/include
639 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
640 $(INSTALL_DIR
) $(1)/usr
/lib
641 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
642 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
643 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
646 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
648 # XXX: attempt at installing "best" dev files available
649 ifeq ($(BUILD_VARIANT
),custom
)
650 # XXX: only install "custom" dev files if -full & -mini are not selected
651 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
652 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
655 ifeq ($(BUILD_VARIANT
),audio-dec
)
656 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
657 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
658 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
661 ifeq ($(BUILD_VARIANT
),full
)
662 # XXX: always install "full" dev files if -full is selected
663 Build
/InstallDev
= $(Build
/InstallDev
/full
)
665 ifeq ($(BUILD_VARIANT
),mini
)
666 # XXX: only install "mini" dev files if -full is not selected
667 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
668 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
672 define Package
/ffmpeg
/install
673 $(INSTALL_DIR
) $(1)/usr
/bin
674 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
677 define Package
/ffprobe
/install
678 $(INSTALL_DIR
) $(1)/usr
/bin
679 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
682 define Package
/ffserver
/install
683 $(INSTALL_DIR
) $(1)/usr
/bin
684 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
687 define Package
/libffmpeg-custom
/install
688 $(INSTALL_DIR
) $(1)/usr
/lib
689 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
692 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
693 define Package
/libffmpeg-full
/install
694 $(INSTALL_DIR
) $(1)/usr
/lib
695 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avresample
,avutil
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
696 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
697 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.so.
* $(1)/usr
/lib
/
701 define Package
/libffmpeg-mini
/install
702 $(INSTALL_DIR
) $(1)/usr
/lib
703 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
706 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
708 $(eval
$(call BuildPackage
,ffmpeg
))
709 $(eval
$(call BuildPackage
,ffprobe
))
710 $(eval
$(call BuildPackage
,ffserver
))
711 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
712 $(eval
$(call BuildPackage
,libffmpeg-full
))
713 $(eval
$(call BuildPackage
,libffmpeg-mini
))
714 ifneq ($(CONFIG_ALL
),y
)
715 $(eval
$(call BuildPackage
,libffmpeg-custom
))