Newbee - Karrigell Webcam and motion

57 views
Skip to first unread message

bruno

unread,
Oct 3, 2013, 1:48:22 PM10/3/13
to karr...@googlegroups.com
Karrigell 2.4  Python 2.7 Ubuntu 12.4

Karrigell port :  8088
Motion port : 9999

Hello,

I want to control one webcam with Motion and Karrigell to do a security webcam that I can connect from my local and from Internet. i did a test with Motion alone and all works fine : the port of the camera is 9999 and when I start motion  I can go in browser at http//IP_serveur_motion:9999 and I have the stream of my camera. It is the same thing coming from Internet with a compte No-Ip. It works fine.

After I did a little index.ks with Karrigell like this

def index():
    print '<form action = "allumer_cam"><input type="submit" value="Voir la caméra">'
    print '</form>'

def allumer_cam():
    import subprocess
    subprocess.call('motion')

When I start this little .ks karrigell ( with the port 8088 ) gives my button and when I click on it my camera works (the light is switched on) and I see in my console the files .jpg and swf that are created in tmp/motion so then the motion and the camera work.
But if I want to see the streaming of my camera with the same adress http//IP_serveur_motion:9999 karrigell can't gives me the streaming ("connexion failed ...

If somebody can gives me some explanation about this and my bad manipulations it will be great because now I am quite lost.

Thanks a lot,
Bruno


Pinault Nicolas

unread,
Oct 3, 2013, 4:55:17 PM10/3/13
to karr...@googlegroups.com
Bonsoir Bruno,

Le 03/10/2013 19:48, bruno a �crit :
> Karrigell 2.4 Python 2.7 Ubuntu 12.4
>
> Karrigell port : 8088
> Motion port : 9999
>
> Hello,
>
> I want to control one webcam with Motion and Karrigell to do a
> security webcam that I can connect from my local and from Internet. i
> did a test with Motion alone and all works fine : the port of the
> camera is 9999 and when I start motion I can go in browser at
> http//IP_serveur_motion:9999 and I have the stream of my camera. It is
> the same thing coming from Internet with a compte No-Ip. It works fine.
>
> After I did a little index.ks with Karrigell like this
>
> def index():
> print '<form action = "allumer_cam"><input type="submit"
> value="Voir la cam�ra">'
> print '</form>'
>
> def allumer_cam():
> import subprocess
> subprocess.call('motion')
>
> When I start this little .ks karrigell ( with the port 8088 ) gives my
> button and when I click on it my camera works (the light is switched
> on) and I see in my console the files .jpg and swf that are created in
> tmp/motion so then the motion and the camera work.
> But if I want to see the streaming of my camera with the same adress
> http//IP_serveur_motion:9999 karrigell can't gives me the streaming
> ("connexion failed ...
>
> If somebody can gives me some explanation about this and my bad
> manipulations it will be great because now I am quite lost.
>
I'll try to help you.
First, I think your problem is not Karrigell related.
The description of your set-up is not very clear for me.

1) You use Motion to get the webcam running and to grab pictures in a
local folder. That's clear.
2) You use a web interface to watch the camera pictures. Which program
do you run for this ? Motion ?
3) In the function "allumer_cam", you use subprocess.call() to launch
Motion. This is not good because subprocess.call() returns when the
callee (motion) ends. This means that when you click "Voir la cam�ra",
your Karrigell application is stuck till Motion ends. You have to use
subprocess.Popen() instead.
4) Are you sure Motion is still alive when you try to watch pictures ?
Pictures in /tmp/motion does not mean Motion is currently running.
5) Launching an application from another one can be difficult because
environment variables can be different between a shell launch and an
application launch. This can make the launched application crash. This
can also make the launched application not find the right configuration
files.
6) How do you launch Motion from the shell ?

Cordialement,
Nicolas

bruno

unread,
Oct 3, 2013, 6:35:46 PM10/3/13
to karr...@googlegroups.com
Bonsoir Nicolas,

Merci pour te réponse rapide et content de faire ta connaissance. Je pense que mon petit test est en effet un peu flou et de plus je ne connais pas trop le web, les flux vidéos etc... Merci de ta patience
Je réponds maintenant en anglais (malheureusement !).

In fact I have an RaspberryPi and I wanted to some test with it and for example to do something simple in "domotic", see my webcam from internet or to have some pictures of wild animals , weasel etc...


2) You use a web interface to watch the camera pictures. Which program
do you run for this ? Motion ?

If fact  I have thought first :  to read the streaming with Firefox with the IP of my motion server and it port  and if it was working en second, create an html's page with <embed> src ="http://ip:9999" </embed>. I don't know if it is possible; I am looking after. My response is good ?



3) In the function "allumer_cam", you use subprocess.call() to launch
Motion. This is not good because subprocess.call() returns when the
callee (motion) ends. This means that when you click "Voir la cam�ra",
your Karrigell application is stuck till Motion ends. You have to use
subprocess.Popen() instead.

I am going to change my coding. Thanks.
Question : it is after subprocess.Popen() that I make the HTML's page with <embed></embed>  ??


4) Are you sure Motion is still alive when you try to watch pictures ?
Pictures in /tmp/motion does not mean Motion is currently running.

When I push the button, (I have configured Motion to enregistrate regularly the images) in my terminal I see the images's files to be enregistred in the repertory of destination. 


