Hix
Posts: 23
Joined: Tue Nov 12, 2013 10:04 am

30 second record limit in motion

Fri Mar 27, 2015 7:10 pm

I appear to have interested parties that have been checking out the nestbox I installed the PiCam into. One quick question though.
It appears that when using motion, the max time for record is 30 seconds.
I've checked /etc/motion/motion.conf and the relevant line - max_mpeg_time 0 seems legit.
/etc/raspimjpeg and /var/www/uconfig don't seem to have anything that controls this either.
Is there something I haven't changed somewhere else?
I fear that I may miss something if the 30 second timeout persists.

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: 30 second record limit in motion

Fri Mar 27, 2015 8:10 pm

Hix wrote: I fear that I may miss something if the 30 second timeout persists.
If using my version of software with scheduler then there is a setting there Max_capture (default 30 seconds). Up that to whatever you like. The idea here was to both ensure one didn't get super long recordings in a security situation and it also allows fixed length recordings by setting the off command to nothing and letting the max turn it off.

I should make 0 here the same as no maximum. Something for next update.
Attachments
max1.jpg
max1.jpg (3.03 KiB) Viewed 2733 times

Hix
Posts: 23
Joined: Tue Nov 12, 2013 10:04 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 8:22 pm

Ahhhhh, completely missed the scheduler. Thanks Rob.
Assume 0 is infinite?

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 9:25 pm

HI Robert,

Just updated to newest version today. It looks that I can get a few recorded, but some are not.

I can see h264 raw file at time, then it's gone without being converted to MP4. Weird. Here's some log.

Any ideas?
thanks

[2015/Mar/27 17:18:08] Stop capture request ignored, already stopped
[2015/Mar/27 17:18:08] Ignore FIFO char

[2015/Mar/27 17:18:29] Start capture requested
[2015/Mar/27 17:18:29] Send ca 1
[2015/Mar/27 17:18:32] Ignore FIFO char

[2015/Mar/27 17:18:52] Stop capture requested
[2015/Mar/27 17:18:52] Send ca 0
[2015/Mar/27 17:18:54] Ignore FIFO char

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 9:31 pm

see attached two files indicating that h264 raw file is gone. weird. How come have I got other files before?!

Any thoughts?
thanks
Attachments
Screenshot11.png
Screenshot11.png (27.83 KiB) Viewed 2684 times
Screenshot1.png
Screenshot1.png (29.44 KiB) Viewed 2684 times

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Mar 27, 2015 9:41 pm

Hix wrote:Ahhhhh, completely missed the scheduler. Thanks Rob.
Assume 0 is infinite?
0 wasn't infinite but is now. You could set a very large value before, now you can set 0.

Note when updating the software where the scheduler has changed then it needs to be stopped and started (or a reboot) as otherwise the background scheduler is still running the old code.

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Mar 27, 2015 9:45 pm

piecam wrote:HI Robert,

Just updated to newest version today. It looks that I can get a few recorded, but some are not.

I can see h264 raw file at time, then it's gone without being converted to MP4. Weird. Here's some log.

Any ideas?
thanks

[2015/Mar/27 17:18:08] Stop capture request ignored, already stopped
[2015/Mar/27 17:18:08] Ignore FIFO char

[2015/Mar/27 17:18:29] Start capture requested
[2015/Mar/27 17:18:29] Send ca 1
[2015/Mar/27 17:18:32] Ignore FIFO char

[2015/Mar/27 17:18:52] Stop capture requested
[2015/Mar/27 17:18:52] Send ca 0
[2015/Mar/27 17:18:54] Ignore FIFO char
Ignore FIFO char means scheduler is receiving unexpected commands, probably because motion is not set up correctly. It should be sending just a 1 for start and a 0 for stop into FIFO1

Hix
Posts: 23
Joined: Tue Nov 12, 2013 10:04 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 9:59 pm

Thanks dude.
Excuse my ignorance but is the correct way to do updates:
Git pull....
Then
./...sh install
Then
Sudo reboot?

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Mar 27, 2015 10:09 pm

Hix wrote:Thanks dude.
Excuse my ignorance but is the correct way to do updates:
Git pull....
Then
./...sh install
Then
Sudo reboot?
After the first install then all you should need to do is a .sh install followed by a .sh start

