Won't stream video

Forum for questions and support relating to the 1.24.x releases only.
orsty3001
Posts: 49
Joined: Tue Jan 26, 2010 5:55 pm

Post by orsty3001 »

Paranoid wrote:
orsty3001 wrote:
Paranoid wrote:I am only guessing because I'm not that familiar with the code but...

It looks to be failing in the LocalCamera::PrimeCapture function and it appears that one of things it sets in this is the format. Try changing the device format. If its currently set to PAL try NTSC and vice versa. If it still doesn't work try all the other formats as well.
I tried that, only the ntsc ones work, the rest of them make the monitor's source link go red.

Zoneminder is recording video using NTSC it's just not streaming it.
Sorry, I was replying to stimburg's post with that suggestion.

If its recording then the problem might be with your browser. Have you tried a different browser? If you are using IE have you enabled (and downloaded) java?
Sorry, thought it was directed at me.

Yeah I tried it with chrome firefox and IE. I get the same error in the error log.

array (\n 0 => \n array (\n 'file' => '/home/web/<mysite>/zm/ajax/stream.php',\n 'line' => 55,\n 'function' => 'ajaxError',\n 'args' => \n array (\n 0 => 'socket_sendto( /tmp/zms-765499s.sock ) failed: No such file or directory',\n ),\n ),\n 1 => \n array (\n 'file' => '/home/web/<mysite>/zm/index.php',\n 'line' => 116,\n 'args' => \n array (\n 0 => '/home/web/<mysite>/zm/ajax/stream.php',\n ),\n 'function' => 'require_once',\n ),\n),

It's not creating that zms-*s.sock file.
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

Paranoid wrote:I am only guessing because I'm not that familiar with the code but...

It looks to be failing in the LocalCamera::PrimeCapture function and it appears that one of things it sets in this is the format. Try changing the device format. If its currently set to PAL try NTSC and vice versa. If it still doesn't work try all the other formats as well.
I messed around with those settings just now and it did stop that error message.

Still doesn't stream live video though.
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

Try these settings.

options->images->CAN_STREAM set to auto
options->images->STREAM_METHOD set to jpeg
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

It was already set to auto and just set it to stream jpegs.

Image

That's what it's doing now and I'm still getting this error in apache's error log.

[Tue Feb 02 16:29:04 2010] [error] [client 192.168.1.240] array (\n 0 => \n array (\n 'file' => '/var/www/htdocs/zm/ajax/stream.php',\n 'line' => 55,\n 'function' => 'ajaxError',\n 'args' => \n array (\n 0 => 'socket_sendto( /tmp/zms-691164s.sock ) failed: No such file or directory',\n ),\n ),\n 1 => \n array (\n 'file' => '/var/www/htdocs/zm/index.php',\n 'line' => 116,\n 'args' => \n array (\n 0 => '/var/www/htdocs/zm/ajax/stream.php',\n ),\n 'function' => 'require_once',\n ),\n), referer: http://192.168.1.1/zm/?view=watch&mid=8
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

stimburg, I'm running out of ideas.

Disable OPT_USE_AUTH in options->system and restart zm. Then try these URLs and let me know what errors you get in the apache and zm log files and what you see

http://192.168.1.1/cgi-bin/nph-zms?mode=jpeg&monitor=8
http://192.168.1.1/cgi-bin/zms?mode=jpeg&monitor=8
http://192.168.1.1/cgi-bin/zm/nph-zms?m ... &monitor=8
http://192.168.1.1/cgi-bin/zm/zms?mode=jpeg&monitor=8
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

It tries to download the zms and nph-zms file instead of parsing it.
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

It looks like apache isn't configured properly. You should have somewhere in your apache config files lines like the following:

Code: Select all

ScriptAlias /cgi-bin/ "Path-To-Your-cgi-bin"

<Directory>
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
</Directory>
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

Paranoid wrote:It looks like apache isn't configured properly. You should have somewhere in your apache config files lines like the following:

Code: Select all

ScriptAlias /cgi-bin/ "Path-To-Your-cgi-bin"

<Directory>
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
</Directory>
Damn. it got parsed incorrectly

Code: Select all

ScriptAlias /cgi-bin/ "Path-To-Your-cgi-bin"

<Directory "Path-To-Your-cgi-bin"> 
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
</Directory>
Its still getting parsed incorrectly but hopefully you can work out what I mean.
< = less than sign
> = greater than sign
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

Paranoid wrote:
Paranoid wrote:It looks like apache isn't configured properly. You should have somewhere in your apache config files lines like the following:

Code: Select all

ScriptAlias /cgi-bin/ "Path-To-Your-cgi-bin"

<Directory>
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
</Directory>
Damn. it got parsed incorrectly

Code: Select all

ScriptAlias /cgi-bin/ "Path-To-Your-cgi-bin"

<Directory "Path-To-Your-cgi-bin"> 
        AllowOverride None
        Options +ExecCGI -Includes
        Order allow,deny
        Allow from all
</Directory>
Its still getting parsed incorrectly but hopefully you can work out what I mean.
< = less than sign
> = greater than sign

The only thing that was missing was the -Includes line. I added it and it's still trying to download that file in firefox and just dumps it's guts in IE. It is aliased to where the zms and nph-zms are located. This is what I have.

Code: Select all


Directory /var/www/htdocs/cgi-bin/ 
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
/Directory


I also tried changing it to "/var/www/cgi-bin/" in the config file and copying zms and nph-zms to that directory. Apache doesn't complain when I restart it, but it still tries to download the zms file.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

You need to fix your apache config.
Find the config that handles your script alias, which would be either http.conf or default.conf most likely (distro dependant)

Find the location of where zms has been installed and make sure if you installed from a package to read the README and make sure that you were not supposed to link the file (diff distros/packagers do things well differently). It may also be possible that there is an added config for apache (ie. zoneminder.conf in http.d directory) that is meant to configure the zoneminder directories in apache.

zms should be somewhere under the aliased script directory as defined in your web server.

Code: Select all

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory>
		AllowOverride None
		Options +ExecCGI +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

So in the above code, zms should be available under /usr/lib/cgi-bin where it is referenced twice, once under ScriptAlias and once for the directory. Whether the script is there or a symlink to it (so long as you use the options directive to followsymlinks).

Check your apache logs for errors, Since apache runs zms, any errors for the cgi will be there as well.
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

Added +SymLinksIfOwnerMatch with no luck. Just to test to see if a cgi could be parsed by my webserver I created a test.cgi and placed it in the same directory as the zms file. It's a simple cgi script set up to print hello world and works fine in the browser. The web server parsed it with no problems.

When trying to access the zms file directly there is no error produced.

I noticed this line

Code: Select all


AddHandler cgi-script .cgi .pl

I'm thinking maybe Apache on my system needs something added to this to know to parse the zms file but there's no file extension on the zms file so not sure what to do.

I might be barking up the wrong tree also.
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

The AddHandler directive tells apache to treat files ending in .cgi or .pl as cgi scripts.

I have managed to recreate exactly the same error message on my system by removing the cgi-bin definition from apache so I believe that this is your problem.

First of all we need to find out where zm thinks your cgi-bin is so look in the apache log files for an entry with "GET ????/cgi-bin/nph-zms??????". and paste the entry here.

Next we need to know if apache is actually reading the file with the cgi-bin definition in so do the following:

1. stop apache
2. Do "ls -lu filename" where filename is name of the file containing the cgi-bin definition and note the date and time stamp for the file.
3. Wait 2 minutes
4. Start apache
5. Do "ls -lu filename" and make sure the date and timestamp on the file is the current date and time.

Oh, and make sure the execute bit is set on the file permissions for zms and nph-zms
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

Time stamp didn't change,

Code: Select all


-rw-rw-rw- 1 apache apache 1739398 2010-02-02 18:08 zms

This is what the access log says.

Code: Select all


192.168.1.240 - - [02/Feb/2010:20:45:10 -0500] "GET /zm/cgi-bin/zms?mode=jpeg&monitor=8 HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"


I did a chmod a-x on it yesterday thinking that it might need to be set to executable.
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

stimburg wrote:Time stamp didn't change,

Code: Select all


-rw-rw-rw- 1 apache apache 1739398 2010-02-02 18:08 zms

This is what the access log says.

Code: Select all


192.168.1.240 - - [02/Feb/2010:20:45:10 -0500] "GET /zm/cgi-bin/zms?mode=jpeg&monitor=8 HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"


I did a chmod a-x on it yesterday thinking that it might need to be set to executable.
Your looking at the time stamp for the wrong file. It should be the apache config file that contains the ScriptAlias /cgi-bin/ definition.

The log file entry looks like one of the URL's I gave you to click on rather than one from when you tried to view a video stream. Its one of those that I need to see.

Finally, the chmod a-x removes the executable bit from the file. Do a "chmod a+x zms nph-zms" on the files.

Its 2:30am where I am now so I wont be back until tomorrow. Good luck.
stimburg
Posts: 22
Joined: Mon Feb 01, 2010 1:45 pm

Post by stimburg »

Sorry I misunderstood you.

The timestamp changed on the httpd.conf file when I restarted the server. I know it's having an effect too because I can removed the directive and my test.cgi file won't run.

I think your right about the the log entry being of the URL you sent me to directly access the zms file. I greped the log file and the few times I tried that url are the only instances where cgi-bin/zms appear.

Code: Select all


192.168.1.240 - - [02/Feb/2010:21:54:49 -0500] "POST /zm/index.php HTTP/1.1" 200 139 "http://192.168.1.1/zm/?view=watch&mid=8" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"

That's all that comes up, 3 times in a row in the access log when I try to view the live stream.


I really appreciate the help so far. I'll do more research tomorrow when I get the time.

Thanks again.
Locked