Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connects OK but no stream #16

Open
strickerconsulting opened this issue Mar 7, 2017 · 13 comments
Open

Connects OK but no stream #16

strickerconsulting opened this issue Mar 7, 2017 · 13 comments

Comments

@strickerconsulting
Copy link

strickerconsulting commented Mar 7, 2017

Hi,

I am trying to use the mjpeg-relay to relay a IP camera mjpeg stream. When launching the streamer, everything is looking fine. The terminal looks like this:

andre@rs209835:~/mjpeg-relay$ python relay.py -d -w 54018 http://admin:****@dyndns-host:8091/mjpeg/stream.cgi?chn=1
Starting new HTTP connection (1): dyndns-host
send: 'GET /mjpeg/stream.cgi?chn=1 HTTP/1.1\r\nHost: dyndns-host:8091\r\nAccept: /\r\nAccept-Encoding: gzip, deflate\r\nAuthorization: Basic YWRtaW46MTIzNDU2\r\nUser-Agent: python-requests/2.3.0 CPython/2.7.3 Linux/3.2.0-102-generic\r\n\r\n'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: WWW-Authenticate: Digest realm="IPCamera Login", nonce="d2196ed82d421beea792716429f434d0", qop="auth"
header: Content-Type: text/html
header: Content-Length: 351
header: Connection: close
header: Date: Tue, 07 Mar 2017 21:09:09 GMT
header: Server: lighttpd/1.4.35
"GET /mjpeg/stream.cgi?chn=1 HTTP/1.1" 401 351
send: 'GET /mjpeg/stream.cgi?chn=1 HTTP/1.1\r\nHost: dyndns-host:8091\r\nAuthorization: Digest username="admin", realm="IPCamera Login", nonce="d2196ed82d421beea792716429f434d0", uri="/mjpeg/stream.cgi?chn=1", response="caf37f39406629b9aee0eba02ded2e75", qop="auth", nc=00000001, cnonce="bb118369fb119c46"\r\nAccept-Encoding: gzip, deflate\r\nAccept: /\r\nUser-Agent: python-requests/2.3.0 CPython/2.7.3 Linux/3.2.0-102-generic\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Cache-Control: public,max-age=0
header: Accept-Ranges: bytes
header: Content-Type: multipart/x-mixed-replace;boundary=ipcamera
header: Connection: close
header: Transfer-Encoding: chunked
header: Date: Tue, 07 Mar 2017 21:09:10 GMT
header: Server: lighttpd/1.4.35
"GET /mjpeg/stream.cgi?chn=1 HTTP/1.1" 200 None
Connected to stream source, boundary separator: --ipcamera

I can see the to-be-relayed stream OK from the internet and on my local network. When I run the mjpeg-relay, I can see the status page and I do see a incoming bandwidth. When I connect to the /stream URL, I do see that the outbound bandwidth goes up. But 1. I do not see the mjpeg in the browser/-Tag. 2. Also VLC does not play the outgoing stream. I tried running the relay on a different server but makes no difference. Anything else I can look at?

@Silex
Copy link
Contributor

Silex commented Mar 7, 2017

Does the /snapshot url displays a snapshot? Can you paste the result of curl --raw -v http://localhost:54321/stream somewhere (I want to look at the headers).

My guess right now is that Transfer-Encoding: chunked confuses the parser.

@strickerconsulting
Copy link
Author

No. The returning image is empty (also double checked wget - resulting file is empty)

@strickerconsulting
Copy link
Author

strickerconsulting commented Mar 7, 2017

