• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: mjpg-streamer works for port 8080 but not html files  (Read 5431 times)
bad_gui
Jr. Member
**

Karma: 0
Posts: 50


View Profile
« on: February 05, 2013, 06:56:27 PM »

I compiled mjpg-streamer from source on a Wheezy install on my Server plus

Previously, I had this package running on Lenny and Squeeze with no problems.

Now, I follow the instructions here http://skillfulness.blogspot.com/2010/03/mjpg-streamer-documentation.html
but can't get the demo pages
Quote
to show webcam video but accessing the port
Quote
does work.

I am using port 443 (outside and inside my network) since my ISP blocks port 80.  From my internal network I can access the 8080 port by http
but when I enter the same address with https I get an error
Quote
SSL received a record that exceeded the maximum permissible length.
(Error code: ssl_error_rx_record_too_long)

My lighttpd.conf looks like this

Code:
server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
        "mod_fastcgi",
        "mod_cgi",
        "mod_auth"
#       "mod_rewrite",
)

server.document-root        = "/var/www"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
#server.port                 = 80


index-file.names            = ( "index.php", "index.html",
                                "index.htm", "default.htm",
                                "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " #+ server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php5-cgi",
                     "socket" => "/tmp/php.socket"
                 )))

dir-listing.encoding        = "utf-8"
server.dir-listing          = "enable"

$SERVER["socket"] == ":443" {
    ssl.engine                  = "enable"
    ssl.pemfile                 = "/root/certificate/server.pem"
    ssl.ca-file                 = "/root/certificate/server.crt"
}
## type of backend
# plain, htpasswd, ldap or htdigest
auth.debug = 2
auth.backend = "plain"
# filename of the password storage for plain
auth.backend.plain.userfile = "/etc/lighttpd/.lighttpdpassword"
## debugging
# 0 for off, 1 for 'auth-ok' messages, 2 for verbose debugging
auth.require = ( "/" =>
(
"method" => "basic",
"realm" => "Password protected area",
"require" => "valid-user"
)
)


I have the mjpg-streamer provided sample html files in /var/www/mjpg-streamer and I invoke the binary with
/root/mjpg-streamer/mjpg_streamer -i "/root/mjpg-streamer/input_uvc.so" -o "/root/mjpg-streamer/output_http.so -p 8080 -w /var/www/mjpg-streamer"

I can see the html but not the video images.  Something is blocking video over https or is the directory the problem?  I chown www-data:www-data all of the html files.
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 440


View Profile WWW
« Reply #1 on: February 06, 2013, 04:18:30 PM »

I am using port 443
No - you seem to be trying to use https, which will use port 443 and run SSL/TLS connexions over it.
Have you actually set up your Web server to use SSL?
If not, try accessing http://192.168.1.4:443/mjpg-streamer/stream.html instead (http on port 443, which is not the same as https) and see what happens.  If it works you might like to use another port, rather than confuse everyone.
Logged

bad_gui
Jr. Member
**

Karma: 0
Posts: 50


View Profile
« Reply #2 on: February 06, 2013, 07:07:54 PM »

I apologize for confusing everyone.  Let's remove SSL and port 443 from the discussion of the problem.

I modified my lighttpd.conf to allow connections to port 80 without password protection to test the setup.  The mjpg-
streamer demo pages still don't show video (using http://192.168.1.4/mjpg-streamer ) and I have checked paths, permissions
and log files with no hint of what is wrong.  I can see all of the html pages in my /var/www folder.

I also use the -p:8080 option for the http_output plugin and can see the video feed via that port so the webcam, V4L USB, etc.
are OK.  I prefer not to have to redirect ports when I connect to my server from outside.  It also bugs me that I can't figure out
what is wrong.
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 440


View Profile WWW
« Reply #3 on: February 07, 2013, 05:53:02 PM »

The mjpg-streamer demo pages still don't show video (using http://192.168.1.4/mjpg-streamer )
  • What do they show?
  • What does get returned?
  • What browser are you using?
  • Have you used an HTTP headers extension to see what that reckons?
Logged

bad_gui
Jr. Member
**

Karma: 0
Posts: 50


View Profile
« Reply #4 on: February 09, 2013, 05:25:38 PM »

Quote
What do they show?
The sample pages show text and graphics but blank boxes where the webcam snapshots or streaming should be

