2 # Copyright (C) 2006-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=http://ffmpeg.org/releases/
16 PKG_MD5SUM:=5fae1ba5a5d37a2d0de750479b7270d4
17 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
19 PKG_LICENSE:=LGPL-2.1+ GPL-2+ LGPL-3
20 PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
22 FFMPEG_CUSTOM_ENCODERS:= \
34 FFMPEG_CUSTOM_DECODERS:= \
65 FFMPEG_CUSTOM_MUXERS:= \
78 FFMPEG_CUSTOM_DEMUXERS:= \
106 FFMPEG_CUSTOM_PARSERS:= \
117 FFMPEG_CUSTOM_PROTOCOLS:= \
118 file http icecast pipe rtp tcp udp
120 FFMPEG_MINI_DECODERS:= \
139 FFMPEG_MINI_DEMUXERS:= \
149 FFMPEG_MINI_PROTOCOLS:= \
152 FFMPEG_AUDIO_DECODERS:= \
177 FFMPEG_AUDIO_DEMUXERS:= \
200 FFMPEG_AUDIO_PARSERS:= \
208 FFMPEG_AUDIO_PROTOCOLS:= \
209 file http icecast rtp tcp udp
212 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
214 PKG_CONFIG_DEPENDS:= \
215 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
216 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
217 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
218 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
219 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
220 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
222 include $(INCLUDE_DIR)/package.mk
224 define Package/ffmpeg/Default
226 URL:=http://ffmpeg.mplayerhq.hu/
229 define Package/ffmpeg/Default/description
230 FFmpeg is a a software package that can record, convert and stream digital
231 audio and video in numerous formats.
235 define Package/ffmpeg
236 $(call Package/ffmpeg/Default)
240 DEPENDS+= +libpthread +libffmpeg-full
244 define Package/ffmpeg/description
245 $(call Package/ffmpeg/Default/description)
247 This package contains the FFmpeg command line tool.
251 define Package/ffprobe
252 $(call Package/ffmpeg/Default)
255 TITLE+= CLI media identifier
256 DEPENDS+= +libffmpeg-full
260 define Package/ffprobe/description
261 $(call Package/ffmpeg/Default/description)
263 This package contains the FFprobe command line tool.
267 define Package/ffserver
268 $(call Package/ffserver/Default)
271 TITLE+= streaming server
272 DEPENDS+= +libpthread +libffmpeg-full
276 define Package/ffserver/description
277 $(call Package/ffmpeg/Default/description)
279 This package contains the FFmpeg streaming server.
282 define Package/libffmpeg/Default
283 $(call Package/ffmpeg/Default)
287 DEPENDS+= @BUILD_PATENTED +libpthread +zlib +libbz2
292 define Package/libffmpeg-custom
293 $(call Package/libffmpeg/Default)
295 DEPENDS+= +FFMPEG_CUSTOM_SELECT_libopus:libopus +FFMPEG_CUSTOM_SELECT_speex:libspeex \
296 +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib
302 define Package/libffmpeg-custom/config
303 source "$(SOURCE)/Config.in"
306 define Package/libffmpeg-custom/description
307 $(call Package/ffmpeg/Default/description)
309 This package contains customized FFmpeg shared libraries.
313 define Package/libffmpeg-audio-dec
314 $(call Package/libffmpeg/Default)
320 define Package/libffmpeg-audio-dec/description
321 $(call Package/ffmpeg/Default/description)
323 This package contains FFmpeg shared libraries for audio decoding
327 define Package/libffmpeg-full
328 $(call Package/libffmpeg/Default)
330 DEPENDS+= +alsa-lib +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib +libopus +libspeex
334 define Package/libffmpeg-full/description
335 $(call Package/ffmpeg/Default/description)
337 This package contains full-featured FFmpeg shared libraries.
341 define Package/libffmpeg-mini
342 $(call Package/libffmpeg/Default)
347 define Package/libffmpeg-mini/description
348 $(call Package/ffmpeg/Default/description)
350 This package contains minimal-featured FFmpeg shared libraries.
355 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
356 LDFLAGS="$(TARGET_LDFLAGS)" \
358 --enable-cross-compile \
359 --cross-prefix="$(TARGET_CROSS)" \
363 --pkg-config="pkg-config" \
382 ifeq ($(CONFIG_SOFT_FLOAT),y)
383 FFMPEG_CONFIGURE += \
386 --disable-amd3dnowext \
400 --disable-inline-asm \
402 --disable-mipsdspr1 \
403 --disable-mipsdspr2 \
405 --disable-runtime-cpudetect
407 else ifneq ($(findstring arm,$(CONFIG_ARCH)),)
408 FFMPEG_CONFIGURE += \
409 --disable-runtime-cpudetect
410 else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),)
411 FFMPEG_CONFIGURE += \
415 ifneq ($(CONFIG_YASM),y)
416 FFMPEG_CONFIGURE += \
421 #selectibly disable optimizations according to arch/cpu type
422 ifneq ($(findstring arm,$(CONFIG_ARCH)),)
423 ifeq (,$(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION)))
427 ifeq (,$(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)))
434 ifeq ($(BUILD_VARIANT),full)
436 --enable-libopus --enable-decoder=libopus \
437 --enable-libspeex --enable-decoder=libspeex \
438 $(if $(CONFIG_PACKAGE_libx264),--enable-libx264) \
439 $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
442 ifeq ($(BUILD_VARIANT),custom)
446 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
453 --disable-swresample \
455 --disable-everything \
456 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
457 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
458 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
459 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
460 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
461 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
463 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
465 --enable-decoder=adpcm_ima_wav \
466 --enable-decoder=adpcm_ima_qt \
467 --enable-decoder=adpcm_ms \
471 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
473 --enable-libopus --enable-decoder=libopus
476 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
478 --enable-libspeex --enable-decoder=libspeex
481 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_x264),y)
486 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_mp3lame),y)
493 ifeq ($(BUILD_VARIANT),audio-dec)
497 --enable-$(1)="$(c)" \
504 --disable-swresample \
506 --disable-everything \
507 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
508 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
509 $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
510 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
511 --enable-libspeex --enable-decoder=libspeex \
512 --disable-decoder=pcm_bluray,pcm_dvd \
516 ifeq ($(BUILD_VARIANT),mini)
520 --enable-$(1)="$(c)" \
528 --disable-swresample \
530 --disable-everything \
531 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
532 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
533 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
537 ifneq ($(CONFIG_TARGET_x86),)
538 TARGET_CFLAGS += -fomit-frame-pointer
541 define Build/Configure
542 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
546 $(MAKE) -C $(PKG_BUILD_DIR) \
547 DESTDIR="$(PKG_INSTALL_DIR)" \
551 define Build/InstallDev/custom
552 $(INSTALL_DIR) $(1)/usr/include
553 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
554 $(INSTALL_DIR) $(1)/usr/lib
555 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
556 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
557 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
560 define Build/InstallDev/full
561 $(INSTALL_DIR) $(1)/usr/include
562 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
563 $(INSTALL_DIR) $(1)/usr/lib
564 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
565 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
566 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
569 define Build/InstallDev/mini
570 $(INSTALL_DIR) $(1)/usr/include
571 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
572 $(INSTALL_DIR) $(1)/usr/lib
573 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
574 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
575 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
578 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
580 # XXX: attempt at installing "best" dev files available
581 ifeq ($(BUILD_VARIANT),custom)
582 # XXX: only install "custom" dev files if -full & -mini are not selected
583 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
584 Build/InstallDev = $(Build/InstallDev/custom)
587 ifeq ($(BUILD_VARIANT),audio-dec)
588 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
589 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
590 Build/InstallDev = $(Build/InstallDev/audio-dec)
593 ifeq ($(BUILD_VARIANT),full)
594 # XXX: always install "full" dev files if -full is selected
595 Build/InstallDev = $(Build/InstallDev/full)
597 ifeq ($(BUILD_VARIANT),mini)
598 # XXX: only install "mini" dev files if -full is not selected
599 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
600 Build/InstallDev = $(Build/InstallDev/mini)
604 define Package/ffmpeg/install
605 $(INSTALL_DIR) $(1)/usr/bin
606 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
609 define Package/ffprobe/install
610 $(INSTALL_DIR) $(1)/usr/bin
611 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
614 define Package/ffserver/install
615 $(INSTALL_DIR) $(1)/usr/bin
616 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
619 define Package/libffmpeg-custom/install
620 $(INSTALL_DIR) $(1)/usr/lib
621 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
624 define Package/libffmpeg-full/install
625 $(INSTALL_DIR) $(1)/usr/lib
626 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
629 define Package/libffmpeg-mini/install
630 $(INSTALL_DIR) $(1)/usr/lib
631 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
634 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
636 $(eval $(call BuildPackage,ffmpeg))
637 $(eval $(call BuildPackage,ffprobe))
638 $(eval $(call BuildPackage,ffserver))
639 $(eval $(call BuildPackage,libffmpeg-audio-dec))
640 $(eval $(call BuildPackage,libffmpeg-full))
641 $(eval $(call BuildPackage,libffmpeg-mini))
642 ifneq ($(CONFIG_ALL),y)
643 $(eval $(call BuildPackage,libffmpeg-custom))