sackmotion / motion

Motion, a software motion detector
http://motion.sf.net
GNU General Public License v2.0
330 stars 205 forks source link

update to support libav10 #17

Open infinity0 opened 10 years ago

infinity0 commented 10 years ago

libav10 has dropped support for the CODECID* macros, renaming them to AV_CODECID*.

We can restore support just by replacing the relevant expressions in ffmpeg.c, but you might want to use a conditional macro instead. Here is the relevant entry from doc/APIchanges:

2012-08-07 - 104e10f - lavc 54.25 - avcodec.h
  Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*.
infinity0 commented 10 years ago

You probably also want to update avcodec__frame. While not removed from libav10, they have been deprecated and will be removed later.

ckxng commented 5 years ago

This commit should allow you to compile on rasbian debian stretch, which uses ffmpeg 3.2.12 and includes the changes you referenced above.

Note also that the function used for deinterlacing is also no longer available and an alternate method must be used if you will be handling interlaced video. Since I have no interest in deinterlacing, I just pulled that code out and left a note behind.

This has been tested using ckxng/motion:mmal-ffmpeg-3.2.12 and the instructions in BUILD-HOWTO, on a Raspberry PI 3 B+ using an up-to-date image with the following properties:

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
$ dpkg -l ffmpeg libavcodec57
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  ffmpeg         7:3.2.12-1~d armhf        Tools for transcoding, streaming
ii  libavcodec57:a 7:3.2.12-1~d armhf        FFmpeg library with de/encoders f
$ uname -a
Linux mirror01 4.19.25-v7+ #1205 SMP Mon Feb 25 18:19:20 GMT 2019 armv7l GNU/Linux

With a Pi Camera Module 2 (8MP), I am able to process motion on a smaller 410x308 image, and output full size 3280x2464 images using mmalcam_secondary_buffer_upscale and output_secondary_pictures. I am also running at 10% CPU while waiting for motion/30% during an event, instead of maxing out one of my cores at 100% all the time.

tosiara commented 5 years ago

@ckxng, please check the latest motion code base: https://github.com/Motion-Project/motion

ckxng commented 5 years ago

@tosiara I see. It appears that the official Motion codebase now supports Raspberry PI cameras with MMAL, and Raspbian simply is lagging behind. In that case, I will simply use a recent release of the upstream project instead. Thank you for that pointer!