curl --raw -v http://timemelter.com:54321/stream

  • Hostname was NOT found in DNS cache
  • Trying 5.35.251.83...
  • Connected to timemelter.com (5.35.251.83) port 54321 (#0)

GET /stream HTTP/1.1
User-Agent: curl/7.37.0
Host: timemelter.com:54321
Accept: /

  • HTTP 1.0, assume close after body
    < HTTP/1.0 200 OK
    < Connection: close
    < Server: MJPEG-Relay
    < Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
    < Pragma: no-cache
    < Expires: -1
    < Content-Type: multipart/x-mixed-replace;boundary=--ipcamera
    <

@Silex
Copy link
Contributor

Silex commented Mar 7, 2017

Ok, give https://github.com/Silex/mjpeg-relay/tree/chunked-encoding-support a try and report.

Btw, in your above paste after the headers there's nothing?

My commit is based on http://docs.python-requests.org/en/master/user/advanced/#chunk-encoded-requests

@strickerconsulting
Copy link
Author

strickerconsulting commented Mar 7, 2017 via email

@Silex
Copy link
Contributor

Silex commented Mar 7, 2017

git clone git://github.com/Silex/mjpeg-relay
git checkout chunked-encoding-support

@strickerconsulting
Copy link
Author

strickerconsulting commented Mar 7, 2017

Ah thanks.

Done that. When I run the relay now, it looks ok again, but the /status page show no incoming bandwidth..

python relay.py -d -w 54018 http://admin:****@dyn-url:8091/mjpeg/stream.cgi?chn=1
Starting new HTTP connection (1): dyn-url
send: 'GET /mjpeg/stream.cgi?chn=1 HTTP/1.1\r\nHost: dyn-url:8091\r\nAccept: /\r\nAccept-Encoding: gzip, deflate\r\nAuthorization: Basic YWRtaW46MTIzNDU2\r\nUser-Agent: python-requests/2.3.0 CPython/2.7.3 Linux/3.2.0-102-generic\r\n\r\n'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: WWW-Authenticate: Digest realm="IPCamera Login", nonce="0c84df3082134992e588ef7d1dfe739f", qop="auth"
header: Content-Type: text/html
header: Content-Length: 351
header: Connection: close
header: Date: Tue, 07 Mar 2017 22:04:09 GMT
header: Server: lighttpd/1.4.35
"GET /mjpeg/stream.cgi?chn=1 HTTP/1.1" 401 351
send: 'GET /mjpeg/stream.cgi?chn=1 HTTP/1.1\r\nHost: dyn-url:8091\r\nAuthorization: Digest username="admin", realm="IPCamera Login", nonce="0c84df3082134992e588ef7d1dfe739f", uri="/mjpeg/stream.cgi?chn=1", response="c7d421e513fa43b1e48079761fcf6896", qop="auth", nc=00000001, cnonce="10cbc87611e2c11f"\r\nAccept-Encoding: gzip, deflate\r\nAccept: /\r\nUser-Agent: python-requests/2.3.0 CPython/2.7.3 Linux/3.2.0-102-generic\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Cache-Control: public,max-age=0
header: Accept-Ranges: bytes
header: Content-Type: multipart/x-mixed-replace;boundary=ipcamera
header: Connection: close
header: Transfer-Encoding: chunked
header: Date: Tue, 07 Mar 2017 22:04:09 GMT
header: Server: lighttpd/1.4.35
"GET /mjpeg/stream.cgi?chn=1 HTTP/1.1" 200 None
Connected to stream source, boundary separator: --ipcamera

mjpeg-relay status
Summary
Parameter Value
Clients 0
Incoming bandwidth 0.0000Mb/s
Outgoing bandwidth 0.0000Mb/s

@Silex
Copy link
Contributor

Silex commented Mar 7, 2017

Please use a pastebin or use github's code blocks.

Anyway, you are sure http://admin:****@dyndns-host:8091/mjpeg/stream.cgi?chn=1 works properly? Is it possible to setup some temporary viewer user for us to use?

@strickerconsulting
Copy link
Author

strickerconsulting commented Mar 7, 2017 via email

@strickerconsulting
Copy link
Author

strickerconsulting commented Mar 7, 2017 via email

@OliverF
Copy link
Owner

OliverF commented Mar 7, 2017

Hello,

Just had a quick attempt, looks like that gives a 401 even when connecting directly without using mjpeg-relay. Please check the credentials

@strickerconsulting
Copy link
Author

strickerconsulting commented Mar 7, 2017 via email

@Silex
Copy link
Contributor

Silex commented Mar 7, 2017

The credentials are fine, you need to use digest auth.

The problem is more like the camera only accepts very few connections... curl -v --raw --anyauth "http://test:[email protected]:8091/mjpeg/stream.cgi?chn=1" timeouts before sending the stream.

In all my attempts it only sent the MJPG once, and thus I could not debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants