OpenWrt Forum Archive

Topic: Compile motion with ffmpeg support for BRCM2709

The content of this topic has been archived on 15 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I followed THIS tutorial and with some changes in the settings, might record videos with my cheap ip cameras using a modified version of motion with ffmpeg support, which is available for download at the site. But motion uses all resources of my outdated router (TL-WR1043ND). So i bought a Raspberry Pi 2 (BRCM2709) and compile a OpenWRT version for it (under BRCM2708), since there is not a version ready for download. The Raspberry Pi 2 is running OpenWRT well, including using zram. But i can not in any way compile a version of motion with ffmpeg support for this architecture. I followed the steps of the Wiki to build a single package and compiled motion, but without support for ffmpeg. In the makefile tried replacing the --without-ffmpeg to --with-ffmpeg and the ipk generated has not support for ffmpeg. Also tried to remove that line (--without-ffmpeg), but no success. In both trials also includes a dependency of ffmpeg (+ffmpeg). How do i compile motion with ffmpeg support for this architecture (BRCM2709)? Appreciate any help from the members of this wonderful forum!

(Last edited by mbarriles on 11 Apr 2015, 16:27)

try to replace the OpenWrt Makefile for motion with this one:

#
# Copyright (C) 2008-2015 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:=motion
PKG_VERSION=3.4.0-20141018-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=2

PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=COPYING

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/Mr-Dave/motion.git
PKG_SOURCE_VERSION:=9479d910f2149b5558788bb86f97f26522794212

PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

define Package/motion/Default
  SECTION:=multimedia
  CATEGORY:=Multimedia
  DEPENDS:=+libjpeg +libpthread
  URL:=http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
endef

define Package/motion
$(call Package/motion/Default)
  TITLE:=webcam motion sensing and logging
  VARIANT:=normal
endef

define Package/motion-ffmpeg
$(call Package/motion/Default)
  TITLE:=(+ffmpeg)
  DEPENDS+=+libffmpeg-full
  VARIANT:=ffmpeg
endef

define Package/motion/conffiles
  /etc/motion.conf
endef

CONFIGURE_ARGS+= \
    --without-optimizecpu \
    --without-jpeg-mmx \
    --without-sdl \
    --without-mysql \
    --without-pgsql \
    --without-sqlite3

ifeq ($(BUILD_VARIANT),normal)
  CONFIGURE_ARGS+=--without-ffmpeg
endif
ifeq ($(BUILD_VARIANT),ffmpeg)
  CONFIGURE_ARGS+=--with-ffmpeg=$(STAGING_DIR)/usr
endif

define Package/motion/install
    $(INSTALL_DIR) $(1)/etc
    $(CP) $(PKG_BUILD_DIR)/motion-dist.conf $(1)/etc/motion.conf
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/motion $(1)/usr/bin/
endef

define Package/motion-ffmpeg/install
    $(INSTALL_DIR) $(1)/etc
    $(CP) $(PKG_BUILD_DIR)/motion-dist.conf $(1)/etc/motion.conf
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/motion $(1)/usr/bin/
endef

$(eval $(call BuildPackage,motion))
$(eval $(call BuildPackage,motion-ffmpeg))

it offers a package with ffmpeg support and one without in menuconfig.
Compile tested on brcm2708 and omap.

Thanks for the reply! I try to compile with this makefile, but returned a error: Makefile 82 missing separator.

I replicated that error - its because copy/paste and tab -> whitespace conversion
in the code section here

- replace the whitespaces (beginning of line) after CONFIGURE_ARGS and in the install sections with tabs
- use the makefile at http://paste.debian.net/166606/

Wow! Very very very thank you zloop!!! Motion is running recording videos from my two cheap ip cams (like Foscam FI8918W). I hope one day have enough knowledge about OpenWRT/linux, just like you, to help others here in the forum. For now i'm still in its infancy.

zloop wrote:

I replicated that error - its because copy/paste and tab -> whitespace conversion
in the code section here

- replace the whitespaces (beginning of line) after CONFIGURE_ARGS and in the install sections with tabs
- use the makefile at http://paste.debian.net/166606/

zloop:

Care to send a pull request to https://github.com/openwrt/packages ?

The discussion might have continued from here.