1

I'm new to the Rasp Pi so am at a stage where I'm following existing instructions rather than knowing for sure how to solve problems.

I'm trying to set up a reverse proxy on the Rasp Pi, using NGINX in order to be able to HTTPS to my local network HTTP IP Camera, a Wansview K2. I've followed the instructions @ https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=34291&p=1261650#p1261650.

I've got to the point where I can route into the cameras admin page over an external HTTPS connection. I can change settings so all paths are set up in NGINX correctly. However, for the life of me I cannot work out how to get the stream so that ultimately I can connect to the stream using Androids IP Cam Viewer app (see below). I cannot get a stream through the admin page either locally or remotely due to the need for an ActiveX control which seems not to work in Chrome or Edge. I can get a stream using Androids IP Camera Viewer with RTSP over HTTP. So RTSP is the bit I'm missing the the setup.

According to the camera settings and documentation RTSP is defaulted to port 554 and the stream is available on /live/ch0. What I can't work out unfortunately and despite Googling is how to set up the RTSP bits in NGINX. I may be completely missing the point but this is my current understanding.

With this in mind this is my current NGINX configuration:

server {
    # SSL configuration
    #

    listen 443 ssl;
    listen [::]:443 ssl;
    keepalive_timeout 70;

    ssl on;
    ssl_session_timeout 180m;

    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    #ssl_prefer_server_ciphers on;
    #ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;

    ssl_certificate /home/ralfym/certificate.crt;
    ssl_certificate_key /home/ralfym/certificate.key;

    access_log /home/ralfym/nginx.log;
    server_name ralfym.something.com;

    location /lounge {
        proxy_pass http://192.168.1.21:99/;
        proxy_redirect off;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr; 
        #try_files $uri $uri/ =404;
    }

    location /hy-cgi {
            proxy_pass http://192.168.1.21:99/hy-cgi;
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
    }

    location /style {
            proxy_pass http://192.168.1.21:99/style;
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
    }

    location /js {
            proxy_pass http://192.168.1.21:99/js;
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
    }

    location /images {
            proxy_pass http://192.168.1.21:99/images;
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
    }

    location /live {
            proxy_pass http://192.168.1.21:99/live;
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
    }
} 

As you can see from the above I have tried putting the /live path in, in the hope this would work, but it doesn't and neither does the stream work without this configured path. if I browse to /live/ch0 I see:

RTSP/1.0 400 Bad Request
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 
Connection: Close

This makes sense of course since I need to make an RTSP call, not HTTPS. Using IP Cam Viewer (adding a Generic URL, RTSP over HTTPS) and going to /live/ch0 I get:

[20/Jan/2018:10:38:39 +0000] "GET /live/ch0 HTTP/1.1" 499 0 "-" "Lavf54.6.100"
[20/Jan/2018:10:38:40 +0000] "GET /live/ch0 HTTP/1.1" 502 172 "-" "Lavf54.6.100"
[20/Jan/2018:10:38:40 +0000] "POST /live/ch0 HTTP/1.1" 400 0 "-" "Lavf54.6.100"
[20/Jan/2018:10:39:10 +0000] "GET /live/ch0 HTTP/1.1" 499 0 "-" "Lavf54.6.100"

OK, so after all the above I can get a stream if I turn off RTSP and turn on Onvif, then in IP Camera Viewer choose an Onvif camera. It's slow and jerky but am guessing that's my Pi struggling (it's an old Model B). I'd still like to understand the RTSP bits.

Can anyone provide any help please?

Regards

0

What I did was set up a MotionEye OS system to convert the RTSP streams to HTTP. Then you can add the HTTP streams to the reverse proxy. On the MotionEye OS system, add a surveillance username and password, then test the Video Streaming settings for authentication mode. I did not have luck with Digest. I am still looking for a method to use the nginx reverse proxy to directly share RTSP out, since that is the way to get video to the Amazon Echo Show. The MotionEye system will require another pi or one of the single board systems he has listed in his HCL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.