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
:=b53ecfcbafca973f92bfb77815cce01e
18 PKG_HASH
:=0c0c15e999c66003b969c7a5d61c4a7e1d3dfbf3c809c23ff5537d583dd93323
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 ifeq (,$(findstring vfp
,$(CONFIG_TARGET_OPTIMIZATION
)))
438 ifeq (,$(findstring neon
,$(CONFIG_TARGET_OPTIMIZATION
)))
445 ifneq ($(CONFIG_YASM
),y
)
446 FFMPEG_CONFIGURE
+= \
451 ifeq ($(BUILD_VARIANT
),full
)
453 $(if
$(CONFIG_PACKAGE_libopus
),--enable-libopus
)
454 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
458 $(if
$(CONFIG_PACKAGE_shine
),--enable-libshine
)
464 $(if
$(CONFIG_PACKAGE_lame-lib
),--enable-libmp3lame
) \
465 $(if
$(CONFIG_PACKAGE_libx264
),--enable-libx264
)
469 ifeq ($(BUILD_VARIANT
),custom
)
473 $(if
$($(3)_
$(c
)),--enable-
$(1)="$(c)") \
476 ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE
),y
)
478 --enable-hardcoded-tables
484 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL
),y
)
485 FFMPEG_CONFIGURE
+= --enable-gpl
488 ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3
),y
)
489 FFMPEG_CONFIGURE
+= --enable-version3
492 ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE
),y
)
493 FFMPEG_CONFIGURE
+= --enable-nonfree
500 --disable-swresample \
502 --disable-everything \
503 $(call FFMPEG_ENABLE
,encoder
,$(FFMPEG_CUSTOM_ENCODERS
),CONFIG_FFMPEG_CUSTOM_ENCODER
) \
504 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_CUSTOM_DECODERS
),CONFIG_FFMPEG_CUSTOM_DECODER
) \
505 $(call FFMPEG_ENABLE
,muxer
,$(FFMPEG_CUSTOM_MUXERS
),CONFIG_FFMPEG_CUSTOM_MUXER
) \
506 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_CUSTOM_DEMUXERS
),CONFIG_FFMPEG_CUSTOM_DEMUXER
) \
507 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_CUSTOM_PARSERS
),CONFIG_FFMPEG_CUSTOM_PARSER
) \
508 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_CUSTOM_PROTOCOLS
),CONFIG_FFMPEG_CUSTOM_PROTOCOL
) \
510 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm
),y
)
512 --enable-decoder
=adpcm_ima_wav \
513 --enable-decoder
=adpcm_ima_qt \
514 --enable-decoder
=adpcm_ms
517 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac
),y
)
519 --enable-libfdk-aac
--enable-encoder
=libfdk_aac
522 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame
),y
)
524 --enable-libmp3lame
--enable-encoder
=libmp3lame
527 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus
),y
)
529 --enable-libopus
--enable-decoder
=libopus
--enable-encoder
=libopus
532 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine
),y
)
534 --enable-libshine
--enable-encoder
=libshine
537 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264
),y
)
539 --enable-libx264
--enable-encoder
=libx264
544 ifeq ($(BUILD_VARIANT
),audio-dec
)
548 --enable-
$(1)="$(c)" \
558 --disable-swresample \
560 --disable-everything \
561 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_AUDIO_DECODERS
)) \
562 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_AUDIO_DEMUXERS
)) \
563 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_AUDIO_PARSERS
)) \
564 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
565 --disable-decoder
=pcm_bluray
,pcm_dvd \
569 ifeq ($(BUILD_VARIANT
),mini
)
573 --enable-
$(1)="$(c)" \
583 --disable-swresample \
585 --disable-everything \
586 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
587 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
588 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
))
591 ifneq ($(CONFIG_TARGET_x86
),)
592 TARGET_CFLAGS
+= -fomit-frame-pointer
595 define Build
/Configure
596 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
600 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
601 DESTDIR
="$(PKG_INSTALL_DIR)" \
605 define Build
/InstallDev
/custom
606 $(INSTALL_DIR
) $(1)/usr
/include
607 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
608 $(INSTALL_DIR
) $(1)/usr
/lib
609 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
610 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
611 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
614 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
615 define Build
/InstallDev
/full
616 $(INSTALL_DIR
) $(1)/usr
/include
617 $(INSTALL_DIR
) $(1)/usr
/lib
618 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
619 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
} $(1)/usr
/include/
620 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
621 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
622 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
623 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpostproc
$(1)/usr
/include/
624 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.
{a
,so
*} $(1)/usr
/lib
/
625 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libpostproc.
pc $(1)/usr
/lib
/pkgconfig
/
629 define Build
/InstallDev
/mini
630 $(INSTALL_DIR
) $(1)/usr
/include
631 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
632 $(INSTALL_DIR
) $(1)/usr
/lib
633 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
634 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
635 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
638 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
640 # XXX: attempt at installing "best" dev files available
641 ifeq ($(BUILD_VARIANT
),custom
)
642 # XXX: only install "custom" dev files if -full & -mini are not selected
643 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
644 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
647 ifeq ($(BUILD_VARIANT
),audio-dec
)
648 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
649 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
650 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
653 ifeq ($(BUILD_VARIANT
),full
)
654 # XXX: always install "full" dev files if -full is selected
655 Build
/InstallDev
= $(Build
/InstallDev
/full
)
657 ifeq ($(BUILD_VARIANT
),mini
)
658 # XXX: only install "mini" dev files if -full is not selected
659 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
660 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
664 define Package
/ffmpeg
/install
665 $(INSTALL_DIR
) $(1)/usr
/bin
666 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
669 define Package
/ffprobe
/install
670 $(INSTALL_DIR
) $(1)/usr
/bin
671 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
674 define Package
/ffserver
/install
675 $(INSTALL_DIR
) $(1)/usr
/bin
676 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
679 define Package
/libffmpeg-custom
/install
680 $(INSTALL_DIR
) $(1)/usr
/lib
681 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
684 # Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
685 define Package
/libffmpeg-full
/install
686 $(INSTALL_DIR
) $(1)/usr
/lib
687 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
688 ifneq ($(CONFIG_SOFT_FLOAT
),y
)
689 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpostproc.so.
* $(1)/usr
/lib
/
693 define Package
/libffmpeg-mini
/install
694 $(INSTALL_DIR
) $(1)/usr
/lib
695 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
698 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
700 $(eval
$(call BuildPackage
,ffmpeg
))
701 $(eval
$(call BuildPackage
,ffprobe
))
702 $(eval
$(call BuildPackage
,ffserver
))
703 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
704 $(eval
$(call BuildPackage
,libffmpeg-full
))
705 $(eval
$(call BuildPackage
,libffmpeg-mini
))
706 ifneq ($(CONFIG_ALL
),y
)
707 $(eval
$(call BuildPackage
,libffmpeg-custom
))