LinHES Forums http://forums.linhes.org/ |
|
Motion, basicly working http://forums.linhes.org/viewtopic.php?f=6&t=11832 |
Page 1 of 3 |
Author: | mjl [ Mon Sep 25, 2006 9:51 pm ] |
Post subject: | Motion, basicly working |
Hi, A little motavation got me going down the path... a friend had a laptop ripped out of his car right in front of his house. Sort rural area too. Anyway, long story trimed a little, myth and motion came up in conversation very quickly. Here is the rest of the story: Funny how we can look at something and not see... a lot of answers are right on the KnoppMyth index page... disguised as Motion: ls -al /myth/gallery #these were root chown mythtv:mythtv /myth/gallery/motion lrwxrwxrwx 1 mythtv mythtv 12 Sep 15 00:50 motion -> /myth/motion Note: You may have to create this file first, but check the edit notes for ideas. mkdir /myth/motion chown mythtv:mythtv /myth/motion drwxr-xr-x 3 mythtv mythtv 4096 Sep 25 22:55 motion ls -al /myth/video #this was ok drwxrwxr-x 2 mythtv mythtv 4096 Sep 14 22:30 motion rm -rf /myth/motion/* #(cleaned out test stuff) nano /etc/motion/motion.conf videodevice /dev/video0 #(changed to my bttv video input) framerate 1 #(slowed things down a bit) no change needed quality 70 #(reduced quality a little) no change needed webcam_maxrate 1 #(slowed things down a bit) no change needed nano /var/www/motion/index.html #changed from 192.168.1.253 to localhost <param name="url" value="http://localhost:8081"> Assuming you have mozilla loaded, it is safe to apt-get the browser. /etc/init.d/motion restart Recommend not starting motion with this method. Start application as user mythtv by entering $motion Then mythtv owns the images. mythtv user may also then stop the application with $ killall motion Opening mozilla on the local box http://localhost:8081/ and waa laa, there were images ![]() Remaing issue: start - stop from the menu. motion.xml don't work. sh /usr/local/bin/start_motion.sh #No such file or directory sh /usr/local/bin/stop_motion.sh #No such file or directory don't exist, at least in R5 Cool 7 The "small adjustments" would allow out of the box motion but would need to be understood that if motion is running that it may disable the tuner? I don't have tuner working so can't disprove the statement. (unless there were two tuners?) At this point in time, the images appear in the gallery, videos needed a rescan to appear but don't play as that probably requires a setup for the avi.. Later project. Don't know how to run init q either... but that's a different problem for me to enable / disable the modem dial in with mgetty. A few finishing touches and this may be usable to folks? Thanks for listening ![]() Mike Edited once:9/26/ 14:00 The /myth/motion directory doesn't exist in D1 however the /myth/gallery/motion link does - wrong owner, root This may have been caused by manual upgrades which didn't have /myth/motion directory. Mike Second edit:9/26 23:30 The A30.2 & A26 have motion in the menu however the bin is dry, only a /myth/video/motion directory shows up. Also they all refer to /usr/local/bin/start / stop _motion.sh which doesn't exist anywhere. Found the .avi are only black when played back, however the .jpg files are good. Could be my old bttv card. Mike Third edit:10/1 ~16:50 Using D11, only items that needed tweaking are those in red if using a Conexant based chip. KWorld, ATI, Osprey all worked and you don't even need to set up the bttv driver for watching tv. Slowing down the samples probably caused my dark avi files. Mike Edit 4 10/2 ~21:30 I am only using a small 13 gig drive and found that motion makes hundreds of little files. The inodes quickly disappear. I made a directory /home/motion and setup as if /myth/motion There is an edit needed in motion.conf to change to new point of storage. Also removed link from /myth/gallery/motion and recreated to the new area. Works just as well and have inodes to spare ![]() Mike |
Author: | mjl [ Mon Oct 02, 2006 7:11 am ] |
Post subject: | |
Hi, Replying to my own post is a little like talking to myself ![]() <mythmenu name="MOTION"> <button> <type>Start Motion</type> <text>Start Motion</text> <action>EXEC motion</action> </button> <button> <type>Stop Motion</type> <text>Stop Motion</text> <action>EXEC killall motion</action> </button> </mythmenu> If you start it /etc/init.d/motion start then it runs as a root item and all the recordings are owned by root. Doing it through the menu or command line motion then the recordings are owned by mythtv and show up in the /myth/gallery very cool I think. Also the .avi files play in while in the gallery, like a moving slide. Very nice, would be easy to have working "out of the box" ![]() <button> <type>Clear Motion</type> <text>Clear-Reset Motion Files</text> <action>EXEC killall motion; rm -rf /myth/motion/* ;motion</action> </button> Hope this is of value, all have a great day. mike Edit once 10/2 11:48 Found just clearing the files wasn't best as it did not recrete the .avi. the stop, clear, restart seems to work nicely. Mike Edit twice 10/2 14:30 Put the label in wrong place, notice the blue entry now. Mike |
Author: | gr8nash [ Mon Oct 02, 2006 10:07 am ] |
Post subject: | |
any good info on what USB cameras work in linux? or at least what your camera is? |
Author: | mjl [ Mon Oct 02, 2006 11:52 am ] |
Post subject: | |
Hi gr8nash , Have not gotten to usb stuff yet (I'm a slow learner ![]() A quick safe guess to test if it will work is to go into the web phone and if you see live pictures, then motion should also work. They both like /dev/video0 There are a lot of combinations that I haven't and /or can't try but will keep adding to the notes as I find things. There are dozens of tweaks that can be added to the motion.conf so it is a worth while visit to the authors site. Depending on when my kids go to bed tonight, I may try the usb also. The author did mention usb cameras and there were a certain type that should be good to go. I am planning to test the usb on my laptop. Motion only seems to be available in C7 and later for sure. Don't know about B7 as I was to lazy to install it to check ... but it was not in the A series. Maybe that was why we didn't hear much about it? Will let you know what I discover. Mike |
Author: | khrusher [ Mon Oct 02, 2006 1:56 pm ] |
Post subject: | |
A coupleyears ago I had a white ball shaped logitec camera running with motion on my KM box |
Author: | mjl [ Tue Oct 03, 2006 9:14 pm ] |
Post subject: | |
Hi gr8nash, Since I had wanted to play on my laptop and your question was just the prod needed, I went to the source. http://lavrsen.dk where he has answers to most everything related to motion. I mean the guy wrote not only the code but the book to use it also ![]() If you have a usb camera connect it up and then go to alt s add a vl4 device and see if you have the option of usb. If so you should be good to go (may have to tweak motion.conf height & width to match camera) While you are there in setup I added a channel for Video on channel freq of 1 (I always do any way) and then match that in step 4 to connections. I was able to set mine for 320x240@15fps & 640x480@15 with no trouble. If motion isn't running you should be able to see an image in phone and also as tv channel 1. I have mine set as default to channel 1. My camera is a Logitech Sphere but I haven't gotten the motion to function yet. Maybe too much time here on the forum... Definetly want to use a diferent partition the hold the images as the files are quite small but each one uses an inode and those may be needed for your media. I made my storage /home/motion , changed the pointer in the motion.conf and modified the button setting to match. <action>EXEC killall motion; rm -rf /home/motion/* ;motion</action> Have to rm and relink the the new location also then the images show up in the gallery. Mike |
Author: | mjl [ Wed Oct 04, 2006 6:47 am ] |
Post subject: | |
Hi, Just a word of warning, it is quite easy to fill the available storage space very quickly. Also there is a limit as to how many enteries that the rm -rf /myth/motion/* can delete. If you fill the storage space and need to manually delete them, may have to do a group at a time to get the space back. Keep the image sizes small helps and watch the folder size as there doesn'r seem to be any automatic limit. Mike |
Author: | mjl [ Mon Oct 09, 2006 9:00 pm ] |
Post subject: | |
Hi, Seems there are not very many interested in motion ![]() The big problem is what to do with the files created by motion as depending on the settings can be a lot of ~20 to 100k jpg's. When I say a lot, I am referring to several hundred real quick plus those jpg's are married into two avi files. Originally, the directories are in /myth/motion which is not an ideal location as the /myth partition is formated with the plan of large nuv / mpg files of several hundred megabytes of video. Typical of 2200 meg per hour with the default settings. Because of the format plan, there are a limited number of inodes and very quickly the 90gig will change to be 0 free. Been there - done it. Alternative is to place the motion folder into the root partition but that is dangerous to the system health as now you have a lot of inodes for the small files, however usually the partition is quite small, ~5 gig or less and after a day or two depending on how much motion is captured, you may have a full root partition. That isn't nice. Been there - done it. That causes another issue and maybe tjc will volunteer his marvelous script skills for a solution ![]() What is needed is a script that IF motion is running to ensure the total file count does not exceed (x) and if so automaticlly remove the oldest jpg's. The avi's could be retained. One could have the script automaticly turn off motion, however if one were to have it run because of Halloween tricksters, you would not want it turned off. Also another sort of solution is to add an addition 10~12 gig partion and use it for special storage of gallery images, music, & motion. Maybe reformat and re-purpose the ol' cache partition? Now if that extra partition were to fill up no harm would occur except one would not be able to save anything additional but the main KnoppMyth system would function normally. Again placing gallery and music in there because of the small file sizes and inode limitation of /myth. Personnally I am going for this "storage" partition because I don't have the script skills to protect the root partition. Any ideas or comments? Mike |
Author: | Liv2Cod [ Mon Oct 09, 2006 9:10 pm ] |
Post subject: | |
Why not just make another filesystem and mount it under /myth/motion? You can set it up with however many inodes you want. I'm thinking of doing something like this to /myth/tv and /myth/video to put those onto separate huge hard disks (like 750's). Then leave the rest of /myth on the boot drive with a pretty high inode count for the music files, pretty links, and other stuff. I really like the idea of motion and want to see you succeed with it. (Sorry about the sig -- bbcode is off for some reason!) |
Author: | mjl [ Mon Oct 09, 2006 9:37 pm ] |
Post subject: | |
Hi Liv2Cod, Motion works very well in R5C & R5D ![]() Currently, one could build a KM Motion machine in a very short time just to keep a security watch on the outhouse in time for Halloween. The old bttv tv, osprey, some usb cameras work almost as plug & play. I believe the Logitech Orbit will auto track also. [quote]another filesystem[/quote] I think you are referring to the "storage" partition I mentioned previously? Just fstab it as /dev/xdax /myth/motion ext3 auto,users,exec 0 0 ? Thanks for the ideas! Ya, things do look pretty bland without the bbcode... but at least we can still ![]() Mike |
Author: | tjc [ Mon Oct 09, 2006 9:39 pm ] |
Post subject: | |
mjl wrote: That causes another issue and maybe tjc will volunteer his marvelous script skills for a solution
![]() Use a for loop. Code: for i in /home/motion/* ; do rm -rf $i ; done If the files are named so that they sort nicely you can truncate the list before looping over it, and leave the latest 10 or whatever. Code: for i in $(find /home/motion/ -type f -print | sort -r | sed '1,10d') ; do
rm -rf $i done Note that the second loop above assumes a flat directory structure and files named so that they normally sort from oldest to newest. YMMV. Edited to correct the for loops and enable markup. |
Author: | mjl [ Mon Oct 09, 2006 10:08 pm ] |
Post subject: | |
Thanks tjc, Gentleman and a scholar also:) I shall have to do some playing as I intend to retain the avi's and just do away with the .jpg's that are over x hours old or down to a minimum count. I have already added a button to my Motion menu that allows me to clear the entire directory and the start / restart motion fresh, (if not hitting the aurgument limit). Handy if one was going away for the weekend and wanted to "keep an eye" on things. [color=green]<mythmenu name="MOTION"> <button> <type>Start Motion</type> <text>Start Motion</text> <action>EXEC motion</action> </button> <button> <type>Stop Motion</type> <text>Stop Motion</text> <action>EXEC killall motion</action> </button> <button> <type>Clear Motion</type> <text>Clear Motion Files</text> <action>EXEC killall motion; rm -rf /home/motion/*; motion </action> </button> </mythmenu> [/color] Thanks! Mike |
Author: | mjl [ Mon Oct 09, 2006 11:21 pm ] |
Post subject: | |
tjc, syntax error for both ![]() ![]() Mike |
Author: | tjc [ Tue Oct 10, 2006 6:14 pm ] |
Post subject: | |
I forgot the index variable "i". The first one should read: [code]for i in /home/motion/* ; do rm -rf $i ; done[/code] Sigh... ![]() |
Author: | mjl [ Tue Oct 10, 2006 6:33 pm ] |
Post subject: | |
Hi tjc, I was wondering where the $i had come from. This is beginning to look more and more like the ol' basic of days past. I think I might have figured out that missing variable, however thank you! Interestingly, I just return from our pta meeting and this is the first time in years that we have had acts of vandalism in the play ground. If we can get a camera from somewhere, this would an ideal task for KM & Motion to help set some teens on a different path. Funny how things in life flow around us. Mike |
Page 1 of 3 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |