lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Mon Dec 21, 2015 5:03 pm

@jscott13

How about the

Code: Select all

ls -l motion-mmal-lowflyerUK-20151114.tar.gz
What did that give? If it wasn't exactly the same as my last post, the wget hadn't worked properly and the file was corrupted.

Maybe it would be jolly useful if you gave the outputs of all the commands in my last post. This should check that the file was actually there, with the right permissions and that you are working in your home folder.

As a matter of interest, how are connecting your A to the internet so that wget can get the file?

User avatar
jscott13
Posts: 20
Joined: Sun Nov 01, 2015 12:09 pm
Location: Where?
Contact: Website

Re: Motion - MMAL camera

Mon Dec 21, 2015 7:06 pm

@lowflyer

No problem, to recap then - I came here after I searched and found that 'maya' had
the same issue I did and error:

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

While following along with what you suggested and had worked for maya I:

[b]sudo apt-get install -y libjpeg-dev libavformat56 libavformat-dev
libavcodec56 libavcodec-dev libavutil54 libavutil-dev libc6-dev zlib1g-dev
libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev[/b]

And got those files without a problem. But when I:

[b]wget https://www.dropbox.com/s/6ruqgv1h65zuf ... 114.tar.gz[/b]

I got:

wflyerUK-20151114.tar.gz
--2015-12-21 08:34:53-- https://www.dropbox.com/s/6ruqgv1h65zuf ...
114.tar.gz
Resolving http://www.dropbox.com (http://www.dropbox.com)...
108.160.172.238, 108.160.172.206
Connecting to http://www.dropbox.com
(http://www.dropbox.com)|108.160.172.238|:443... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: https://dl.dropboxusercontent.com/conte ... 6E1IZ/file [following]
--2015-12-21 08:34:55-- https://dl.dropboxusercontent.com/conte ...
6E1IZ/file
Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)...
108.160.173.69
Connecting to dl.dropboxusercontent.com
(dl.dropboxusercontent.com)|108.160.173.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 156468 (153K) [application/octet-stream]
motion-mmal-lowflyerUK-20151114.tar.gz: Permission denied

Cannot write to ‘motion-mmal-lowflyerUK-20151114.tar.gz’ (Permission
denied).

That was corrected by adding sudo and then I managed to download your tarball. But when I:

[b]tar -zxvf motion-mmal-lowflyerUK-20151114.tar.gz[/b]

I got:

.tar (child): motion-mmal-lowflyerUK-20151114.tar.gz: Cannot open: No such
file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

Then I rebooted and tried again, this time unpacking the tarball got me:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I boot to shell enter my password, I see pi@raspberrypi ~S. If I run ls there I can see your tarball. When I run

[b]ls -l motion-mmal-lowflyerUK-20151114.tar.gz[/b]

I get:

-rw-r--r-- 1 root root 184489 Dec 21 09:14 motion-mmal-lowflyerUK-Z0151114.tar.gz

which I assume is a good thing, correct? Gonna go out on a limb here, is that part of the error:

gzip: stdin: not in gzip format

saying the tarball is in the wrong format for my software, as though I can't unzip it because I have the wrong software (sorry windows perspective perhaps). I ask because as you might remember installing Jessie on this little A gives me an error. I looked it up here on the forum and long ago (2013) the last post I found left me believing I could ignore it. It was a warning indicating the OS would not be supported by the version Pi I was running it on. When installing, the window that (with a B) normally offers a number of OSs to choose from, I get one and the additional option of a 512 partition. In my roundabout way I'm asking if it's possible I don't have the full deck? ;-) lol

seems something went wrong with bold... and that looked so nice;-)

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Tue Dec 22, 2015 8:07 am

@jscott13 Ok there are some BIG clues about what is going on in those responses.

Firstly look at the response to the wget and you can see

Code: Select all

Length: 156468 (153K) [application/octet-stream]
That means that the correct length of the file is 156468 bytes.

Secondly compare the response to the "ls -l motion-mmal-lowflyerUK-20151114.tar.gz" that you got from what I got. Yours:

Code: Select all

-rw-r--r-- 1 root root 184489 Dec 21 09:14 motion-mmal-lowflyerUK-Z0151114.tar.gz
But mine was

Code: Select all

-rw-r--r-- 1 pi pi 156468 Dec 21 15:28 motion-mmal-lowflyerUK-20151114.tar.gz
Now you can see that your file is owned by root (as you would expect if you got it with a sudo in front of the wget) and is 184489 bytes long. Something didn't work when you tried to download it at 09:14 on Dec 21 (assuming the clock was right in your Pi).

You have to do what I said in my post at 3.15 yesterday. Either clear out your home folder or make a new empty folder. You can always list all the contents of a folder with

Code: Select all

ls -l
I guess it is probably best NEVER to use sudo with the wget command. If you use the following version instead it forces wget to use the filename after the -O

Code: Select all

wget https://www.dropbox.com/s/6ruqgv1h65zufr6/motion-mmal-lowflyerUK-20151114.tar.gz -O motion-mmal-lowflyerUK-20151114.tar.gz
so might be less confusing.

Good luck - sorry that this is being a bit painful for you.

User avatar
jscott13
Posts: 20
Joined: Sun Nov 01, 2015 12:09 pm
Location: Where?
Contact: Website

Re: Motion - MMAL camera

Tue Dec 22, 2015 1:19 pm

@lowflyerUK

Good news this morning! On a fresh install of Jessie I followed your original instructions an all went as expected (I think). Sadly that offers us little in respect to what went wrong. So, if someone else follows this hoping for a solution they may learn little.

Perhaps mounting the USB drive did something to muck up previous efforts? It's a steep learning curve and you have been very helpful. I am hoping that if I keep moving through these tutorials I will, in time, understand just what it is I am doing.

Off to fool with the configuration files and what not. I haven't even checked the output (looked at the photos), but when I saw the software purring along, instead of offering up complaints, I thought you should be the first to know.

It isn't easy helping the blind through a poop storm :-) You've done very well! Thank you!

BTW if you have a website or any other way I might keep in touch, please don't forget to let me know!

*I'm back... perhaps there is even less I understand ;-)

One more quick question (a bit pink eared) I see that after unpacking I start motion with the command ./motion -c motion.mmalcam-both.conf, is that correct? And the config file I will use is pi/motion-mmalcam-both.conf?

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Tue Dec 22, 2015 4:38 pm

@jscott13 Um, you are almost right about which config file. The command

Code: Select all

./motion -c motion-mmalcam-both.conf
works out like this...
  1. the ./motion means "execute the file called motion in the current folder"
  2. the -c means that the next thing is the config file.
  3. and the motion-mmalcam-both.conf (without anything in front of the first letter) means "the file with the given name in the same folder as the executable file" (Watch out for correct spelling, you had written motion.mmalcam-both.conf instead of motion-mmalcam-both.conf. I find it much more accurate to copy and paste rather then trying to type things out again)
So if you are in the folder where both motion and motion-mmalcam-both.conf actually are, then that command runs that copy of motion with that config file. If you started with a fresh installation of jessie, you probably shouldn't have any other copies of these.

User avatar
jscott13
Posts: 20
Joined: Sun Nov 01, 2015 12:09 pm
Location: Where?
Contact: Website

Re: Motion - MMAL camera

Tue Dec 22, 2015 6:53 pm

@lowflyerUK

So I see the tarball, a binary called motion, and the motion-mmalcam-both.conf along side everything else at /home/pi. What I don't see is the configuration file I would use to configure motion. I was not able to configure motion with that config file.

Did I installed motion when I unpacked your tarball? It would seem I have stumbled on your help while trying to figure out how my old cookbook routine went badly. It maybe I only have half of what I need to make this method work. Sorry, I hope I am not trying your patience too badly.

Where I do enjoy this, I can't help but feel you might have something better to do than hold my hand. I obviously need to study a bit more and come back to this when I have a better background in what I am trying to do. I had been fairly successful using cookbooks and tutes to get these little piCams running. My wife loves to watch the animals in the yard with em, and I've got one that keeps an eye on the front stoop. But this time, with the A, copying and paste programming just wasn't cutting it. I found this conversation via internet search.

Gotta put this little project to bed for the holidays. I've got a lot going on over the next few days as I am sure you do as well lowflyerUK. Have a very Merry Christmas sir, and wish our best wishes to your family. I hope to check in again after the holidays.

****Ten minutes later******

:lol: :lol:

Oh brother, talk about pink ears... before shutting down the running version... I took a look what I thought would be the stream at port 8080... sorry friend. I came in half way through a conversation about getting this up and running, I had no idea what you had sent up for us. Very nice indeed! I will kick the tires some and give you my two cents after the holidays.

You must have been just as confused as I was, a fished product. I thought I was getting help tracking down a missing dependency or help with a conf file and instead I get finished software. Like I said... gotta hit the books! :lol:

Kreachers
Posts: 2
Joined: Wed Dec 23, 2015 8:35 am

Re: Motion - MMAL camera

Wed Dec 23, 2015 12:03 pm

ok second time's a charm. First was lost when internet D/C'ed

Hi,

So I'm messing around with my rpi 2 and motion detection. My orginal problem was the same as maya and jscott. Which was fixed with lowflyers hack. Thanks. However now I'm getting a different error:

Code: Select all

pi@raspberrypi:~ $ ./motion -c motion-mmalcam-both.conf
[0] [NTC] [ALL] conf_load: Processing thread 0 - config file motion-mmalcam-both.conf
[0] [NTC] [ALL] motion_startup: Motion mmaltest Started
[0] [NTC] [ALL] motion_startup: Logging to syslog
[0] [NTC] [ALL] motion_startup: Using log type (ALL) log level (INF)
[0] [NTC] [ENC] ffmpeg_init: ffmpeg LIBAVCODEC_BUILD 3670272 LIBAVFORMAT_BUILD 3670272
[0] [NTC] [ALL] main: Thread 1 is from motion-mmalcam-both.conf
[0] [NTC] [ALL] main: Thread 1 is device: /dev/video0 input -1
[0] [NTC] [ALL] main: Stream port 8081
[0] [NTC] [ALL] main: Waiting for threads to finish, pid: 7149
[1] [NTC] [ALL] motion_init: Thread 1 started , motion detection Enabled
[0] [NTC] [STR] httpd_run: motion-httpd testing : IPV4 addr: 0.0.0.0 port: 8080
[1] [ALR] [VID] mmalcam_start: MMAL Camera thread starting... for camera (vc.ril.camera) of 640 x 480 at 4 fps
[0] [NTC] [STR] httpd_run: motion-httpd Bound : IPV4 addr: 0.0.0.0 port: 8080
[1] [ALR] [VID] mmalcam_start: MMAL Camera using video capture
[0] [NTC] [STR] httpd_run: motion-httpd/mmaltest running, accepting connections
[0] [NTC] [STR] httpd_run: motion-httpd: waiting for data on 0.0.0.0 port TCP 8080
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
[1] [ERR] [VID] Failed to create MMAL camera component create_camera_component
Segmentation fault
Also a couple other questions. Whats the difference between motion-mmal that i got from dozencrows and lowflyer and motion that I get from running sudo apt-get install motion. Motion seems to work just fine taking pictures and putting them in the home/pi directory assuming that this is considered fine

Code: Select all

pi@raspberrypi:~ $ motion
[0] [ALR] [ALL] conf_load: could not open configfile /etc/motion/motion.conf: 
[0] [CRT] [ALL] conf_load: Not config file to process using default values
[0] [NTC] [ALL] motion_startup: Using default log level (NTC) (6)
[0] [NTC] [ALL] motion_startup: Motion 3.2.12+git20140228 Started
[0] [NTC] [ALL] motion_startup: Logging to syslog
[0] [NTC] [ALL] motion_startup: Using default log type (ALL)
[0] [NTC] [ALL] motion_startup: Using log type (ALL) log level (NTC)
[0] [NTC] [ENC] ffmpeg_init: ffmpeg LIBAVCODEC_BUILD 3670016 LIBAVFORMAT_BUILD 3670272
[0] [NTC] [ALL] main: Thread 1 is device: /dev/video0 input -1
[0] [NTC] [ALL] main: Stream port 0
[0] [NTC] [ALL] main: Waiting for threads to finish, pid: 7660
[1] [NTC] [ALL] motion_init: Thread 1 started , motion detection Enabled
[1] [NTC] [VID] vid_v4lx_start: Using videodevice /dev/video0 and input -1
[1] [NTC] [VID] v4l2_get_capability: 
------------------------
cap.driver: "uvcvideo"
cap.card: "UVC Camera (046d:0824)"
cap.bus_info: "usb-3f980000.usb-1.2"
cap.capabilities=0x84200001
------------------------
[1] [NTC] [VID] v4l2_get_capability: - VIDEO_CAPTURE
[1] [NTC] [VID] v4l2_get_capability: - STREAMING
[1] [NTC] [VID] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1] [NTC] [VID] v4l2_select_input: - CAMERA
[1] [WRN] [VID] v4l2_select_input: Device doesn't support VIDIOC_G_STD
[1] [NTC] [VID] v4l2_set_pix_format: Config palette index 17 (YU12) doesn't work.
[1] [NTC] [VID] v4l2_set_pix_format: Supported palettes:
[1] [NTC] [VID] v4l2_set_pix_format: (0) YUYV (YUV 4:2:2 (YUYV))
[1] [NTC] [VID] v4l2_set_pix_format: 0 - YUV 4:2:2 (YUYV) (compressed : 0) (0x56595559)
[1] [NTC] [VID] v4l2_set_pix_format: (1) MJPG (MJPEG)
[1] [NTC] [VID] v4l2_set_pix_format: 1 - MJPEG (compressed : 1) (0x47504a4d)
[1] [NTC] [VID] v4l2_set_pix_format Selected palette YUYV
[1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette YUYV (352x288)
[1] [NTC] [VID] v4l2_do_set_pix_format: Using palette YUYV (352x288) bytesperlines 704 sizeimage 202752 colorspace 00000008
[1] [NTC] [VID] v4l2_scan_controls: found control 0x00980900, "Brightness", range 0,255 
[1] [NTC] [VID] v4l2_scan_controls: 	"Brightness", default -8193, current 128
[1] [NTC] [VID] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,255 
[1] [NTC] [VID] v4l2_scan_controls: 	"Contrast", default 57343, current 32
[1] [NTC] [VID] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,255 
[1] [NTC] [VID] v4l2_scan_controls: 	"Saturation", default 57343, current 38
[1] [NTC] [VID] v4l2_scan_controls: found control 0x00980913, "Gain", range 0,255 
[1] [NTC] [VID] v4l2_scan_controls: 	"Gain", default 57343, current 0
[1] [NTC] [VID] vid_v4lx_start: Using V4L2
[1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1] [NTC] [EVT] event_new_video FPS 7
[1] [NTC] [ALL] motion_detected: Motion detected - starting event 1
[1] [NTC] [EVT] event_newfile: File of type 1 saved to: ./01-20151223112628-07.jpg
[1] [NTC] [EVT] event_newfile: File of type 1 saved to: ./01-20151223112629-00.jpg
[1] [NTC] [EVT] event_newfile: File of type 1 saved to: ./01-20151223112629-02.jpg
[1] [NTC] [EVT] event_newfile: File of type 1 saved to: ./01-20151223112629-04.jpg
[1] [NTC] [EVT] event_newfile: File of type 1 saved to: ./01-20151223112629-06.jpg
[1] [NTC] [EVT] event_newfile: File of type 1 saved to: ./01-20151223112630-01.jpg
^C[1] [NTC] [ALL] motion_loop: End of event 1
[1] [NTC] [ALL] motion_loop: Thread exiting
[1] [NTC] [VID] vid_close: Closing video device /dev/video0
[0] [NTC] [ALL] main: Threads finished
[0] [NTC] [ALL] main: Motion terminating
I'm still new to linux the raspberry pi and installing stuff in this manor with errors. so to me that looks fine.

I tried to compile the code following exactly what lowflyer said and I got this

Code: Select all

pi@raspberrypi:~ $ sudo apt-get install -y libjpeg-dev libavformat56 libavformat-dev libavcodec56 libavcodec-dev libavutil54 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libavcodec-dev is already the newest version.
libavcodec56 is already the newest version.
libavformat-dev is already the newest version.
libavformat56 is already the newest version.
libavutil-dev is already the newest version.
libavutil54 is already the newest version.
libc6-dev is already the newest version.
libjpeg-dev is already the newest version.
libmysqlclient-dev is already the newest version.
libmysqlclient18 is already the newest version.
libpq-dev is already the newest version.
libpq5 is already the newest version.
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ sudo apt-get install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
git is already the newest version.
git set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ sudo apt-get install cmake
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  cmake-data
Suggested packages:
  codeblocks eclipse ninja-build
The following NEW packages will be installed:
  cmake cmake-data
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,799 kB of archives.
After this operation, 14.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main cmake-data all 3.0.2-1 [929 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main cmake armhf 3.0.2-1 [1,870 kB]
Fetched 2,799 kB in 3s (763 kB/s)                                   
Selecting previously unselected package cmake-data.
(Reading database ... 125350 files and directories currently installed.)
Preparing to unpack .../cmake-data_3.0.2-1_all.deb ...
Unpacking cmake-data (3.0.2-1) ...
Selecting previously unselected package cmake.
Preparing to unpack .../cmake_3.0.2-1_armhf.deb ...
Unpacking cmake (3.0.2-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up cmake-data (3.0.2-1) ...
Setting up cmake (3.0.2-1) ...
pi@raspberrypi:~ $ git clone https://github.com/lowflyerUK/motion.git
Cloning into 'motion'...
remote: Counting objects: 2919, done.
remote: Total 2919 (delta 0), reused 0 (delta 0), pack-reused 2919
Receiving objects: 100% (2919/2919), 2.66 MiB | 1.04 MiB/s, done.
Resolving deltas: 100% (2131/2131), done.
Checking connectivity... done.
pi@raspberrypi:~ $ git checkout mmal-test
fatal: Not a git repository (or any of the parent directories): .git
pi@raspberrypi:~ $ git clone https://github.com/raspberrypi/userland
Cloning into 'userland'...
remote: Counting objects: 3629, done.
remote: Total 3629 (delta 0), reused 0 (delta 0), pack-reused 3629
Receiving objects: 100% (3629/3629), 33.68 MiB | 1.30 MiB/s, done.
Resolving deltas: 100% (1787/1787), done.
Checking connectivity... done.
Checking out files: 100% (781/781), done.
pi@raspberrypi:~ $ cd motion/
pi@raspberrypi:~/motion $ USERLANDPATH=/home/pi/userland cmake .
CMake Error: The source directory "/home/pi/motion" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
pi@raspberrypi:~/motion $ make
make: *** No targets specified and no makefile found.  Stop.
If someone could turn that into English it would be nice but not necessary.
hope I'm not forgetting anything, anyways.
Thanks

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Wed Dec 23, 2015 1:32 pm

@Kreachers I will try to answer some of your questions...

Your first segmentation fault looks as if it is caused by your Pi not being able access the Raspberry Pi camera module. Is that what you want to use? If so, is it enabled in raspi-config? Is something else accessing it first?

The difference between the versions might well have a bearing on the above:
  1. The original (and very good) motion, as installed from the raspbian repository, normally runs using /dev/video0. So if you have a USB webcam plugged in, this is good. From the log it looks as if you do have a uvcvideo webcam.
  2. Dozencrows' (very clever) adaptation uses a direct and very efficient connection to the Raspberry Pi camera module. There is no point in using this unless you have the camera module. It won't work with the latest version of Raspbian (Jessie).
  3. My small update of dozencrows version should also work with Raspbian Jessie and adds a new little feature - the ability to save both full resolution and reduced resolution stills. Can be useful if you want a thumbnail. There is also no point in using this unless you have the camera module.
Thanks for your final point. I had made an error in the order of the commands. I will update my previous post at viewtopic.php?p=864996#p864996. Sorry!

Hope this helps.

nevyoung
Posts: 2
Joined: Thu Nov 15, 2012 4:13 pm

Re: Motion - MMAL camera

Wed Dec 23, 2015 4:41 pm

Just to say thank you lowflyer.

Using Pi B+ and Jessie. Your instructions provided a working result at first attempt!! Have not been so lucky in long time. I had previously tried Motion in its various guises encountering all the problems that have been mentioned on the forums. I was losing hope.

The system has been capturing short videos all of today and certainly appears to triggering only on genuine motion triggers, albeit a small motion of a person walking past an open door outside the room where the PiCam is mounted.

Now I need to become familiar with all the parameters in the config file so that I can tweak the motion function to suit my purpose.

For your interest, this Pi will be monitoring movement across the hatchway of a very small shop so that transactions can be monitored, not only to combat fraudulent activity by the staff, but also as a reference in case of later confusion over a particular transaction. I also hope to implement a small POS into the Pi, perhaps using the 7" Touchscreen.

Daily transactions will automatically be uploaded to a server and perhaps the short video clips too. Web streaming could be a nice-to-have in due course. I have got the Pi connected to the www through a 3G usb modem dongle.

Wish me luck!

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Thu Dec 24, 2015 7:43 am

@nevyoung

Sounds like a perfect project for a Raspberry Pi. Web streaming at low resolution is good for keeping your 3g bandwidth usage low. Also the low res stills can be used as thumbnails on a web page so you only download high res stills or movies that are really interesting. I use php and apache for this. You will have to adjust the config parameters to ensure that it saves enough full res stills when motion is detected if you need that level of detail to check the transactions.

Good luck!

Kreachers
Posts: 2
Joined: Wed Dec 23, 2015 8:35 am

Re: Motion - MMAL camera

Fri Dec 25, 2015 4:56 am

@lowflyer

Thanks that actually make alot more sense to why it wouldn't work. I'm using a usb webcam right now but I plan to get a camera board later. So hopefully when I get the camera board it will work just fine.

Is it possible with motion to set it up to record video at a low frame rate? and what about audio also is there a way that if I plugged in a mic I could get audio. i guess a better question is where is the motion config file at so i could explore that?

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Fri Dec 25, 2015 10:52 am

@Kreachers Your best plan to find out about the standard features (i.e. non mmal) of motion would be to spend some time looking at the superb motion wiki http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome. You can find out there about all the options including where it looks for config files. Really, it is worth the time if you are going to use motion!

Good luck!

urbalk
Posts: 2
Joined: Fri Dec 25, 2015 7:32 pm

Re: Motion - MMAL camera

Fri Dec 25, 2015 7:41 pm

Good evening,
I start capture as:
/home/pi/motion/motion -c /home/pi/motion/configs/motion-mmalcam-both.conf
[0] [NTC] [ALL] conf_load: Processing thread 0 - config file /home/pi/motion/configs/motion-mmalcam-both.conf
[0] [ALR] [ALL] conf_cmdparse: Unknown config option "ffmpeg_deinterlace"
[0] [NTC] [ALL] motion_startup: Motion mmaltest Started
[0] [NTC] [ALL] motion_startup: Logging to syslog
[0] [NTC] [ALL] motion_startup: Using log type (ALL) log level (ALR)
[1] [ALR] [VID] mmalcam_start: MMAL Camera thread starting... for camera (vc.ril.camera) of 320 x 288 at 4 fps
[1] [ALR] [VID] mmalcam_start: MMAL Camera using video capture
&: 1: &: /home/pi/bin/motion_resize.py: not found
&: 1: &: /home/pi/bin/motion_resize.py: not found
&: 1: &: /home/pi/bin/motion_resize.py: not found
&: 1: &: /home/pi/bin/motion_resize.py: not found
&: 1: &: /home/pi/bin/motion_resize.py: not found
&: 1: &: /home/pi/bin/motion_resize.py: not found
This file doesn't exist on my Pi, how i can solve this ?
Thank you for help.

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Fri Dec 25, 2015 8:25 pm

@urbalk Hi! In fact that is just a warning that you don't have a file that I use. You can ignore those messages. I use the helper program /home/pi/bin/motion_resize.py to move the captured images and movies out of /run/shm/ and put them on my web page. In fact if you don't move them out, /run/shm/ will fill up after a while. (I like to put them first of all into /run/shm/ because that is RAM and doesn't wear out my SDcard).

If you want to get rid of the messages, have a good look at the config file /home/pi/motion/configs/motion-mmalcam-both.conf. You could change the line 671 (or thereabouts) from

Code: Select all

on_picture_save /home/pi/bin/motion_resize.py %f %n
to

Code: Select all

#on_picture_save /home/pi/bin/motion_resize.py %f %n
I guess I should change it in github.

If you want to change where the images and movies are stored (to avoid the need for a helper program like /home/pi/bin/motion_resize.py, have a look at the config file around lines 469 to 506 called "Target Directories and filenames For Images And Films"

All the standard features of motion are very well explained in the superb motion wiki http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome.

I hope this helps.

maya
Posts: 8
Joined: Thu Dec 17, 2015 5:35 pm

Re: Motion - MMAL camera

Sat Dec 26, 2015 4:48 am

Hi experts,
I am having a problem with the avi files which are being recorded. I think the frames are being skipped and consequently the video files are practically ineffective. I am attaching a sample file. I would be grateful if the experts can give me a clue to the problem. I currently have a framerate of 10 and I have tried going up to 30fps and I still get the missing frames.

https://www.dropbox.com/s/xrjy6iaigtxe1 ... 3.avi?dl=0

Thanks in advance
Maya

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Sat Dec 26, 2015 7:47 am

@maya I don't think the Raspberry Pi is powerful enough for motion to do 10 frames per second at 640x480. You could try 2 or 4 frames per second, or reduce the resolution. The clever bit about dozencrows' idea is that you can get motion also to save still images at higher resolution if you want.

In theory it may be possible to get the rather powerful GPU to make the video. Anyone able to do this?

Until then, you will have to play with the config options and try to get videos that you like. By the way, I use mplayer to view the videos - it is easy to single step through each frame (press 'P' to pause, then '.' to step).

Hope this helps.

urbalk
Posts: 2
Joined: Fri Dec 25, 2015 7:32 pm

Re: Motion - MMAL camera

Sat Dec 26, 2015 1:34 pm

@lowflyer,
Thank-you for your quick answer. But if I want use a picture to send it to a Gsm, where I can found it ? I don't know in which size I must change for a correct display on Galaxy S3.

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Sat Dec 26, 2015 2:32 pm

@urbalk

It looks according to https://en.wikipedia.org/wiki/Samsung_Galaxy_S_III that your S3's screen is 720×1280 pixel resolution, so this would be a good starting point. But depending on how you are planning to transfer the picture and what app you will use on the S3, the picture can be scaled to fit.

SupahNoob
Posts: 2
Joined: Sun Dec 27, 2015 5:02 am

Re: Motion - MMAL camera

Sun Dec 27, 2015 5:17 am

Hi lowflyer, been looking through a lot of this thread and trying to understand quite a bit. One thing I've run into that I don't know how to fix .. I'm trying to start up motion via Python and this is the error I get. I'm greeted with a gray screen when trying to view the output. I should note that running this via ./startmotion or

Code: Select all

sudo /path/to/my/script/motion -n -c motion.conf &>/dev/null &
works as usual, no problem. (I've renamed to simply "motion".)

Code: Select all

[0] [NTC] [ALL] [Dec 26 22:59:16] motion_startup: Using log type (ALL) log level (WRN)
[1] [ALR] [VID] [Dec 26 22:59:17] mmalcam_start: MMAL Camera thread starting... for camera (vc.ril.camera) of 720 x 480 at 10 fps
[1] [ALR] [VID] [Dec 26 22:59:17] mmalcam_start: MMAL Camera using video capture
[1] [ERR] [VID] [Dec 26 22:59:17] mmal_output_process_buffer: Output mmalcam - buffer size 529920 does not match destination 518400

ERR et al ...

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Sun Dec 27, 2015 4:48 pm

@SupahNoob That error is a new one on me and I couldn't find anything immediately with google. Exactly how do you launch motion using Python? Are you sure it is using the right config file? You could try to increase the logging level and see if you get any useful diagnostic information.

SupahNoob
Posts: 2
Joined: Sun Dec 27, 2015 5:02 am

Re: Motion - MMAL camera

Sun Dec 27, 2015 5:35 pm

@lowflyer,

Thanks for your response. I will increase the log level and try again. I tried Googling for the error and found only one link (back to this forum), but it did not discuss the error at all, and instead focused on something else. That's why I thought to turn to here. What should I increase the log level to?

Alternatively, I've started looking into using Python solely for manipulating the camera board via PiCamera as I think it will ultimately give me more control, and be much more familiar for me.

maya
Posts: 8
Joined: Thu Dec 17, 2015 5:35 pm

Re: Motion - MMAL camera

Mon Dec 28, 2015 3:50 pm

Thanks @lowflyer. I'll update if I find a solution to this issue.

TMartin
Posts: 2
Joined: Tue Dec 29, 2015 4:42 am

Re: Motion - MMAL camera

Tue Dec 29, 2015 4:51 am

I have motion working on Jessie using motion-mmal-lowflyerUK-20151114.tar.gz and the motion-mmalcam-both.conf config file. It streams video fine but I cannot seem to get it to save pictures or video when it detects movement. It creates the snapshots every 10 secs so I know that works. I assume I need to change something in the config file to make it work. I am using the Pi Camera. Thanks for your help.

TMartin
Posts: 2
Joined: Tue Dec 29, 2015 4:42 am

Re: Motion - MMAL camera

Tue Dec 29, 2015 9:24 am

After working with it awhile, I see that it is working but it takes a lot of motion for several frames to get it to take a picture. Is there a way to make it respond faster?

lowflyer
Posts: 70
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion - MMAL camera

Tue Dec 29, 2015 9:58 am

@TMartin Great that you got it working! Have a look at the very good motion wiki at http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome. It sounds as though you want to adjust the following config options:

threshold http://www.lavrsen.dk/foswiki/bin/view/ ... nThreshold
minimum_motion_frames http://www.lavrsen.dk/foswiki/bin/view/ ... tionFrames

Maybe also check that you are not overloading the Pi with a high framerate or resolution.

Hope this helps! Good luck!

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 5 guests