6) How do you launch Motion from the shell ?
I see I have make some error maybe: when I launch Motion I must write "sudo motion" to have all the rights. But in my python I code subprocess.Popen(' motion') without sudo. It can't works  I think. I am going to see how to give sudo in the parameters.

I hope I have well explain, good luck to understand my english Nicolas. I am going to look after  "subprocess.Popen" and its parameters.

Cheers,
Bruno

bruno

unread,
Oct 4, 2013, 9:02:10 AM10/4/13
to karr...@googlegroups.com
Hi,
I answer to me :

I did some tests and I think I must launch the motion's server first alone and after, I launch  Karrigell. in this way, I can, with a button in a page in my Karrigell's site,  to link to an html's page  with the adress "http//: IpOfMyMotionServer:Port_of_webcam". With this way all works fine. I see the streaming of my webcamera.
I think that I can't launch the Karrigell'server and in the process of karrigell, launch an another server, the Motion's server. I did many tests. They are not good.

If somebody know something about this ... I am ready to listen his helps

Thanks for your help,


Cheers,
Bruno
 

Le jeudi 3 octobre 2013 19:48:22 UTC+2, bruno a écrit :

Pinault Nicolas

unread,
Oct 6, 2013, 2:59:15 PM10/6/13
to karr...@googlegroups.com
Bonsoir Bruno,


Le 04/10/2013 15:02, bruno a écrit :
Hi,
I answer to me :

I did some tests and I think I must launch the motion's server first alone and after, I launch  Karrigell. in this way, I can, with a button in a page in my Karrigell's site,  to link to an html's page  with the adress "http//: IpOfMyMotionServer:Port_of_webcam". With this way all works fine. I see the streaming of my webcamera.
I think that I can't launch the Karrigell'server and in the process of karrigell, launch an another server, the Motion's server. I did many tests. They are not good.

If somebody know something about this ... I am ready to listen his helps
I think you are missing some Linux knowledge.
You're problem is not Karrigell related. You say you have to launch Motion with sudo. I guess you launch Karrigell without sudo so, when Karrigell launches Motion, Karrigell don't have the privileges of sudo and Motion does not work full functional.  Try to launch Karrigell with sudo.
I have a question : why do you want to start Motion from Karrigell ?

Regards,
Nicolas

Thanks for your help,

Cheers,
Bruno
 

Le jeudi 3 octobre 2013 19:48:22 UTC+2, bruno a écrit :
Karrigell 2.4  Python 2.7 Ubuntu 12.4

Karrigell port :  8088
Motion port : 9999

Hello,

I want to control one webcam with Motion and Karrigell to do a security webcam that I can connect from my local and from Internet. i did a test with Motion alone and all works fine : the port of the camera is 9999 and when I start motion  I can go in browser at http//IP_serveur_motion:9999 and I have the stream of my camera. It is the same thing coming from Internet with a compte No-Ip. It works fine.

After I did a little index.ks with Karrigell like this

def index():
    print '<form action = "allumer_cam"><input type="submit" value="Voir la caméra">'
    print '</form>'

def allumer_cam():
    import subprocess
    subprocess.call('motion')

When I start this little .ks karrigell ( with the port 8088 ) gives my button and when I click on it my camera works (the light is switched on) and I see in my console the files .jpg and swf that are created in tmp/motion so then the motion and the camera work.
But if I want to see the streaming of my camera with the same adress http//IP_serveur_motion:9999 karrigell can't gives me the streaming ("connexion failed ...

If somebody can gives me some explanation about this and my bad manipulations it will be great because now I am quite lost.

Thanks a lot,
Bruno


--
You received this message because you are subscribed to the Google Groups "karrigell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karrigell+...@googlegroups.com.
To post to this group, send email to karr...@googlegroups.com.
Visit this group at http://groups.google.com/group/karrigell.
For more options, visit https://groups.google.com/groups/opt_out.

bruno gallart

unread,
Oct 7, 2013, 10:13:52 AM10/7/13
to karr...@googlegroups.com
Le 06/10/2013 20:59, Pinault Nicolas a écrit :
Bonsoir Bruno,

I think you are missing some Linux knowledge.

Sure, i am agree, I miss many things,

You're problem is not Karrigell related. You say you have to launch Motion with sudo. I guess you launch Karrigell without sudo so, when Karrigell launches Motion, Karrigell don't have the privileges of sudo and Motion does not work full functional.  Try to launch Karrigell with sudo.
In fact it is a mistake to launch Motion in Karrigell. I am quite stupid. I launch Motion now out of Karrigell


I have a question : why do you want to start Motion from Karrigell ?
it was a mistake. in fact i help one cousin who is a small farmer with cows and sheeps. But his sheepfold and barn are at 300 meters from his house and he wants keep a close eye on his animals (ex: give birth...) . it is too far to make a network but he has a little office in his installation with a box adsl (with a little computer) . I have thought to do a little site (that is on the little computer) to be connected from his house with internet. We did some tests with on webcam and it works but he does not want to do manipulations like write "http://name of his site: port of motion", he prefers (because he is not interessed by informatic) to have some button to see the streaming of his camera(s). After the installation of the camera he would like to do some "domotique" installation for his sheepfold/barn. He is going to see if this professionnal "domotique" could be controlled by web.  That's the reason of all this tests maybe idiotic with motion/Karrigell.I try to be one help for my cousin that have not the life easy.

I hope to have been clear ???

Cordialement,

Bruno

Reply all
Reply to author
Forward
0 new messages