HTTP Video Stream with (IPC-EBW81230 12MP Panoramic Network IR Fisheye Camera)

DanielReal

n3wb
Nov 12, 2019
3
0
New York
Hi,

I'm trying to stream the main video feed of my new camera (IPC-EBW81230 12MP Panoramic Network IR Fisheye Camera)

I want to stream in the game engine Unity.

I was able to get the stream into OBS Viewer software by using the rtsp protocol with the following URL:
rtsp:/admin:<password>@192.168.0.50:554/

But I need the HTTP equivalent to get that feed into Unity. I already have the

I have tried the following url with no luck:
http://admin:<password>@192.168.0.50/

It returns me no bytes of information and stops...

I couldn't find any doc on that...

I'm using this code to get the stream:

C#:
using UnityEngine;
using System.Collections;
using System;
using System.Net;
using System.IO;

public class NetworkCamera : MonoBehaviour {

   

    public string sourceURL = "http://192.168.0.50";
    private Texture2D texture;
    private Stream stream;
    private MeshRenderer frame;    /Mesh for displaying video

    private void Start() {
        frame = GetComponent<MeshRenderer>();
        GetVideo();
    }

    public void GetVideo() {
        texture = new Texture2D(2, 2);
        / create HTTP request
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sourceURL);
        /Optional (if authorization is Digest)
        req.Credentials = new NetworkCredential("admin", "<password>");
        / get response
        WebResponse resp = req.GetResponse();
        / get response stream
        stream = resp.GetResponseStream();
        StartCoroutine(GetFrame());
    }

    IEnumerator GetFrame() {
        Byte[] JpegData = new Byte[100000];

        while (true) {
            int bytesToRead = FindLength(stream);
            print(bytesToRead);
            if (bytesToRead == -1) {
                print("End of stream");
                yield break;
            }

            int leftToRead = bytesToRead;

            while (leftToRead > 0) {
                leftToRead -= stream.Read(JpegData, bytesToRead - leftToRead, leftToRead);
                yield return null;
            }

            MemoryStream ms = new MemoryStream(JpegData, 0, bytesToRead, false, true);

            texture.LoadImage(ms.GetBuffer());
            frame.material.mainTexture = texture;
            stream.ReadByte(); / CR after bytes
            stream.ReadByte(); / LF after bytes
        }
    }

    int FindLength(Stream stream) {
        int b;
        string line = "";
        int result = -1;
        bool atEOL = false;

        while ((b = stream.ReadByte()) != -1) {
            if (b == 10) continue; / ignore LF char
            if (b == 13) { / CR
                if (atEOL) {  / two blank lines means end of header
                    stream.ReadByte(); / eat last LF
                    return result;
                }
                if (line.StartsWith("Content-Length:")) {
                    result = Convert.ToInt32(line.Substring("Content-Length:".Length).Trim());
                } else {
                    line = "";
                }
                atEOL = true;
            } else {
                atEOL = false;
                line += (char)b;
            }
        }
        return -1;
    }
}

Anyone has an idea?

Cheers,
 
Last edited:
I am not sure this is more bi question. But I think it's like this. The url is rtsp:/ip:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

I am not sure tho.
 
Hi,

I'm actually already able to get the streaming feed using the rtsp protocol. What I'm looking for is a similar request leveraging the HTTP protocol.
 
Hi,

I'm actually already able to get the streaming feed using the rtsp protocol. What I'm looking for is a similar request leveraging the HTTP protocol.
Try this:

Code:
http://user:password@Camera-IP/cgi-bin/mjpg/video.cgi?channel=1&subtype=0

or this:

Code:
http://Camera-IP/cgi-bin/mjpg/video.cgi?channel=1&subtype=0
 
  • Like
Reactions: Grn1z