The install command includes a git pull.

There is also now a .sh update command which will just update the web and raspimjpeg components and not overwrite config changes. That should be fine most of the time but won't update things like default raspimjpeg config. Again a .sh start is needed after.

No reboots should be necessary. I haven't rebooted my camera in over 2 weeks despite lots of updates.

The other thing to bear in mind is that if a change is made to the .sh itself then it can needs 2 goes as the first go would still be using th eold version of th escript but the second will be using th eupdated one.

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Fri Mar 27, 2015 10:15 pm

piecam wrote:see attached two files indicating that h264 raw file is gone. weird. How come have I got other files before?!

Any thoughts?
thanks
.m4.h264 files exist during and shortly after a recording. The raw .h264 data in them is then converted by MP4Box into a .mp4 file and the .h264 is then deleted. This can take a little while depending on the size of the recording which you will either see as video processing on the main screen if MP4Box is set true, or is done in the background if MP4Box is set to background. Either way you will see these .h264 files until MP4Box has completed processing.

You can check if MP4Box is running by issuing a ps -A command. If MP4Box has finished and a .h264 file is left over then something has definitely gone very wrong. Even if MP4Box fails for some reason the .h264 file should get removed. Let me know if you have .h264 files and no MP4Box running.

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 10:41 pm

HI Robert,
Is the process literally called MP4box? here's out, but couldn’t find one. H264 file is gone and no MP4 file being converted.

thanks
peng@raspberrypi:~$ ps -A
PID TTY TIME CMD
1 ? 00:00:02 init
2 ? 00:00:00 kthreadd
3 ? 00:02:58 ksoftirqd/0
5 ? 00:00:00 kworker/0:0H
7 ? 00:02:11 rcu_preempt
8 ? 00:00:00 rcu_sched
9 ? 00:00:00 rcu_bh
10 ? 00:00:00 khelper
11 ? 00:00:00 kdevtmpfs
12 ? 00:00:00 netns
13 ? 00:00:00 perf
14 ? 00:00:00 khungtaskd
15 ? 00:00:00 writeback
16 ? 00:00:00 crypto
17 ? 00:00:00 bioset
18 ? 00:00:00 kblockd
19 ? 00:00:00 kworker/0:1
20 ? 00:00:00 rpciod
21 ? 00:00:00 kswapd0
22 ? 00:00:00 fsnotify_mark
23 ? 00:00:00 nfsiod
29 ? 00:00:00 kthrotld
30 ? 00:03:14 VCHIQ-0
31 ? 00:00:05 VCHIQr-0
32 ? 00:00:00 VCHIQs-0
33 ? 00:00:00 iscsi_eh
34 ? 00:00:00 dwc_otg
35 ? 00:00:00 DWC Notificatio
36 ? 00:01:47 kworker/u2:1
37 ? 00:00:00 VCHIQka-0
38 ? 00:00:00 SMIO
39 ? 00:00:00 deferwq
41 ? 00:00:01 mmcqd/0
42 ? 00:00:07 kworker/0:2
43 ? 00:00:00 jbd2/mmcblk0p2-
44 ? 00:00:00 ext4-rsv-conver
159 ? 00:00:00 udevd
1371 ? 00:00:00 ipv6_addrconf
1388 ? 00:00:00 dhclient
1409 ? 00:00:00 cifsiod
1412 ? 00:00:35 cifsd
1638 ? 00:00:00 rsyslogd
1688 ? 00:00:02 apache2
1725 ? 00:06:17 apache2
1748 ? 00:00:00 dbus-daemon
1750 ? 00:00:00 cron
1809 ? 00:06:24 apache2
1822 ? 00:00:05 ntpd
1852 ? 00:00:00 sshd
1874 ? 00:06:11 apache2
1876 ? 00:06:19 apache2
1881 ? 00:16:44 raspimjpeg
1897 ? 00:00:00 startpar
1898 tty1 00:00:00 getty
1899 tty2 00:00:00 getty
1900 tty3 00:00:00 getty
1901 tty4 00:00:00 getty
1902 tty5 00:00:00 getty
1903 tty6 00:00:00 getty
1904 ? 00:00:00 udevd
1905 ? 00:00:00 udevd
1923 ? 00:05:53 apache2
1924 ? 00:06:17 apache2
1925 ? 00:06:28 apache2
1931 ? 00:06:36 apache2
2033 ? 00:04:20 apache2
2120 ? 00:00:00 kworker/0:1H
2153 ? 00:00:45 php
2163 ? 00:12:51 motion
2183 ? 00:02:37 apache2
2185 ? 00:00:00 kworker/u2:0
2226 ? 00:00:05 apache2
2227 ? 00:00:00 sshd
2229 ? 00:00:00 sshd
2230 pts/1 00:00:00 bash
2235 pts/1 00:00:00 ps

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 10:47 pm

If you can give me the process name, I can try again.
will it be only running at time of conversion? or will it be there always?
thanks

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 10:50 pm

How ever, I did have a thumnail file created!
It's not happening to other pis, which are not updated to yesterday's version.
thanks

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 11:29 pm

[2015/Mar/27 17:18:52] Stop capture requested
[2015/Mar/27 17:18:52] Send ca 0
[2015/Mar/27 17:18:54] Ignore FIFO char[/quote]

Ignore FIFO char means scheduler is receiving unexpected commands, probably because motion is not set up correctly. It should be sending just a 1 for start and a 0 for stop into FIFO1[/quote]

HI robert,

It looks that it has wrong value on "on-event-end",echo '0' > /var/www/FIFO1. I haven't touched this value. Not sure it's my mistake or some sort of, or a typo on new version of your git.

Will change that and see.

thanks

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 11:29 pm

attachemet
Attachments
Screenshot111.png
Screenshot111.png (42.12 KiB) Viewed 2523 times

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Fri Mar 27, 2015 11:31 pm

sorry, my mistake, it seems that you pi have this "on_event_start" and "on_event_end" both with FIFO1.

Then, what could be wrong?
thanks

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sat Mar 28, 2015 12:10 am

piecam wrote:sorry, my mistake, it seems that you pi have this "on_event_start" and "on_event_end" both with FIFO1.

Then, what could be wrong?
thanks
The illegal character log report is a problem with the default motion conf in the installer
It should read echo -n '1' >/var/www/FIFO1 and similarly for the end

The -n on the echo command suppresses the trailing LF which gets logged as an unexpected character but should otherwise be harmless.

MP4Box only runs whilst it is doing a conversion. If you record a longish video (e.g. 60 seconds) then it should run long enough to see it in the ps -A list.

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Sat Mar 28, 2015 12:01 pm

The illegal character log report is a problem with the default motion conf in the installer
It should read echo -n '1' >/var/www/FIFO1 and similarly for the end

The -n on the echo command suppresses the trailing LF which gets logged as an unexpected character but should otherwise be harmless.


HI Robert,
Shoud I add manually "-n" into the command in your GUI? Is that something to do with some sort of typo on repo's script or something done by me inadvertently?

If it's typo on script side, then, I can do a git pull after you update your git repo.
please let me know. thanks

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Sat Mar 28, 2015 12:15 pm

Hi Robert,
With regards to h264 not converting to MP4, I do see a new MP4 in the folder.

Then, I tested briefly by shaking my hand in front of cam, when I did see h264 file and
3112 ? 00:00:00 sh
3113 ? 00:00:01 MP4Box
3114 pts/0 00:00:00 ps

However, then, the h264 file is gone without new mp4 file. weird.

Log from scheduler is as follows, (it looks ok)
[2015/Mar/28 08:05:46] Start capture requested
[2015/Mar/28 08:05:46] Send ca 1
[2015/Mar/28 08:05:49] Ignore FIFO char

[2015/Mar/28 08:06:10] Stop capture requested
[2015/Mar/28 08:06:10] Send ca 0
[2015/Mar/28 08:06:12] Ignore FIFO char

In both tests, I did have thumbnail generated. Any thoughts? tks

I upgraded to newest version for each pis. it seems they all demonstrate same issue. Not sure it's something with my setting or code.

Or, is there a algorithm in script that says, I detect the motion, then, (after x seconds delay, due to current coding,) the recording starts; however, if recording h264 file doesn't have much motion in it, then it's deleted and not converted to MP4. This seems fitting that the brief movement triggers motion, however, after that, there's not much movement any more. This may explain the length of capture is variable to max 30 seconds. If this is true, it may means that algorithm tells raspimjpeg to delete existing h264 file and not bothering to convert to MP4, as there's no movement any more.

Or, once triggered, it will record for defined xxx seconds no matter there's any further motion at all. But, this doesn't match the variable length of time being captured.

Hope you can shed some lights on this and how things work.
I am very much appreciative and thanks a lot.

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sat Mar 28, 2015 3:44 pm

piecam wrote: Shoud I add manually "-n" into the command in your GUI? Is that something to do with some sort of typo on repo's script or something done by me inadvertently?

If it's typo on script side, then, I can do a git pull after you update your git repo.
please let me know. thanks
It was a problem on the default motion.conf supplied with the install, but as I said it is harmless and just logs the unexpected LF.

I have corrected it now, but you can also correct it from the GUI.

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sat Mar 28, 2015 4:04 pm

piecam wrote:Hi Robert,
With regards to h264 not converting to MP4, I do see a new MP4 in the folder.

Then, I tested briefly by shaking my hand in front of cam, when I did see h264 file and
3112 ? 00:00:00 sh
3113 ? 00:00:01 MP4Box
3114 pts/0 00:00:00 ps

However, then, the h264 file is gone without new mp4 file. weird.

Or, is there a algorithm in script that says, I detect the motion, then, (after x seconds delay, due to current coding,) the recording starts; however, if recording h264 file doesn't have much motion in it, then it's deleted and not converted to MP4. This seems fitting that the brief movement triggers motion, however, after that, there's not much movement any more. This may explain the length of capture is variable to max 30 seconds. If this is true, it may means that algorithm tells raspimjpeg to delete existing h264 file and not bothering to convert to MP4, as there's no movement any more.

Or, once triggered, it will record for defined xxx seconds no matter there's any further motion at all. But, this doesn't match the variable length of time being captured.
.
There is nothing in the system at the moment detecting and giving special treatment to short captures. There is a schedule setting that automatically stops recordings longer than Max_Capture (default 30 seconds) but that can be increased to give very long recordings. Once a capture stops they all go through the MPBox process if that is set to true, or background, no matter what the size of the video is. If MPBox config is set to false then MPBox is never called and you end up with just the raw .h264 files.

I think you have gap in motion settings set to a few seconds and that dictates the minimum recording after a motion start.

You are seeing MP4Box show up in processing for a bit so it is being called. However, if it fails then the .h264 file is removed anyway. So I suspect that MP4Box is throwing an error for some reason.

I have just tried a fresh update myself and MP4Box is running OK on my system.

There are a couple of things to try.

This may be associated with your use of extra folders in the path. Either that has got broken on the processing side or maybe MP4Box is having a problem accessing the h264 file to convert it. So try reverting to a flat folder (media) in video_path to see if that is working OK on your system. If there is a problem with extra folder then it might be associated with permissions.

The second thought if MP4Box is failing even locally from media is to run it manually from a command line and see what errors it throws up. To do this you first need to get a test .h264 file. You can turn MP4Box false to do this temporarily. Maybe rename it something simple like test.h264. Then run the command

Code: Select all

MP4Box -fps 25 -add /var/www/media/test.h264 /var/www/media/test.mp4

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Sat Mar 28, 2015 9:46 pm

HI Robert,

I finally limited the issue of not converting h264 to MP4 to two PI B+ 256MB. All the other 3 PI B+ 512MB are working fine. Therefore, I swapped these two 256MB model out for two 512MB model; and it works fine.

I would attribute this issue to some possible "not enough memory" cause. I was wondering whether you have some insights from your code that this RPI CAM might dictate minimum 512MB to work fine. FYI, I did have 128MB carved out for PI CAM in both 256MB model and 512MB model.

Hope you can confirm that this might be the issue.
Thanks a lot.

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Sat Mar 28, 2015 10:24 pm

Hi Robert,

I'm the guy who set up the wiki page on http://elinux.org/RPi-Cam-Web-Interface many moons ago, and having wondered back onto this thread to set up a new camera, I'm amazed at the fantastic work that you've done to improve the already excellent RPi Cam Web Interface!

I see that you reference the wiki from your github page, but as someone rediscovering this thread I'm unsure what I need to do to make use of your work, along with understanding all the benefits it brings without trawling though all the posts.

