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 · 176 comments

Comments

Projects
None yet
@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

This comment has been minimized.

Collaborator

jmtatsch commented May 13, 2018

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

@ark-git

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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

This comment has been minimized.

ark-git commented May 14, 2018

free.log
ps.log
see attached. Thanks

@jmtatsch

This comment has been minimized.

Collaborator

jmtatsch commented May 14, 2018

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

@nik0

This comment has been minimized.

Collaborator

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

This comment has been minimized.

Collaborator

nik0 commented May 14, 2018

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

@ark-git

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

ark-git commented May 14, 2018

VLC also loses connection after some time

@nik0

This comment has been minimized.

Collaborator

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

This comment has been minimized.

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

This comment has been minimized.

ark-git commented May 14, 2018

Running top command shows the attached.
top.log

@nik0

This comment has been minimized.

Collaborator

nik0 commented May 26, 2018

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

@ark-git

This comment has been minimized.

ark-git commented May 27, 2018

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

@nik0

This comment has been minimized.

Collaborator

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

This comment has been minimized.

Owner

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

This comment has been minimized.

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

This comment has been minimized.

Owner

EliasKotlyar commented May 29, 2018

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

@ark-git

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Collaborator

nik0 commented May 31, 2018

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

@ark-git

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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

This comment has been minimized.

ark-git commented May 31, 2018

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

@ark-git

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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...

@nik0

This comment has been minimized.

Collaborator

nik0 commented Aug 23, 2018

Try this one, it comes with an ini file (to be put on bin folder). You can play with the video quality settings and skip. Set to default (skip to 0) and see if the freeze is always here
v4l2rtspserver-master.zip

@goermezer

This comment has been minimized.

goermezer commented Aug 23, 2018

Ok, did it. Both settings 0 and 1 for SkipType run well for me. I don`t see any difference, except some general frame skips (9 skips per minute in VLC), which I can not influence by this setting or quality reduction.

But the time until VLC starts playing the stream has increased a lot compared to your version 3 hours ago. Sometimes it starts playing instantly or with little acceptable delay. But most of the time I have to wait ~8secs. There are also some extreme delays, where I have to wait ~15secs or more.

Nevertheless there are no more hickups, which is good progress. If you could improve the point above, a lot of people (including me) will be very happy :-)

@nik0

This comment has been minimized.

Collaborator

nik0 commented Aug 23, 2018

0 for skip is the default value (as before)
Did you test the value "2" ? It should be the one I provided later. And tell me about the freezes ...

@goermezer

This comment has been minimized.

goermezer commented Aug 23, 2018

I hope I tried the latest one. This was the link to it: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/files/2313535/v4l2rtspserver-master.zip

First I tested SkipType=0 and SkipType=1. With both settings I had 9 lost frames per minute after start of the stream.
Now I tested SkipType=2 which gave me 10 lost frames.

@ark-git

This comment has been minimized.

ark-git commented Aug 23, 2018

@nik0 This version has drastically improved the connection dropouts, however I still have intermittent freezes. I tried the 3 skips, 0 is the worst and 2 is the best.
The arrival of I&P frames are getting better now (skip2 is better than 1). See attached excel files.
Looking at the two attached ffmpeg capture errors it shows that with a skip of 1 it is showing more "non monotonically increasing dts" errors.
ffmpeg also shows errors below
[h264 @ 0000000000597140] reference picture missing during reorder
[h264 @ 0000000000597140] Missing reference picture, default is 22

test_tcp_SMART_33-ffdump_Errors_Skip1.txt
test_tcp_SMART_33-ffdump_Errors_Skip2.txt
test_tcp_SMART_33-ffdump_Skip1.xlsx
test_tcp_SMART_33-ffdump_Skip2.xlsx

@nik0

This comment has been minimized.

Collaborator

nik0 commented Aug 23, 2018

Do you have these errors when you have just ffmpg running ?
Can you try skip values 4-5-6 ?
Is it causing problems?

@ark-git

This comment has been minimized.

ark-git commented Aug 23, 2018

Do you have these errors when you have just ffmpg running ? The errors above is with BI running. I closed BI and reran with all the skip values and still see the errors.
Can you try skip values 4-5-6 ? I tried all three with the same results.
Is it causing problems? The missing frames causes pixellation in the images.
In one instance it would run for a few seconds without any errors, stop the test and rerun and then tons of errors in the same skip value. Not sure why.

@nik0

This comment has been minimized.

Collaborator

nik0 commented Aug 23, 2018

I saw that there are a lot of lost images
I don't know which parameter to use now. I tried a lot of combinaison ...

@ark-git

This comment has been minimized.

ark-git commented Aug 23, 2018

I noticed that using skip = 3, i get a few errors upfront when it first connects however the bit rate really goes down and the image is not clear. One thing that is good is there are no frames lost. Looking at the image though its not as sharp due to the bit rate being low.
test_tcp_SMART_28-ffdump_Errors_Skip3.txt

@nik

This comment has been minimized.

nik commented Aug 23, 2018

@nik0

This comment has been minimized.

Collaborator

nik0 commented Aug 23, 2018

Bitrate is OK for me. I, on purpose, set the bitrate value to 5000 to be sure to be not disturbed
I am around 1500 kbits/seconds and VLC show few lost images

@ark-git

This comment has been minimized.

ark-git commented Aug 24, 2018

With an overnight test of skipp=3 (seems to work better than others), I still get signal disconnects in BI. I checked VLC and still see drop frames and ffmpeg still reports "Application provided invalid, non monotonically increasing dts to muxer in stream".

@goermezer

This comment has been minimized.

goermezer commented Aug 24, 2018

@ark-git Did you have bad quality too with skip=3 at night? For me this setting is really unusable at night.

@ark-git

This comment has been minimized.

ark-git commented Aug 24, 2018

@goermezer I did not have bad quality, but I still have a lot of drop connections. VLC will play the stream for some time with a few drop frames, but the stream would stop after some time.

@goermezer

This comment has been minimized.

goermezer commented Aug 24, 2018

I have a similar issue with ffmpeg. After some time of recording ffmpeg hangs, throws a "CSeq 5 expected" and stops. Starting from the moment, where the CSeq error occurs, until ffmpeg really stops, the whole rtsp server stops too and doesn`t want to respond to further connection requests. This can take a couple of seconds. When ffmpeg has completely stopped, the rtsp server starts working again. This all only happens, when ffmpeg records with -rtsp_transport tcp. With udp it records forever, but with some dropped frames and a bit of smearing.

I hoped to get rid of this issue with the new version. But I suspect that it has to do with my Wifi access point. I have another camera (Xiaofang 1S), which does not show this behaviour. The difference between them is the access point. The latter one is served by a better one.

@nik0

This comment has been minimized.

Collaborator

nik0 commented Aug 25, 2018

Here is a new version, I am not very convinced (a GOP parameter was not set, but it didn't change something for me).
I installed BlueIris and it is working well with the repo version (I don't recall if there is a specific stuff to configure to reproduce your version)
v4l2rtspserver-master.zip

@ark-git

This comment has been minimized.

ark-git commented Aug 26, 2018

I tried this version and its still the same. VLC has drop frames and BI still has a bunch of disconnects. Going back to previous one.

@SomebodySysop

This comment has been minimized.

SomebodySysop commented Aug 27, 2018

I use ispy instead of blue iris, but I am having similar latency issues. Should I try this update? https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/files/2320818/v4l2rtspserver-master.zip

@chriscrowe

This comment has been minimized.

chriscrowe commented Sep 1, 2018

Did we get any consensus about the best setup to use here? The dropping RTSP issue is a full dealbreaker for me-- I have to restart the RTSP service basically every day to get the feed back up.

@SomebodySysop

This comment has been minimized.

SomebodySysop commented Sep 2, 2018

I use ispy as opposed to blue iris. I installed the last v4l2rtpserver-master posted here. Using quality=2 and skiptype=2. There are dropped fames, but overall, rtsp stream has been fairly consistent with no re-starts required so far -- after 3 days. The biggest issue I have are these "hiccups" that occur occasionally. I do not know if it is because of rtsp, movement the camera records, or movement of camera (my mount is not the most stable). Waiting for replacement mount to check.

Since I do not have the same problem at night, my guess is there is something about movement during day. But, again, overall, rtsp stream appears to work fairly consistently.

stream hiccup

@ark-git

This comment has been minimized.

ark-git commented Sep 2, 2018

I am using the "v4l2rtspserver-master.zip" that nik0 posted 8 days ago (Skip =3; Quality = 2). This seems to be most stable. The Wyze's are set to 1920x1080; 15fps; VBR; 5000kbps. I still have about 300 drops signals a day. I have a script running every night to reboot both the Wyze Cam v2 cameras. The stream according to Blue Iris is better with the frame rates and key frames however I am not sure why there are still disconnects. See picture attached for Blue Iris settings.

image

@sergeymaysak

This comment has been minimized.

sergeymaysak commented Oct 11, 2018

I have similar issue with Synology SS 8.1 and Wyze cam v2. Basically SS loses and resumes connection to camera just every several minutes.
I've tried "v4l2rtspserver-master.zip" that @nik0 posted on Aug 25 - basically copied it to bin folder along with provided ini file. Modified ini to have (Skip =3; Quality = 2). Moved to sdcard and restart ed camera...
"Unable to load image." is on home page of web interface.
video server log says:
RTCPInstance::RTCPInstance error: totSessionBW parameter should not be zero!
RTCPInstance::RTCPInstance error: totSessionBW parameter should not be zero!
RTCPInstance::RTCPInstance error: totSessionBW parameter should not be zero!

I use rtsp, 1600x900 15 fps 100k CBR.
Returned back to previously used v4l2rtspserver-master ...

@Swap-File

This comment has been minimized.

Swap-File commented Oct 18, 2018

I'm seeing similar problems with dropping of frames every few seconds via rtsp w/ h264 video w/ Milestone xProtect with the current master release of Dafang-Hacks. I only have V2 cams to test with, but all 8 that I have behave similarly, on different wireless APs and in different locations. It happens the most during the day, with cameras that are pointed outside. Cameras that are pointed inside have much less of a problem (drops every minute versus every second), but it still happens. It seems to have something to do with the complexity of the scene? Lower resolutions and bitrates seem to help, but I'm still trying to pinpoint what causes it. I tried a bunch of different versions of Dafang-Hacks, currently going to try the file nik0 posted.

@Swap-File

This comment has been minimized.

Swap-File commented Oct 19, 2018

Everything seems to be working great for me on my Wyze V2 with nik0's files! Any chance of getting nik0's changes into master, potentially with a box to configure skip on the fly? What changes are actually in there?

@SomebodySysop

This comment has been minimized.

SomebodySysop commented Oct 24, 2018

As a follow up: I am using latest build, which seems to have improved things. I noted in log that system looks for v4l2rtspserver-master .ini on boot, which would indicate that nik0's change is already included?

Using Wzye V2 and Xiaofang 1S cameras. SkipType=2, Quality=1

I finally tried FixedQp (fps=15, bitrate=5000, videosize=1600x900). Audio and motion detection turned off. This is giving me the best overall performance I have seen so far. Fewer disconnects, less pixelation and just more consistent video streaming in general.

This is during the day. Still need to test it at night, but so far I am very pleased with results.

Edit: Want to mention that I'm using iSpy Agent.

@ark-git

This comment has been minimized.

ark-git commented Oct 25, 2018

I tried updating to the latest, using @SomebodySysop settings however I get very bad pixellation on the streams. Reverting back to "v4l2rtspserver-master.zip" that nik0 posted on Aug 23 (Skip =3; Quality = 2). This seems to be most stable. The Wyze's are set to 1920x1080; 15fps; VBR; 5000kbps. I still have about 150 drops signals a day but the streams are very stable. I reboot the Cams every night.

@FuzzyMistborn

This comment has been minimized.

FuzzyMistborn commented Oct 28, 2018

I'm still having tons of issues with this. I've tried Nik's latest rtspserver from Aug 23 with Skip 3 and Quality 2, but still having tons of disconnects in Blue Iris. I've had a stream going in VLC just fine for 10 minutes and while it's jumpy at times it never looses the connection. Anybody have any tips?

EDIT: Just to update, I've tried iSpy and the cameras all work just fine there so there's something in BlueIris that's going on. 2 cams work just fine, I add a third and things start to get wonky, a 4th is just constant drops all over.

@FuzzyMistborn

This comment has been minimized.

FuzzyMistborn commented Oct 30, 2018

Ok managed to get them working (switched to SMART on video and also realized I had some local interference I was dealing with). Anybody managed to get audio working in Blue Iris?

@TheCloudlessSky

This comment has been minimized.

TheCloudlessSky commented Dec 3, 2018

@nik0 I've replaced the existing v4l2rtspserver-master with the binary you posted to try and fix disconnects with iSpy. However, I'm getting really bad quality. When rebooted, here's how the binary is launched:

/system/sdcard/bin/v4l2rtspserver-master -W1280 -H720 -E MP3:16000:44100 -r 2 -P 8554

Here's my rtspserver.conf:

PORT=8554

# H264 RTSP server options
# Examples:
# RTSPH264OPTS="-W960 -H540"
# To enable authentication:
# RTSPH264OPTS="-U user:password"
RTSPH264OPTS="-W1280 -H720"

# MJPEG RTSP server options
# Examples:
# RTSPMJPEGOPTS="-W960 -H540"
# To enable authentication:
# RTSPMJPEGOPTS="-U user:password"
RTSPMJPEGOPTS="-W1280 -H720"

# Video
BITRATE=5000
# Framerate
FRAMERATE_DEN=1
FRAMERATE_NUM=25
# Video format: (0 = FixedQp, 1 = CBR, 2 = VBR, 3 = SMART, default = 2)
VIDEOFORMAT=2

# AudioFormat
# Can be: OPUS | MP3 | PCM | PCMU
AUDIOFORMAT=MP3
# Audio sampling rate
AUDIOINBR=16000
# Audio streaming sampling rate
AUDIOOUTBR=44100
HWVOLUME=120
SWVOLUME=-1
FILTER=0
HIGHPASSFILTER=false
AECFILTER=true
USERNAME=
USERPASSWORD=

What's weird is that if I switch the binary back to the old one, the quality is good again. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment