EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

HTTP MPEG Stream #539

Closed AustinSaintAubin closed 5 years ago

AustinSaintAubin commented 6 years ago

Any chance that MPEG streams could be implemented? https://github.com/jacksonliam/mjpg-streamer

jmtatsch commented 6 years ago

We already have functionality for streaming mjpg in https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/firmware_mod/bin/mJpegStreamer . What are you missing?

AustinSaintAubin commented 6 years ago

Tried, after killing the other streaming processes..... Every time I would start mJpegStreamer 10, the Wyzecam V2 would lockup.

AustinSaintAubin commented 6 years ago

'mJpegStreamer' provides an mpeg streams over RTSP.

I need an MPEG stream over HTTP, like what mjpg-streamer is able to do. Its similar to what is done with https://CAMERA-IP/cgi-bin/currentpic.cgi but constantly refreshes based on settings. Similar to how these streams behave. Stream needs the option to be over HTTP, not HTTPS. Here are some sample steams.

mcheah commented 6 years ago

Seconding this feature request.
Looking to use this camera as a cheap wifi cam for Octoprint. Octoprint currently only supports http mjpg streams, directly embedded in their web interface, explicitly not RTSP. I may look into this myself. Is the video interface accessible as a normal video4linux device? Is there a method for compiling directly on the device? Or is cross-compilation the only method for creating code?

SomebodySysop commented 6 years ago

I create an h.264 rtsp stream from my wyzecam v2 to my iSpy video surveillance server. Then, in iSpy, I create an mjpeg over http stream: https://www.ispyconnect.com/userguide-live-feeds.aspx

AustinSaintAubin commented 6 years ago

@SomebodySysop I am looking for something more native... that does not require another application just to get an mpeg stream. But thanks for the info.

AustinSaintAubin commented 6 years ago

Trying a work around to Restream RTSP to M-JPEG. But I cannot get it to work with the camera... tested H264 RTSP, and MJPEG RTSP streams.

kalazzerx commented 5 years ago

I am also interested in this feature - in order to connect to https://www.actiontiles.com/ as a tile on my smartthings interface.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jneilliii commented 5 years ago

I'd like this thread to be revisited. Native mjpg over http IMO would be efficient and a welcome addition to the project. Like @mcheah mentioned, being able to use this CFW on a Wyze 2 Cam with OctoPrint would be a huge benefit.

jokesters commented 5 years ago

I've been trying to get this to work with octoprint for a while now.

redpizza69 commented 4 years ago

Just flashed a Neos camera to use with Octoprint... and then read this after I couldn't get it to work.

+1 for mjpg over http.

Anybody found a solution yet?

jneilliii commented 4 years ago

There are some posts on the octoprint community forum that are basically reencoding the stream using VLC or ffmpeg, but in that situation you still introduce lag.

crackers8199 commented 4 years ago

add me as a +1 for adding this, if possible. i have been unable to get rtsp to work reliably on my phone over openvpn.

right now, i have this running on a server at home re-encoding the RTSP stream...

https://github.com/eroji/rtsp2mjpg

doesn't seem to be much (if any) lag, and stream seems solid so far on my phone (while the H264 RTSP stream viewed in tinycam pro crashes often when i'm connected via VPN). the downside (to me) is that in addition to needing an always on machine to do the re-encode, i can't move the camera from the active stream, since there's no setting for it using a generic camera. having this available natively from the camera would be a huge improvement and a great addition to the firmware.

jmtatsch commented 4 years ago

Why dont you just stop the H264 RTSP and start the MJPEG RTSP?

crackers8199 commented 4 years ago

I haven't been able to get the mjpeg streamer to work. Even when trying to connect on my home network i have no picture...plus, i don't know if the issue is rtsp itself or h264. If it's rtsp that is the issue, using the mjpeg streamer wouldn't make a difference anyway since it's still going via rtsp...

jmtatsch commented 4 years ago

You need to shut down the h264 server first. Also check your autostarts.

crackers8199 commented 4 years ago

You need to shut down the h264 server first. Also check your autostarts.

I have done that. I've tried it multiple times, each time shutting down the h264 first. Mjpeg doesn't work. There was an issue that seemed to indicate it is known it doesn't work, but isn't important to fix because h264 works...I'll try to find it but I'm on my phone so it might be tough.

edit: here are several issues that discuss this in one form or another...

https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/767

https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/670

https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/19

crackers8199 commented 4 years ago

can someone re-open this issue? either that or explain how to get MJPG RTSP streaming to work? if it's supposed to work i'm doing something wrong, because i've been trying for weeks and have never been able to get a video feed when using the MJPG RTSP server...

mathewgreen commented 4 years ago

Yes, this would be awesome! This would be the prefect solution if we could get native HTTP MJPG.

JamesSimpson commented 4 years ago

I too am interested in this if it could be added.

drug123 commented 3 years ago

For all OctoPrint users (@crackers8199 @AustinSaintAubin @redpizza69 @mcheah @jneilliii etc.) - you can have a nice workaround for getting it to work with your printer which does not require any transcodings. You basically need to do two things to make it work:

  1. Remove login requirement from /cgi-bin/currentpic.cgi You can do it by modifying /config/lighthttpd.conf on SD card (just find section starting with "# Support letsencrypt SSL cert paths" and replace with code below):

    # Support letsencrypt SSL cert paths
    # (we don't want to upgrade to SSL nor auth' this path)
    $HTTP["url"] !~ "^/.well-known/(.*)|^/cgi-bin/currentpic.cgi" {
    
    $HTTP["scheme"] == "https" {
        auth.backend                = "htdigest"
        auth.backend.htdigest.userfile = "/system/sdcard/config/lighttpd.user"
        auth.require = ( "/" => ("method" => "basic", "realm" => "all", "require" => "user=root"))
        alias.url = ( "/viewer" => "/system/sdcard/DCIM/" )
        $HTTP["url"] =~ "^/viewer($|/)" { server.dir-listing = "enable" }
    }

    I've added |^/cgi-bin/currentpic.cgi over there in regexp to disable password request for getting snapshots.

  2. Use https://micam.local/cgi-bin/currentpic.cgi in your Webcam snapshots section (use whatever hostname/IP you have instead micam.local), and also install SnapStream plugin and point it to https://micam.local/cgi-bin/currentpic.cgi