As a result, would you mind summarising your work, how to install/use, etc, on a post that I can then copy into the wiki as the first thing people see please? This would help not only myself but many others who see this popular thread to make the most of your brilliant work! :)

Thanks!!!

piecam
Posts: 84
Joined: Mon Feb 23, 2015 12:55 am

Re: RPi Cam Web Interface

Sun Mar 29, 2015 12:11 am

HI Jarrah31,
On the page 63 of this forum, I have put out a quick write-up I use for myself. Maybe, you can take that as a reference. Robert can help provide more details of his wonderful work so that you can incorporate into your wiki. Hope this helps.
Page 63
by piecam » Tue Mar 24, 2015 12:48 am
Just use this forum to post some of my notes installing RPI CAM with minibian for future reference for myself and others.

some other thoughts (which Robert has put into answers to me before).....
If you can convince ccrisan from this project (https://github.com/ccrisan/motionPie/releases, and ,https://bitbucket.org/ccrisan/motioneye/wiki/Home), to join this and use core part of this week into his MotionEye, that would even be more wonderful. As I feel this project already is a wonder, it would be even wonderful to have a Minibian+RPI CAM+motionEye. or Indepedent distro like his motionePie with this rPI CAM web code.

I have tried a few times trying to get Robert and ccrisan into working out something; but, it seems both have some different focus and they both don't have time in peaking over to each other's work and mix them together. :-(

I know that our wondeful WEB GUI is very functional; however, still feel that motionEye is more fluid and efficient, maybe. :-)

Just some thoughts to ramble and hope Robert and crisan don't mind. They are both great! Will be greater working out a project together!! :-)
I enjoyed MotionPie, its stable, function, resource efficient, fluid interface. Now I have converted 6 pi B+ with Pi CAM to this project, for fast frame rates and high resolutions.

thanks

btidey
Posts: 1632
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sun Mar 29, 2015 11:10 am

jarrah31 wrote:Hi Robert,

I'm the guy who set up the wiki page on http://elinux.org/RPi-Cam-Web-Interface many moons ago, and having wondered back onto this thread to set up a new camera, I'm amazed at the fantastic work that you've done to improve the already excellent RPi Cam Web Interface!

I see that you reference the wiki from your github page, but as someone rediscovering this thread I'm unsure what I need to do to make use of your work, along with understanding all the benefits it brings without trawling though all the posts.

As a result, would you mind summarising your work, how to install/use, etc, on a post that I can then copy into the wiki as the first thing people see please? This would help not only myself but many others who see this popular thread to make the most of your brilliant work! :)

Thanks!!!
The wiki you put together helped me a lot getting going and I appreciate that otherwise it can be tough for people faced with 65 pages plus of material to know how to set things up so it suits them.

Adding in some material to the wiki to cover my modifications sounds good. Below is a summary plus references. If you think more detail is needed then let me know.

Summary

Modifications of original code at https://github.com/roberttidey/RPi_Cam_Web_Interface

This is installed and updated in the same way as the original, just do the initial git clone from this repository.

Code: Select all

git clone https://github.com/roberttidey/RPi_Cam_Web_Interface.git
It extends the functionality in following ways
  • Download Video and Images (preview) page shows thumbnails and capture details. Thumbnail and preview sizes may be customised per browser. Extra buttons allows for selective deletes and zip downloads directly from thumbnails. Time lapse recordings are grouped together into batches. A time lapse batch will download as a zip containing all the captured data.
  • Scheduling page allows automation of capture settings and config split into daily periods based on sunrise and sunset. Enter latitude and longtitude and time zone to set up sunrise/set calculation, then put capture commands and operating mode for four daily periods. Schedule can also automate old capture purging.
  • Motion page gives access to viewing and editing motion detection settings from the browser. Changes are applied immediately with no restarts required.
  • Main page Camera settings shows current values and changes are remembered across stops, starts, reboots. Extra settings added for annotation and MP4Box control.
  • Core software changes include more flexible file naming, subfolder support, v3 annotation, background MP4Boxing, user config support. It finds video and image indexes on start instead of installer script. More tolerant to on-line errors and formatting of commands.
Detailed description and screenshots at https://github.com/roberttidey/RPi_Cam_ ... RPiCam.pdf

Return to “Camera board”