Author |
Message |
tjc
|
Posted: Tue Oct 10, 2006 7:03 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
When you've got a new hammer the world often seems full of nails. 
|
|
Top |
|
 |
mjl
|
Posted: Tue Oct 10, 2006 9:59 pm |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
I like that
Mike
|
|
Top |
|
 |
mjl
|
Posted: Wed Oct 11, 2006 9:23 pm |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi,
After the ideas from the other evening, I decided to follow through with the suggestion from Liv2Cod. Now I have a place to store my hammered nails
Since my drive has already several partitions because I can and do have several versions of KM available. I used one 5 gig partition for this experiment. R5Bx was and is now expired. Here is the road I went, ymmv if you choose also play or build from scratch, maybe resize using ubuntu, etc. Nice part is that by simply deleting everything in that partition, it is still formated and in smaller blocks.
Using a spare partition... that had R5Bx installed
mount /mnt/hda6
rm -rf /mnt/hda6/*
rm -rf /mnt/hda6/.qt
mkdir /mnt/hda6/music
mkdir /mnt/hda6/gallery
mkdir /mnt/hda6/motion
mkdir /myth/store
chown mythtv:mythtv /myth/store
umount /mnt/hda6
nano /etc/fstab
was:
/dev/hda6 /mnt/hda6 ext3 noauto,users,exec 0 0
now:
/dev/hda6 /myth/store ext3 auto,users,exec 0 0
save & exit
mount /myth/store
chown mythtv:mythtv /myth/store/*
ls /myth/store
gallery
motion
music
Now I can save small files more efficently and if motion fills the folder, no
errors to the system  If you plan to store a lot of tunes, go for a partition size ~12 ~15 gig maybe more. I don't have a lot of music but still managed to come up with several gigs.
End result:
/dev/hda5 4.6G 4.1G 268M 95% /
/dev/hda8 79G 65G 14G 83% /myth (inodes 20064)
/dev/hda3 9.2G 3.4G 5.4G 39% /edubuntu
/dev/hda6 4.6G 33M 4.4G 1% /myth/store (inodes 611648)
nano /etc/motion/motion.conf
target_dir /myth/store/motion
R5C7
ln -s /myth/store/motion /myth/gallery
chown mythtv:mythtv /myth/gallery/motion
R5D1
rm /myth/gallery/motion
ln -s /myth/store/motion /myth/gallery
chown mythtv:mythtv /myth/gallery/motion
always run motion as user mythtv
tjc's code, slightly modified (works great, takes awhile:) )
killall motion #stops motion daemon
for i in $(find /myth/store/motion/ -type f -print | sort -r | sed '1,10d') ; do
rm -rf $i
done
motion #restarts motion daemon
Only thing missing is an hourly watchdog to check on motion space remaining to automaticly trigger "housekeeping" tjc?
Be sure to check all the details at http://www.lavrsen.dk/
Hope this may help and not confuse, Enjoy
Mike
Edit 13Oct to fix store / spare terminology error
Last edited by mjl on Thu Oct 12, 2006 5:55 am, edited 1 time in total.
|
|
Top |
|
 |
Liv2Cod
|
Posted: Thu Oct 12, 2006 12:13 am |
|
Joined: Fri May 21, 2004 11:55 pm
Posts: 1206
Location:
Silicon Valley, CA
|
Excellent! You've got it all working, then.
Reading through the steps, I'm guessing that /myth/store/... and /myth/spare/... are the same path? Prolly just a copy-paste thing.
Good work. One of these days I want to set up my camera and get motion going.
Joe
_________________ Do you code to live, or live to code? Search LinHES forum through Google
|
|
Top |
|
 |
mjl
|
Posted: Thu Oct 12, 2006 6:05 am |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi Liv2Cod,
Thanks for the catch, I must have jumped a cog or two going up the hill. Updated that part, Only thing different would be the partition # if one were to duplicate the steps.
As a side note I did all those steps on this machine (08:04:09 up 70 days) as I went along down to where I picked up D1. I am running R5 Cool 7. If you can see pictures in the phone window, you should be able to run motion.
Thanks again and have a great day!
Mike
|
|
Top |
|
 |
vincduran
|
Posted: Thu Oct 19, 2006 12:12 am |
|
Joined: Thu Mar 02, 2006 3:34 pm
Posts: 40
|
Wow. This is great. I had sort of gotten motion to work, played with waving at the camera so far but not much more. With all these updates it can really get useful for me.
Begin Shameless Plug=>
The other thing is I got a cheap used security camera from my brother's online store at www.diysecurityworld.com. I got a black and white version of the little dome camera. He's got lots of good cable options. He made a integrated custom cable with power, video, and the RCA jack I needed, in the length I needed with no problem.
Thanks
_________________ free range geek in boulder, co and mythtv enthusiast
R6.03
|
|
Top |
|
 |
mjl
|
Posted: Thu Oct 19, 2006 6:24 am |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi,
Glad some of the info is useful.
I am still investigating some of the extra features of motion, auto mask, sample rates verse strorage, etc. Learned a new trick yesterday as a matter of fact, When I clicked on the Motion label of the KM home page it fires off java and brings up the camera  I have mine set as localhost currently and have mozilla (apt-get install mozilla) works slick.
Speaking of web pages, your brothers web site is not friendly to mozilla.
If you learn any tricks, share them
Mike
|
|
Top |
|
 |
vincduran
|
Posted: Sat Oct 28, 2006 12:36 am |
|
Joined: Thu Mar 02, 2006 3:34 pm
Posts: 40
|
Hi, my action buttons aren't doing anything. In /var/www/motion/index.html I have Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Motion</title> </head>
<body>
<div style="text-align: center;"><a href="../"><img src="../header.png" alt="" style="border: 0px solid ; width: 50$
<applet code="com.charliemouse.cambozola.Viewer" archive="cambozola.jar" height="300" width="400"> <param name="url" value="http://10.14.80.64:8081"> </applet> <br>
<span style="font-style: italic;"><span style="font-weight: bold;"></span></span><br>
</div> <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> </body> </html>
so far. I click on the buttons and there's no change in ps ax. The EXEC stuff doesn't seem to go. I can start and stop motion from the shell as the mythtv user with no problems. Also, would the advanced version of the cleanup button look like this: Code: <button> <type>Clear Motion</type> <text>Clear Motion Files</text> <action>EXEC killall motion; for i in $(find /myth/motion/ -type f -print | sort -r | sed '1,10d') ; do rm -rf $i; motion </action> </button>
_________________ free range geek in boulder, co and mythtv enthusiast
R6.03
|
|
Top |
|
 |
mjl
|
Posted: Sat Oct 28, 2006 8:07 pm |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi,
If things are not right with motion.config, motion will not run. Make sure it works before you jump up and down saying the scripts or menu doesn't work. Do an alt x for an xterm and follow the colors.
At the mythtv prompt ($) enter the command:
$ motion
then do
$ ps ax
and if motion is running you will see a pid number for a line with motion. If there is not a pid for motion, then it is not running and you need to tweak the file /etc/motion/motion.conf as user root.
For the cleanup,
While you have the xterm open, make a script using tjc's excellant simple little piece of code. Copy and paste the green into your new file, ctl x y and enter to exit and save.
Just be sure you change the path of where your files are stored as set up in the motion.config.
$ nano motion-cleanup
#<code> #!/bin/sh # #Thanks to tjc for the code  killall motion #stops motion daemon for i in $(find /myth/store/motion/ -type f -print | sort -r | sed '1,10d') ; do rm -rf $i done motion #restarts motion daemon #<end code>
Not sure what your buttons in the html will do, most likely nothing... as you indicated.
while you have the xterm open, run nano again and make a new motion.xml
$ nano .mythtv/motion.xml
<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 - Restart Motion</text> <action>EXEC sh /home/mythtv/motion-cleanup </action> </button>
</mythmenu>
Nothing more, nothing less and after you restart the frontend your new xml file should the one used by the system. Any menu xml file that is located in the .mythtv folder will be the one used. It is also preserved with a backup..
I think I flogged that area fairly well however if there is anything I may be able to add ask away.
A couple of little tid-bits that I have not chased is
IF you have a tuner card, ie x50 you will have to put in a patch to use the mpg stream.
IF you have a tuner card, and plug in a usb cam, the camera will not be /dev/video0, but /dev/video1
IF you have a usb cam plugged in and reboot, it WILL be /dev/video0 which means that IF you had a working tuner card, it will not work now as it will be /dev/video1 ?
I don't know how to lock some of those settings so at least now you have an idea of what happens.
The box I was learning on is currently doing what motion is suppose to do, watch for motion as we had some kids starting their pranks early. So far I have caught 2 rabbits and several moths. I am using a simple single old bttv tv card, and you don't even set it up as it defaults to /dev/video0.
Mike
Last edited by mjl on Sat Feb 24, 2007 8:22 pm, edited 1 time in total.
|
|
Top |
|
 |
siasl
|
Posted: Thu Nov 16, 2006 8:20 am |
|
Joined: Sun Nov 14, 2004 2:39 pm
Posts: 113
|
[quote="gr8nash"]any good info on what USB cameras work in linux? or at least what your camera is?[/quote]
Just got motion working with a Logitech Webcam Pro 4000 usb camera. Works quiet well. Main issue is activating the thing when you plug it in. It activates in the non capture state on default.
To find which card your system assigned the webcam to :
[code]arecord -l[/code]
To Activate webcam for capture :
[code]amixer -c <your card number> sset Mic Capture <1-3> cap[/code]
Works great.
|
|
Top |
|
 |
siasl
|
Posted: Thu Nov 16, 2006 9:07 am |
|
Joined: Sun Nov 14, 2004 2:39 pm
Posts: 113
|
gr8nash wrote: any good info on what USB cameras work in linux? or at least what your camera is?
Just got motion working with a Logitech Webcam Pro 4000 usb camera. Works quiet well. Main issue is activating the thing when you plug it in. It activates in the non capture state on default.
To find which card your system assigned the webcam to :
Code: arecord -l To Activate webcam for capture : Code: amixer -c <your card number> sset Mic Capture <1-3> cap
Works great.
|
|
Top |
|
 |
scanman717
|
Posted: Tue Feb 13, 2007 9:35 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
Hey mjl.. I have been having an issue with motion. Here is the thread I started, was wondering if you had any thoughts...
http://mysettopbox.tv/phpBB2/viewtopic. ... ght=motion
Can you post what you have for the .jpg and .mpeg file names. No matter what I do, the mpeg files go to the root of the working directory /myth/motion.
I am able to put the .jpg files wherever (I currently put them in /YYYY/MM/DD). just the mpeg files that are giving me fits.
Thanks
_________________ Knoppmyth R5F27
|
|
Top |
|
 |
mjl
|
Posted: Sat Feb 24, 2007 8:25 pm |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi,
Just noticed an error in my previous post for the motion xml, <text>Clear & Restart Motion</text> The & is a bad thing and may cause the script to abort the frontend  Sorry about the typo however the script is now corrected.
Thanks
Mike
|
|
Top |
|
 |
mjl
|
Posted: Wed Jul 09, 2008 8:43 pm |
|
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location:
Warwick, RI
|
Hi,
Has been a day or two since we were here however with R5.5 I am seeing issues with motion that is new. I use motion to help me keep an eye on the kids when they are in the pool so was a bit let down when it went into never never land.
What seems to occur for me is that the when I start motion, it appears to begin ok then just sort of hangs and hangs..........zzzzzzzzz After doing some digging around some forums I think the answer is on the ZoneMinder site. It seems that part of the v4l has been "depreciated" and is no longer a part of the newer kernels. It is the part that works with the bttv chips and causes the call to the driver to go into an endless sleep. If you kill -9 the pid, motion goes defunct until you reboot (actually have to reset sometimes)
And now our new R5.5 comes preloaded with ZoneMinder. It even has a setup menu selection so I would say that is pretty serious stuff. It isn't set to run at boot time as I would suspect only a few will be using it. It isn't quite ready to just start and run anyway, however I will post what I found that gives me access to it. I just am not sure where I found the needed pieces, I think it was on the Ubuntu site.
Shortened story, I was not able to get ZoneMinder to give me pictures either and that was why I ended up on the ZM site digging for hints. At this point it is out of my reach for the magic tweak to bring it to life.
Just figured that since I started this thread, I may as well add an update to what I see.
Thanks
Mike
nano -w zoneminder-setup.sh
Code: #!/bin/sh #tweaks for zoneminder # #http://www.howtoforge.com/video_surveillance_zoneminder_ubuntu adduser www-data video ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf /etc/init.d/apache2 force-reload /etc/init.d/zoneminder start echo "ZoneMinder should be launchable http://localhost:port/zm" echo "It will not be restarted on a reboot"
It will not be restarted on boot / reboot
edit to fix typo 
Last edited by mjl on Thu Jul 24, 2008 7:52 pm, edited 1 time in total.
|
|
Top |
|
 |
mrjackson
|
Posted: Thu Jul 24, 2008 6:33 pm |
|
Joined: Thu Mar 15, 2007 9:26 pm
Posts: 39
|
I just found a typo in that script, could possibly be why it's not working for you.
/etc/init.d/zoneminder start
I'm going to work on getting mine working and will post here what i come up with.
|
|
Top |
|
 |