Adding librtmp package - for use in ffmpeg

Hello everyone,

Recently I have been experimenting with some custom versions of ffmpeg, as I needed h264 support and ts demuxing. However, it has come to my attention that although the already compiled packages available online contain support for RTMP, the self compiled ffmpeg-full do not. Furthermore, ffmpeg-custom doesn't even have an RTMP option! Thus I would like to add support for librtmp, but I am encountering some problems.

So far, I have gathered the following info:

  1. In order to support RTMP, ffmpeg needs the following build arguements: --enable-protocol=rtmp --enable-librtmp --enable-encoder=flv --enable-decoder=flv. This makes sense, as RTMP uses FLV and we need the library to add support. However, it cannot find the library as the openwrt do not contain it

  2. The librtmp git repository can be found here. This is what I've been trying to get into a Makefile to add librtmp as an openwrt package. By default, librtmp is included with ffmpeg.

So far, I've got the following Makefile which I am almost certain isn't even half way complete:

#
# Copyright (C) 2019 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=librtmp
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://git.ffmpeg.org/rtmpdump.git

PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

include $(INCLUDE_DIR)/package.mk

define Package/librtmp
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=librtmp
  URL:=http://git.ffmpeg.org/rtmpdump.git
endef

define Package/librtmp/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/librtmp $(1)/usr/bin/
endef

$(eval $(call BuildPackage,librtmp))

I have made this, following the documentation and other packages that are already available. This Makefile is inside the directory openwrt/package/feeds/packages/librtmp.

When running the command make package/librtmp/download V=s I get the following result:

ERROR: please fix package/feeds/packages/librtmp/Makefile - see logs/package/feeds/packages/librtmp/dump.txt for details
Collecting package info: done
make[1]: Entering directory '/home/chrismin13/openwrt'
make[2]: Entering directory '/home/chrismin13/openwrt/package/feeds/packages/librtmp'
Makefile:33: *** ERROR: Unknown pack format for file /home/chrismin13/openwrt/tmp/dl/.  Stop.
make[2]: Leaving directory '/home/chrismin13/openwrt/package/feeds/packages/librtmp'
time: package/feeds/packages/librtmp/download#0.06#0.00#0.08
make[1]: *** [package/Makefile:109: package/feeds/packages/librtmp/download] Error 2
make[1]: Leaving directory '/home/chrismin13/openwrt'
make: *** [/home/chrismin13/openwrt/include/toplevel.mk:218: package/librtmp/download] Error 2

The log mentioned in the above output is the following:


Package: librtmp
Version: 1
Depends: +libc +GCC_LIBSSP:libssp +USE_GLIBC:librt +USE_GLIBC:libpthread 
Conflicts: 
Menu-Depends: 
Provides: 
Section: libs
Category: Libraries
Repository: packages
Title: librtmp
Maintainer: 
Source: 
License: GPL-2.0
LicenseFiles: COPYING
Type: ipkg
Description: librtmp
http://git.ffmpeg.org/rtmpdump.git

@@

Makefile:33: *** ERROR: Unknown pack format for file /home/chrismin13/openwrt/tmp/dl/.  Stop.

Any advice on how to get this working would be greatly appreciated! I've also got the task of adding this in the ffmpeg-custom options, but that seems to be slightly easier and will be done later on anyways.

Thanks in advance,
Chris.

You're missing PKG_SOURCE_VERSION and PKG_MIRROR_HASH (can be missing, not sure.). PKG_SOURCE_DATE is also useful. Try:

PKG_NAME:=librtmp
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.ffmpeg.org/rtmpdump.git
PKG_SOURCE_DATE:=2019-03-30
PKG_SOURCE_VERSION:=c5f04a58fc2aeea6296ca7c44ee4734c18401aa3
PKG_MIRROR_HASH:=

PKG_MIRROR_HASH can be fixed with make check FIXUP=1

1 Like

Have you tried https://github.com/openwrt/packages/pull/9475 ?
That should contain everything you need out of the box.

If you still want librtmp you can use this tarball instead
http://distcache.FreeBSD.org/ports-distfiles/rtmpdump-2.4.fa8646da.tar.bz2
Checksum here: https://svnweb.freebsd.org/ports/head/multimedia/librtmp/distinfo?revision=496010&view=markup

You're also missing InstallDev, ffmpeg wont find it without that section.

Thank you for your reply! This perfectly covered my use case. I've compiled the pull request as a package and it's been working perfectly on my Newifi3 D2 with an MT7621. I hope the pull request gets merged soon, v4 had a lot of improvements!

That's very good news, thanks for following up. As far as merging goes I honestly don't know since I don't have the time for supporting it in a timely manner for all platforms which is why I haven't listed myself as maintainer.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.