Quote
What does get returned?
Not sure I understand the question.  There is no video snapshot or stream.

Here is the description from the sample page
The image displayed here was grabbed by the input plugin. The HTTP request contains the GET parameters action=snapshot. This requests one single picture from the image-input. To display another example, just click on the picture.

The link for the image is
Code:
http://192.168.1.4/mjpg-streamer/static.html

Quote
What browser are you using?

Iceweasel and Firefox

Quote
Have you used an HTTP headers extension to see what that reckons?

http://192.168.1.4/?action=snapshot

GET /?action=snapshot HTTP/1.1
Host: 192.168.1.4
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.4/mjpg-streamer/index.html
Connection: keep-alive
If-Modified-Since: Sun, 03 Feb 2013 02:35:09 GMT
If-None-Match: "3995104888"

HTTP/1.1 304 Not Modified
Vary: Accept-Encoding
Content-Type: text/html
Last-Modified: Sun, 03 Feb 2013 02:35:09 GMT
Etag: "3995104888"
Date: Sat, 09 Feb 2013 23:25:26 GMT
Server: lighttpd/1.4.31
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 440


View Profile WWW
« Reply #5 on: February 09, 2013, 06:55:57 PM »

GET /?action=snapshot HTTP/1.1
Host: 192.168.1.4
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
...
HTTP/1.1 304 Not Modified
Would not be a useful response for a video stream, but this is just a snapshot, one-off image?  So your browser reckons it already has a copy of it and it hasn't change since then.
You could go to about:cache in Firefox, find the entry (by uri) and see what it thinks it has.
Quote
Content-Type: text/html
That's not an image format.  Find out what the client *is* sending.
Logged

bad_gui
Jr. Member
**

Karma: 0
Posts: 50


View Profile
« Reply #6 on: February 12, 2013, 08:37:59 PM »

I re-read the documentation.  It seems that the module output_http.so is a simple web server.  Using the option
" -w /var/www " when invoking the command serves the contents of the folder (using port 80?).  Using the option
" -p 8080" serves the webcam on port 8080.

None of the online docs I saw mentions how to integrate with an existing webserver like lighttpd or apache beyond
using http://<guruplug-ip>:8080/?action=stream

This works but I have more to learn about how to implement this so that I can see the feed remotely.  Opening port 8080
on my router firewall is possible, but I want to make sure I don't expose a vulnerability.
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 440


View Profile WWW
« Reply #7 on: February 13, 2013, 05:47:52 PM »

Opening port 8080
on my router firewall is possible, but I want to make sure I don't expose a vulnerability.
Difficult to see how you are going to connect without opening up a port.
If you are worried that someone might be more likely to scan port 8080 looking for this then is your router able to do port translations.  All of the routers I've owned do (although one of them didn't actually document it, or have any Web page to configure it, but you could do it from the command line in the router - they didn't document the commands either...).  That would allow you to connect from some other port number via the Internet, but still use 8080 on your home network.
Logged

bad_gui
Jr. Member
**

Karma: 0
Posts: 50


View Profile
« Reply #8 on: March 01, 2013, 07:23:56 PM »

After reading many pages about reverse proxy and lightttpd as a solution to the webcam feed, I went back to the
mjpeg-streamer forum and found a method that doesn't require elaborate server configurations (which I never
really figured out).  Just php, which I was using anyway.

Here is the php solution when the webcam feed is going to any port (in my case I'm using 8443) that isn't the one
already used by lighttpd or Apache (e.g. 80 or 443).  This allows me to connect from the outside world and see the
feed from my webcam.  Firefox and Safari work but Windows IE8 doesn't.

This file is called "stream.php"

Code:
<?

/*
usage on webpage:
<img src="stream.php">
*/
$server = "localhost"; // camera server address
$port = 8443; // camera server port
$url = "/?action=stream"; // image url on server
set_time_limit(0); 
$fp = fsockopen($server, $port, $errno, $errstr, 30);
if (!$fp) {
        echo "$errstr ($errno)<br>\n";   // error handling
} else {
        $urlstring = "GET ".$url." HTTP/1.0\r\n\r\n";
        fputs ($fp, $urlstring);
        while ($str = trim(fgets($fp, 4096)))
        header($str);
        fpassthru($fp);
        fclose($fp);
}
?>

Logged

Pages: [1]
Print
Jump to: