2 # Copyright (C) 2006-2017 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
:=https
://ffmpeg.org
/releases
/
16 PKG_MD5SUM
:=e34d1b92c5d844f2a3611c741a6dba18
17 PKG_HASH
:=3f01bd1fe1a17a277f8c84869e5d9192b4b978cb660872aa2b54c3cc8a2fedfc
18 PKG_MAINTAINER
:=Ted Hess
<thess@kitschensync.net
>
20 PKG_LICENSE
:=LGPL-2.1
+ GPL-2
+ LGPL-3
21 PKG_LICENSE_FILES
:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
23 FFMPEG_CUSTOM_ENCODERS
:= \
35 FFMPEG_CUSTOM_DECODERS
:= \
66 FFMPEG_CUSTOM_MUXERS
:= \
79 FFMPEG_CUSTOM_DEMUXERS
:= \
107 FFMPEG_CUSTOM_PARSERS
:= \
118 FFMPEG_CUSTOM_PROTOCOLS
:= \
119 file http icecast pipe rtp tcp udp
121 FFMPEG_MINI_DECODERS
:= \
140 FFMPEG_MINI_DEMUXERS
:= \
150 FFMPEG_MINI_PROTOCOLS
:= \
153 FFMPEG_AUDIO_DECODERS
:= \
178 FFMPEG_AUDIO_DEMUXERS
:= \
201 FFMPEG_AUDIO_PARSERS
:= \
209 FFMPEG_AUDIO_PROTOCOLS
:= \
210 file http icecast rtp tcp udp
213 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(BUILD_VARIANT
)/$(PKG_NAME
)-$(PKG_VERSION
)
215 PKG_CONFIG_DEPENDS
:= \
216 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_
%,$(FFMPEG_CUSTOM_ENCODERS
)) \
217 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_
%,$(FFMPEG_CUSTOM_DECODERS
)) \
218 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
219 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_
%,$(FFMPEG_CUSTOM_DEMUXERS
)) \
220 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_
%,$(FFMPEG_CUSTOM_PARSERS
)) \
221 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_
%,$(FFMPEG_CUSTOM_PROTOCOLS
))
223 include $(INCLUDE_DIR
)/package.mk
225 define Package
/ffmpeg
/Default
227 URL
:=http
://ffmpeg.mplayerhq.hu
/
230 define Package
/ffmpeg
/Default
/description
231 FFmpeg is a a software package that can record
, convert and stream digital
232 audio and video in numerous formats.
236 define Package
/ffmpeg
237 $(call Package
/ffmpeg
/Default
)
241 DEPENDS
+= +libpthread
+libffmpeg-full
245 define Package
/ffmpeg
/description
246 $(call Package
/ffmpeg
/Default
/description
)
248 This package contains the FFmpeg command line tool.
252 define Package
/ffprobe
253 $(call Package
/ffmpeg
/Default
)
256 TITLE
+= CLI media identifier
257 DEPENDS
+= +libffmpeg-full
261 define Package
/ffprobe
/description
262 $(call Package
/ffmpeg
/Default
/description
)
264 This package contains the FFprobe command line tool.
268 define Package
/ffserver
269 $(call Package
/ffserver
/Default
)
272 TITLE
+= streaming server
273 DEPENDS
+= +libpthread
+libffmpeg-full
277 define Package
/ffserver
/description
278 $(call Package
/ffmpeg
/Default
/description
)
280 This package contains the FFmpeg streaming server.
283 define Package
/libffmpeg
/Default
284 $(call Package
/ffmpeg
/Default
)
288 DEPENDS
+= @BUILD_PATENTED
+libpthread
+zlib
+libbz2
293 define Package
/libffmpeg-custom
294 $(call Package
/libffmpeg
/Default
)
296 DEPENDS
+= +FFMPEG_CUSTOM_SELECT_libopus
:libopus \
297 +PACKAGE_libx264
:libx264
+PACKAGE_lame-lib
:lame-lib
303 define Package
/libffmpeg-custom
/config
304 source
"$(SOURCE)/Config.in"
307 define Package
/libffmpeg-custom
/description
308 $(call Package
/ffmpeg
/Default
/description
)
310 This package contains customized FFmpeg shared libraries.
314 define Package
/libffmpeg-audio-dec
315 $(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
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
+= \
388 --disable-amd3dnowext \
406 --disable-inline-asm \
408 --disable-mipsdspr2 \
412 --disable-fast-unaligned \
413 --disable-runtime-cpudetect
415 else ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
416 FFMPEG_CONFIGURE
+= \
417 --disable-runtime-cpudetect
418 else ifneq ($(findstring powerpc
,$(CONFIG_ARCH
)),)
419 FFMPEG_CONFIGURE
+= \
423 ifneq ($(CONFIG_YASM
),y
)
424 FFMPEG_CONFIGURE
+= \
429 #selectibly disable optimizations according to arch/cpu type
430 ifneq ($(findstring arm
,$(CONFIG_ARCH
)),)
431 ifeq (,$(findstring vfp
,$(CONFIG_TARGET_OPTIMIZATION
)))
435 ifeq (,$(findstring neon
,$(CONFIG_TARGET_OPTIMIZATION
)))
442 ifeq ($(BUILD_VARIANT
),full
)
444 --enable-libopus
--enable-decoder
=libopus \
445 $(if
$(CONFIG_PACKAGE_libx264
),--enable-libx264
) \
446 $(if
$(CONFIG_PACKAGE_lame-lib
),--enable-libmp3lame
)
449 ifeq ($(BUILD_VARIANT
),custom
)
453 $(if
$($(3)_
$(c
)),--enable-
$(1)="$(c)") \
460 --disable-swresample \
462 --disable-everything \
463 $(call FFMPEG_ENABLE
,encoder
,$(FFMPEG_CUSTOM_ENCODERS
),CONFIG_FFMPEG_CUSTOM_ENCODER
) \
464 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_CUSTOM_DECODERS
),CONFIG_FFMPEG_CUSTOM_DECODER
) \
465 $(call FFMPEG_ENABLE
,muxer
,$(FFMPEG_CUSTOM_MUXERS
),CONFIG_FFMPEG_CUSTOM_MUXER
) \
466 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_CUSTOM_DEMUXERS
),CONFIG_FFMPEG_CUSTOM_DEMUXER
) \
467 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_CUSTOM_PARSERS
),CONFIG_FFMPEG_CUSTOM_PARSER
) \
468 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_CUSTOM_PROTOCOLS
),CONFIG_FFMPEG_CUSTOM_PROTOCOL
) \
470 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm
),y
)
472 --enable-decoder
=adpcm_ima_wav \
473 --enable-decoder
=adpcm_ima_qt \
474 --enable-decoder
=adpcm_ms \
478 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus
),y
)
480 --enable-libopus
--enable-decoder
=libopus
483 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_x264
),y
)
488 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_mp3lame
),y
)
495 ifeq ($(BUILD_VARIANT
),audio-dec
)
499 --enable-
$(1)="$(c)" \
506 --disable-swresample \
508 --disable-everything \
509 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_AUDIO_DECODERS
)) \
510 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_AUDIO_DEMUXERS
)) \
511 $(call FFMPEG_ENABLE
,parser
,$(FFMPEG_AUDIO_PARSERS
)) \
512 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_AUDIO_PROTOCOLS
)) \
513 --disable-decoder
=pcm_bluray
,pcm_dvd \
517 ifeq ($(BUILD_VARIANT
),mini
)
521 --enable-
$(1)="$(c)" \
529 --disable-swresample \
531 --disable-everything \
532 $(call FFMPEG_ENABLE
,decoder
,$(FFMPEG_MINI_DECODERS
)) \
533 $(call FFMPEG_ENABLE
,demuxer
,$(FFMPEG_MINI_DEMUXERS
)) \
534 $(call FFMPEG_ENABLE
,protocol
,$(FFMPEG_MINI_PROTOCOLS
)) \
538 ifneq ($(CONFIG_TARGET_x86
),)
539 TARGET_CFLAGS
+= -fomit-frame-pointer
542 define Build
/Configure
543 ( cd
$(PKG_BUILD_DIR
); $(FFMPEG_CONFIGURE
) )
547 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
548 DESTDIR
="$(PKG_INSTALL_DIR)" \
552 define Build
/InstallDev
/custom
553 $(INSTALL_DIR
) $(1)/usr
/include
554 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avformat
,avutil
} $(1)/usr
/include/
555 $(INSTALL_DIR
) $(1)/usr
/lib
556 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
557 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
558 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
561 define Build
/InstallDev
/full
562 $(INSTALL_DIR
) $(1)/usr
/include
563 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,postproc
,swresample
,swscale
} $(1)/usr
/include/
564 $(INSTALL_DIR
) $(1)/usr
/lib
565 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,postproc
,swresample
,swscale
}.
{a
,so
*} $(1)/usr
/lib
/
566 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
567 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,postproc
,swresample
,swscale
}.
pc $(1)/usr
/lib
/pkgconfig
/
570 define Build
/InstallDev
/mini
571 $(INSTALL_DIR
) $(1)/usr
/include
572 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/lib
{avcodec
,avformat
,avutil
} $(1)/usr
/include/
573 $(INSTALL_DIR
) $(1)/usr
/lib
574 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.
{a
,so
*} $(1)/usr
/lib
/
575 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
576 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/lib
{avcodec
,avformat
,avutil
}.
pc $(1)/usr
/lib
/pkgconfig
/
579 Build
/InstallDev
/audio-dec
= $(Build
/InstallDev
/custom
)
581 # XXX: attempt at installing "best" dev files available
582 ifeq ($(BUILD_VARIANT
),custom
)
583 # XXX: only install "custom" dev files if -full & -mini are not selected
584 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
585 Build
/InstallDev
= $(Build
/InstallDev
/custom
)
588 ifeq ($(BUILD_VARIANT
),audio-dec
)
589 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
590 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
)$(CONFIG_PACKAGE_libffmpeg-mini
),)
591 Build
/InstallDev
= $(Build
/InstallDev
/audio-dec
)
594 ifeq ($(BUILD_VARIANT
),full
)
595 # XXX: always install "full" dev files if -full is selected
596 Build
/InstallDev
= $(Build
/InstallDev
/full
)
598 ifeq ($(BUILD_VARIANT
),mini
)
599 # XXX: only install "mini" dev files if -full is not selected
600 ifeq ($(CONFIG_PACKAGE_libffmpeg-full
),)
601 Build
/InstallDev
= $(Build
/InstallDev
/mini
)
605 define Package
/ffmpeg
/install
606 $(INSTALL_DIR
) $(1)/usr
/bin
607 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffmpeg
$(1)/usr
/bin
/
610 define Package
/ffprobe
/install
611 $(INSTALL_DIR
) $(1)/usr
/bin
612 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffprobe
$(1)/usr
/bin
/
615 define Package
/ffserver
/install
616 $(INSTALL_DIR
) $(1)/usr
/bin
617 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/ffserver
$(1)/usr
/bin
/
620 define Package
/libffmpeg-custom
/install
621 $(INSTALL_DIR
) $(1)/usr
/lib
622 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
625 define Package
/libffmpeg-full
/install
626 $(INSTALL_DIR
) $(1)/usr
/lib
627 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avdevice
,avfilter
,avformat
,avutil
,postproc
,swresample
,swscale
}.so.
* $(1)/usr
/lib
/
630 define Package
/libffmpeg-mini
/install
631 $(INSTALL_DIR
) $(1)/usr
/lib
632 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{avcodec
,avformat
,avutil
}.so.
* $(1)/usr
/lib
/
635 Package
/libffmpeg-audio-dec
/install = $(Package
/libffmpeg-custom
/install)
637 $(eval
$(call BuildPackage
,ffmpeg
))
638 $(eval
$(call BuildPackage
,ffprobe
))
639 $(eval
$(call BuildPackage
,ffserver
))
640 $(eval
$(call BuildPackage
,libffmpeg-audio-dec
))
641 $(eval
$(call BuildPackage
,libffmpeg-full
))
642 $(eval
$(call BuildPackage
,libffmpeg-mini
))
643 ifneq ($(CONFIG_ALL
),y
)
644 $(eval
$(call BuildPackage
,libffmpeg-custom
))