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

Blue Iris losing RTSP connection to WyzeCam V2 #351

Open
ark-git opened this issue May 12, 2018 · 235 comments
Open

Blue Iris losing RTSP connection to WyzeCam V2 #351

ark-git opened this issue May 12, 2018 · 235 comments

Comments

@ark-git
Copy link

@ark-git ark-git commented May 12, 2018

I was able to connect to Blue Iris using RTSP. However after sometime it will lose connection and the only way to connect back to Blue Iris is to reboot. I also verified its not Blue Iris since it doesn't work with VLC also.

@jmtatsch
Copy link
Collaborator

@jmtatsch jmtatsch commented May 13, 2018

Web UI still works? Look at your rtspserver.log maybe it died

@ark-git
Copy link
Author

@ark-git ark-git commented May 13, 2018

v4l2rtspserver-master.log
Logs are attached. I also noticed that HTTP streaming also stopped, however I can still access through web browser but lagging.

@jmtatsch
Copy link
Collaborator

@jmtatsch jmtatsch commented May 14, 2018

It seems to be creating a lot of sources for my taste.
Can post the outputs of ps and free in such a situation?

@ark-git
Copy link
Author

@ark-git ark-git commented May 14, 2018

free.log
ps.log
see attached. Thanks

@jmtatsch
Copy link
Collaborator

@jmtatsch jmtatsch commented May 14, 2018

hmm nothing extraordinary
@nik0 do you see anything peculiar in the logs?

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 14, 2018

In the server logs there are a lot of sessions creation. If you use only VLC does it also happen ?

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 14, 2018

There is also something "strange" in logcat / logs sections ?

@ark-git
Copy link
Author

@ark-git ark-git commented May 14, 2018

@jmtatsch, btw, the logs above is from running the streaming in http mode. I will run the streaming in rtsp mode and will resend logs.
attaching logs and logcat logs
logcat.log
logs.log

@ark-git
Copy link
Author

@ark-git ark-git commented May 14, 2018

I have disconnected the two WyzeCams from Blue Iris and running rtsp streaming only to vlc. Will update with the results later.

@ark-git
Copy link
Author

@ark-git ark-git commented May 14, 2018

VLC also loses connection after some time

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 14, 2018

Does it recover some times, or at the first time does not recover ?
Does the log looks the same? connection/disconnection/reconnection ...
I suspect that many connection/disconnection lead to memory leaks ...

@ark-git
Copy link
Author

@ark-git ark-git commented May 14, 2018

If I restart the stream on VLC it will recover. Log files still look similar to before.

@ark-git
Copy link
Author

@ark-git ark-git commented May 14, 2018

Running top command shows the attached.
top.log

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 26, 2018

Does-it recover when you have the html page opened ?

@ark-git
Copy link
Author

@ark-git ark-git commented May 27, 2018

The RTSP does not disconnect when the html page is opened. Any clues?

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 28, 2018

Yes ! The image capture and the stream were in the same thread. I don't know why, but VLC lose the connection after some time due to that.
I made the correction, we have to re-publish the whole thing. There will be a lot of changements in the next release ....

@EliasKotlyar
Copy link
Owner

@EliasKotlyar EliasKotlyar commented May 29, 2018

I have compiled a new v4l2server binary and pushed it here. Can someone test please if the breakups still occur?

@ark-git
Copy link
Author

@ark-git ark-git commented May 29, 2018

Cannot get image. See Video server log
Contents of v4l2rtspserver-master.log

/system/sdcard/bin/v4l2rtspserver-master: can't load library 'libmp3lame.so.0'
/system/sdcard/bin/v4l2rtspserver-master: can't load library 'libmp3lame.so.0'

@EliasKotlyar
Copy link
Owner

@EliasKotlyar EliasKotlyar commented May 29, 2018

Ah ok, my mistake. I have updated it. There was a old library involved.

@ark-git
Copy link
Author

@ark-git ark-git commented May 30, 2018

The Html page now says "Unable to Load Image". See below for videoserver log. When I select RTSP H264 server in th edrop down menu, it goes back to not selected after some time.

Contents of v4l2rtspserver-master.log

2018-05-30 03:56:27.451 ( 2.181s) [main thread ] ImpEncoder.cpp:1180 0| Found Sensor with ID:22
i264e[info]: profile Constrained Baseline, level 3.1
2018-05-30 03:56:28.130 ( 2.860s) [main thread ] ImpEncoder.cpp:123 0| OSD pos 0,0,1279,36
2018-05-30 03:56:28.131 ( 2.862s) [main thread ] ImpEncoder.cpp:123 0| OSD pos 1240,0,1279,39
2018-05-30 03:56:29.159 ( 3.889s) [update_thread ] ImpEncoder.cpp:421 0| Changed OSD
2018-05-30 03:56:29.159 ( 3.889s) [update_thread ] ImpEncoder.cpp:485 0| Changed motion sensitivity=4
2018-05-30 03:56:29.160 ( 3.891s) [update_thread ] ImpEncoder.cpp:648 0| Detection region= ((0,0)-(1279,719))
/system/sdcard/bin/v4l2rtspserver-master: /home/ptkang/work/platform/isvp_20160504_e/proj/sdk-lv3/src/imp/ivs/ivs_move/src/filter.c: 156: Start: Assertion `filter->roi.x >= 0 && filter->roi.y >= 0 && filter->roi.width >= 0 && filter->roi.height >= 0 && filter->roi.x + filter->roi.width <= filter->wholeSize.width &&filter->roi.y + filter->roi.height <= filter->wholeSize.height' failed.

@ark-git
Copy link
Author

@ark-git ark-git commented May 30, 2018

@EliasKotlyar, any idea why its broken right now. I dont get the video feed on to the web page anymore. Am i doing something wrong. I just copied all the files from "Firmware Mod" folder onto the SD card and update wifi conf file and restart.

@johnebgood
Copy link

@johnebgood johnebgood commented May 31, 2018

@ark-git I'm a first time user and I was having the same issue, from this other thread: EliasKotlyar/Xiaomi-Dafang-Software#21 it appears something was compiled with 4 detection areas however it needs to be compiled with 16 detection areas. The work around is to turn off motion detection. Maybe someone will add an option to set the number of detection areas in a conf file and have some checks for failure and recommendations or auto detect?

@ark-git
Copy link
Author

@ark-git ark-git commented May 31, 2018

I was able to get RTSP streaming to work again by disabling "Motion Detection". However the stream stopped after some time even if I leave the Html page opened. See logs
v4l2rtspserver-master.log

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 31, 2018

Did you test with the really last version that have just been pushed ?

@ark-git
Copy link
Author

@ark-git ark-git commented May 31, 2018

I tested with the " Corrected #388 " released yesterday. That is why I had to disable "Motion Detection" to get it to work.

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 31, 2018

With the last version you don’t need to deactivate the motion (hopefully)
I got my camera working with VLC overnight

@ark-git
Copy link
Author

@ark-git ark-git commented May 31, 2018

I ran the "autoupdate.sh" scripts and got the following. See attached log.
auto update.log

@ark-git
Copy link
Author

@ark-git ark-git commented May 31, 2018

@nik0 I just downloaded the latest from "Master Branch" and loaded the "Firmware Mod" files onto my second camera and I still had to disable "Motion Detection" for the stream to work.

@nik0
Copy link
Collaborator

@nik0 nik0 commented May 31, 2018

Can you run the command « env » before running the server ?
env >> /tmp/error.log in run.sh script
The LD_LIBRARY_PATH shall contains /system/sdcard/libs at first place...

@SirRedwind
Copy link

@SirRedwind SirRedwind commented Jan 27, 2020

Same here. And I am doing the same as @sshaikh - toggling the RTSP on and off so it reconnects. In all my 4 cameras.

@mck182
Copy link

@mck182 mck182 commented Jan 30, 2020

I have 2 Wyze v2 cameras running, same exact firmware, same exact config. One works perfectly fine 100% of the time, the other one has constant stream issues (and always had since I bought it) like frame freezing and stream smears/pixelation. Could this be a hw issue? 🤔

@puddly @TheCloudlessSky have you guys got anywhere with your investigations?

@puddly
Copy link

@puddly puddly commented Jan 30, 2020

@mck182 no, I sold my two Wyze cameras. The platform is useless for reliable real-time streaming.

I reverse engineered both the app preview protocol (currently used by TinyCam) and wrote my own RTSP server running on a clean build of openfang. Unsurprisingly, the app streaming protocol doesn't work reliably for continuous recording and without hardware accelerated H264 encoding, you can't get more than a few frames per second with libx264.

I instead bought some cheaper no-name PTZ dome cameras running "IP Camera" firmware. They don't look as cool as the Wyze cams but they have motion detection with FTP event uploads, JPEG snapshots, multiple configurable RTSP streams, and enough buggy features to make hacking them sort of interesting.

@sshaikh
Copy link

@sshaikh sshaikh commented Jan 30, 2020

@puddly any links to that model? I've found the no name IP cam market to be a minefield.

@surge919
Copy link

@surge919 surge919 commented Mar 24, 2020

Has anyone looked at a newer version of LIVE555 to see if this helps issues with losing the connection?

@klutchell
Copy link

@klutchell klutchell commented Mar 28, 2020

Add me to the count (using Shinobi). It seems to die after a while, perhaps when constantly viewing an RTSP stream from two places (but perhaps not). I usually fix it by toggling the RTSP server on and off at which point Shinobi reconnects.

+1

@backcountrymountains
Copy link

@backcountrymountains backcountrymountains commented Apr 13, 2020

@puddly
Stealing the thread to request info on the cams you moved to. Models, where did you buy them? Do you still like them? Thanks.

I instead bought some cheaper no-name PTZ dome cameras running "IP Camera" firmware. They don't look as cool as the Wyze cams but they have motion detection with FTP event uploads, JPEG snapshots, multiple configurable RTSP streams, and enough buggy features to make hacking them sort of interesting.

@puddly
Copy link

@puddly puddly commented Apr 13, 2020

@backcountrymountains: Tenvis TH661. I only bought them because the pair was being sold for $15 locally, not because they're good or have any specific features. They work well for what I need them for: local recording, motion events, and occasional remote viewing.

Once rooted placed behind a firewall, you'll need to write an FTP server to shuttle events and videos/pictures back into your favorite home automation system. The format is proprietary-ish. They're not great cameras by any stretch of the imagination, but they at least can stream wirelessly for more than 10 minutes at a time and run for months without needing a reset.

@Animosity
Copy link

@Animosity Animosity commented May 3, 2020

Add me to the count (using Shinobi). It seems to die after a while, perhaps when constantly viewing an RTSP stream from two places (but perhaps not). I usually fix it by toggling the RTSP server on and off at which point Shinobi reconnects.

+1 Same here.

@Animosity
Copy link

@Animosity Animosity commented May 4, 2020

Here is a log snippet from Shinobi CCTV when the failure occurs

3kfNOB2vGF : Gdvu1tX6Eq2
FFMPEG STDERR 30 minutes ago
[rtsp @ 0x80d85d000] CSeq 4 expected, 0 received.

3kfNOB2vGF : Gdvu1tX6Eq2
Process Started 30 minutes ago
cmd : -loglevel warning -r 25 -progress pipe:5 -analyzeduration 100000 -probesize 100000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i "rtsp://MY_WYZEv2_IP_ADDRESS_HERE:8554/unicast" -f mp4 -an -c:v copy -strict -2 -movflags +frag_keyframe+empty_moov+default_base_moof -metadata title="Poseidon Stream" -reset_timestamps 1 pipe:1 -update 1 -r 25 -s 1280x720 "/root/ShinobiCE/streams/3kfNOB2vGF/Gdvu1tX6Eq2/s.jpg" -y -r 10 -s 320x240 -an -c:v pam -pix_fmt gray -f image2pipe pipe:3 -r 5 -s 1280x720 -an -f singlejpeg pipe:4 -c:a copy -c:v copy -f hls -tune zerolatency -g 1 -hls_time 15 -hls_list_size 4 -start_number 0 -live_start_index -3 -hls_allow_cache 0 -hls_flags +delete_segments+omit_endlist "/root/ShinobiCE/streams/3kfNOB2vGF/Gdvu1tX6Eq2/detectorStream.m3u8"

3kfNOB2vGF : Gdvu1tX6Eq2
Camera is not streaming 30 minutes ago
msg : Restarting Process

3kfNOB2vGF : Gdvu1tX6Eq2
FFMPEG STDERR 31 minutes ago
rtsp://MY_WYZEv2_IP_ADDRESS_HERE:8554/unicast: corrupt decoded frame in stream 0
3kfNOB2vGF : Gdvu1tX6Eq2
FFMPEG STDERR 31 minutes ago
[h264 @ 0x80d89ed00] error while decoding MB 36 55, bytestream -17

@PixelDJ
Copy link

@PixelDJ PixelDJ commented May 24, 2020

I seem to be having the same issue here. My Amcrest camera works flawlessly, but my Wyze cams have a really hard time staying connected.

@hank
Copy link
Contributor

@hank hank commented Jun 24, 2020

I've been battling this issue for a long time and I finally got most of my cameras to work with the latest trunk. Here's what seems to work:

Video: 1280, SMART, 23FPS, 1000 or 2000 bitrate
Audio: PCMU
config/swap.conf created from template in repo, turned 256mb swap on in there. Make sure your sdcard is big enough.
bin/v4l2rtspserver-master.ini: Turn off motion detection, jpeg, and potentially the other features. This reduces my CPU usage from 70% idle to 30% idle.

With these settings I've had streaming from 5 cameras pretty consistently at 23fps for days. I also threw live555 in front of them so I don't bog the cameras down with multiple stream clients.

@maichai
Copy link

@maichai maichai commented Jul 13, 2020

Same problem here with Xiaofang camera. The RTSP server is still running, but the stream stops. After restarting the RTSP server the stream works again..

Model | Xiaomi Xiaofang 1S
Firmware date | 2020-07-06T19:47:13Z
Firmware branch | master
Firmware commit | 2c2990b ( No update available)
Kernel Version | #32 PREEMPT Wed Jan 24 02:40:56 CST 2018
Bootloader Version | U-Boot 2013.07 (Jul 05 2018 - 17:59:02)

@sshaikh
Copy link

@sshaikh sshaikh commented Jul 13, 2020

I've changed my setup and now use an rtsp proxy in front of all my cameras (including the dafang). This seems to mitigate a lot of the issues so I presume it's a combination of client and dafang camera that is causing an issue.

At its very basic, if the client reconnects it should get the stream back, so for those experiencing problems perhaps see if you can knock up some kind of watchdog.

@maichai
Copy link

@maichai maichai commented Jul 14, 2020

I've changed my setup and now use an rtsp proxy in front of all my cameras (including the dafang). This seems to mitigate a lot of the issues so I presume it's a combination of client and dafang camera that is causing an issue.

This is definitely not the issue in my case. For you it seems the client loses the connection and does not reconnect.

In my case the RTSP server stops responding to new connects and does not send the stream any more. Entirely different story.

Xiaofang S1

@sshaikh
Copy link

@sshaikh sshaikh commented Jul 14, 2020

I had exactly the same symptom as you - my client wouldn't reconnect until I restarted the rtsp server on the camera. That's why I'm in this thread.

However with the rtsp proxy, all clients have had a continuous connection for weeks now. They may have been interrupted, but their reconnect logic seems to work as they are always working when I check.

I know it sounds incredible but there's some state being held somewhere that depends on a combination of client and server (maybe particular clients are crashing the server? Maybe badly behaved clients exhaust some hidden max client limit?), and the proxy is enough to disturb that.

But of course you're welcome to ignore the suggestion if you consider it a non solution :)

@tosaddler
Copy link

@tosaddler tosaddler commented Jul 14, 2020

@sshaikh
Copy link

@sshaikh sshaikh commented Jul 14, 2020

This one: https://github.com/aler9/rtsp-simple-proxy although it seems to have merged with another program now.

@maichai
Copy link

@maichai maichai commented Jul 15, 2020

Could you try running the proxy on the camera? does that still work?

@Minimonkey147
Copy link

@Minimonkey147 Minimonkey147 commented Aug 5, 2020

Got a wazecam dafang hack installed outside with case cover working perfectly with blue iris using the following settings, hope this helps someone:

Blue Iris Settings:
Address: rtsp://192.168.x.x/unicast
change to port 554 on camera

Video Settings:
1600x900
FixedQp
15 per 1
Bitrate 500
Port 554

Audio Settings:
PCM
16K

Services
auto-night detection
rtsp-h264

@KaneHart
Copy link

@KaneHart KaneHart commented Aug 30, 2020

Not worth it. For some reason this Hack and Blue iris is too laggy the fixes is next to 0 Biterate.

Instead what I did was grab the Jpg and yes the FPS is slower at least I get better quallity. Now if only rtmp was not crapping out every few hours and having to reboot my device constantly :(

Oddly enough my V1 Camera's use a really old defang and they never ever have issues ran for years even out in -40. Not sure if this a V2 Camera issue or a bug with the current firmware.

@stale
Copy link

@stale stale bot commented Oct 31, 2020

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.

@stale stale bot added the wontfix label Oct 31, 2020
@westerncanada
Copy link

@westerncanada westerncanada commented Oct 31, 2020

This is still an issue, even with the latest code.

@stale stale bot removed the wontfix label Oct 31, 2020
@KaneHart
Copy link

@KaneHart KaneHart commented Oct 31, 2020

yup still an issue not stale at all just no one willing to help us on it :(

@stale
Copy link

@stale stale bot commented Dec 31, 2020

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.

@stale stale bot added the wontfix label Dec 31, 2020
@Swap-File
Copy link

@Swap-File Swap-File commented Dec 31, 2020

Still an issue, not stale.

@stale stale bot removed the wontfix label Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet