I have been trying to install motion on my Pi3, only to be chasing library errors at every step. None of the tutorials seem to say what flavor of Pi OS to use. I am beginning to wonder if I chose the wrong one?

pi@raspberrypi:~/mmal $ sudo ./motion -n -c motion-mmalcam.conf  
./motion: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

I took care of that error and then I get

pi@raspberrypi:~/mmal $ sudo ./motion -n -c motion-mmalcam.conf 

./motion: error while loading shared libraries: libavformat.so.53:
   cannot open shared object file: No such file or directory

pi@raspberrypi:~/mmal $ sudo apt-get install -y libavformat53 libavformat53-dev 
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libavformat53
E: Unable to locate package libavformat53-dev

What has changed since all the tutorials were made as none have these issues? Is there a better repro to start with to get motion to work?

  • What OS are you using? You can see which libraries you have installed using ldconfig as here: serverfault.com/questions/54736/… – Brick Dec 7 '17 at 17:52
  • ldconfig -p | grep libavformat libavformat.so.57 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libavformat.so.57 libavformat.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libavformat.so – StephanM Dec 7 '17 at 20:48
  • 1
    Most of the instructions are very outdated and the build of motion referred to is already compiled with references to old library versions. For as popular as it is, I don't understand why the mmal version isn't in the official Pi repo. – deltaray Mar 16 '18 at 14:06

Install motion from github and build it yourself. This is how to do it:

sudo mkdir motion 
sudo cd motion
sudo apt-get install autoconf automake autopoint build-essential pkgconf libtool libzip-dev libjpeg-dev git libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev libwebp-dev gettext libmicrohttpd-dev

git clone https://github.com/Motion-Project/motion.git 
sudo cd motion 
sudo autoreconf -fiv 
sudo ./configure 
sudo make 
sudo make install

This will get installed in: /usr/local/bin (motion executable will be here) /usr/local/etc/motion/ (motion-dist-conf will be here, rename it to motion.conf and do the settings) MMAL and picam should work now.

For tutorial and video, you can refer my website: https://www.zenofall.com/diy-motion-detection-camera-with-raspberry-pi-part-2/

  • 1
    I think you need to review the use of sudo. At least half of the commands you use above don't need it. You should also add an apt update before trying to install anything – Dirk Jan 17 '19 at 10:03
  • Note that it's OK to post links to your own website if the linked page is relevant to the question and you disclose it's your site. I believe you got scolded at because you suggested "to check more tutorials zenofall.com", but I see no problem with a motion detection link in a question about motion detection. And yeah, posting a link as text (e.g. zenofall(dot)com) makes no difference in how spammy it is. Last but not least, consider using a single account. You can ask a mod to merge several accounts you have created (by mistake?) into one by raising a custom flag on one of your posts. – Dmitry Grigoryev Jan 18 '19 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.