EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

XiaoFang streaming well to Win10-PC but not to Android #566

Closed Tramsrepus closed 5 years ago

Tramsrepus commented 6 years ago

Hi,

Have a few local XiaoFang here at home but the streams drops off 1-3 times a minute on all my Android devices but not on PC. How is it fixed? Everything is tested on the same local network.

1, The streams are lost in the same way on 3 different Android devices V.8 (on Galaxy 8+) and V.6 (TV box) plus on my Android TV and BlueStack runnig on a win 10 PC. All RTSP apps I've tested on Android have the same problem including VLC for Androids.

2, The same video streams works perfectly on VLC and other programs on the PC

3, IF I run BlueStack AND VLC simultaneously on PC'n, ONLY THEN VLC (for PC) gets problems. The PC is 5000 usd bad ass 3D CAD workstation, so hardware performance are not likely to be.

4, I hear the sound from the camera microphone even though the video stream is broken.

5, If I start the Android, the video stream works well for a few minutes and then gradually get more o more issues.

6, Same video stream, running at the same time, on different devices, are dropping at different times.

7, I have even tested it on my friends home WIFI but with same issues.

Is there any setting in Android that i have missed????? PLEASE HELP

Tramsrepus commented 6 years ago

I have tried 8-10 different RTSP-apps incl a TinyCam Pro that i bought a few days ago.

Tramsrepus commented 6 years ago

Running fanghacks_v0.2.0. in the cameras

saipsa commented 6 years ago

Try to lower the resolution of camera. Not all phones can keep up with the decoding.

Tramsrepus commented 6 years ago

Hi Saipsa. I have tried that but it does not matter if i run 4 or 1 cam. When it works well is streams 25 FPS on all cameras at 1080P.

saipsa commented 6 years ago

Yep, you are right, I am also facing this issue.

Tramsrepus commented 6 years ago

So most should have this problem then? It is probably a glitch in the latest hack. I have bough 5 cameras in total now so there is not turning back. They seems to work fine on PC so will probably buy Blue Iris and run it on a PC.

Dopeyr commented 6 years ago

I had/have a similar issue - the key for me was reducing the bitrate to ~1200 and using SMART (not sure if the latter helped that much, but reducing the bitrate definitely did).

It does still occasionally drop in tinycam though, but before that it would drop all the time.

I had/have the same symptoms though - the stream in VLC (edit: on PC) is stable.

Tramsrepus commented 6 years ago

Dopeyr. Did you had a stable stream in VLC for Android or PC? I could never get a steady stream om VLC for Android.

Dopeyr commented 6 years ago

It is stable on PC, I've not tried it on android.

Tramsrepus commented 6 years ago

Are the developers aware about this do you think?

Dopeyr commented 6 years ago

Personally I haven't reported it, as i was unsure if it was 1) my phone, 2) my wifi, 3) the app (tinycam pro) or 4) something else, and I find the lower bitrate acceptable for me.

It would be be good to get to the bottom of though and I'm glad someone else is seeing the same!

Edit: I'm running VLC on android at the moment to see if I get the same drops I see in tinycam.

Darkblade48 commented 6 years ago

@Tramsrepus Just to clarify, are you running fanghacks or Dafanghacks? There's a separate repository for the former, and Dafang hacks (this repository) is only for the newer Xiaofang 1S

Tramsrepus commented 6 years ago

@Darkblade48 : Hi i am newbie on this. I am using fanghacks_v0.2.0 on my Xiaofang 1S (1080P). Should i have done any differently?

Darkblade48 commented 6 years ago

@Tramsrepus From what I can understand, people were having trouble using the fanghacks_v0.2.0 repository on the newer 1S. That repository also does not explicitly say that it works for the newer 1S (which uses a different sensor).

This repository explicitly states that it will work for the 1S and Dafang, so use this repository instead. I, and several others, have verified it works for a 1S

Tramsrepus commented 6 years ago

@Darkblade48 Can you point me to one that does work and not too complicated to install? Thanks

hyteoo commented 6 years ago

This seems like an issue I opened - 578 @EliasKotlyar maybe you can close that one

Here's the rundown and some log data:

Sometimes after moving the camera (either on X or Y axis), even by 1 increment, the video stream stops. It then resumes after a few seconds. Looking through the logs, I only get this in the v4l2rtspserver-master.log:

2018-07-16 10:14:04.141 ( 516.216s) [ivsMoveDetection] ImpEncoder.cpp:571 0| Will execute command /system/sdcard/scripts/detectionOn.sh 2018-07-16 10:14:04.183 ( 516.258s) [ivsMoveDetection] ImpEncoder.cpp:573 0| Execute /system/sdcard/scripts/detectionOn.sh returned:0 2018-07-16 10:14:04.184 ( 516.259s) [ivsMoveDetection] ImpEncoder.cpp:765 0| Detect !! 2018-07-16 10:14:06.333 ( 518.408s) [ivsMoveDetection] ImpEncoder.cpp:571 0| Will execute command /system/sdcard/scripts/detectionOff.sh 2018-07-16 10:14:06.375 ( 518.450s) [ivsMoveDetection] ImpEncoder.cpp:573 0| Execute /system/sdcard/scripts/detectionOff.sh returned:0 2018-07-16 10:14:46.266 ( 558.341s) [main thread ] DeviceSource.cpp:110 0| V4L2DeviceSource::doStopGettingFrames 2018-07-16 10:14:46.266 ( 558.341s) [main thread ] DeviceSource.cpp:110 0| V4L2DeviceSource::doStopGettingFrames 2018-07-16 10:15:06.018 ( 578.093s) [main thread ]ServerMediaSubsession.c:25 0| Creating Source... 2018-07-16 10:15:06.018 ( 578.093s) [main thread ]ServerMediaSubsession.c:29 0| Creating H264 Source... 2018-07-16 10:15:06.019 ( 578.093s) [main thread ]ServerMediaSubsession.c:51 0| Creating Sink for format : video/H264

This happened with the original bootloader and also the custom 1.2 version. Update: this only seems to happen in TinyCamPro, and not always when moving the camera (on a Galaxy S7 so I'm sure the phone can keep up with a 1080p 25fps stream) VLC works fine. Sometimes it just drops off, sometimes it drops when drivind a X or Y motor.

Darkblade48 commented 6 years ago

@Tramsrepus

This repository that you are posting in works fine for the Xiaofang 1S, as previously mentioned

hyteoo commented 6 years ago

Some more log entries while the stream drops randomly without any intervention:

2018-07-17 14:06:04.780 (100836.855s) [main thread ]ServerMediaSubsession.c:25 0|Creating Source... 2018-07-17 14:06:04.781 (100836.855s) [main thread ]ServerMediaSubsession.c:29 0|Creating H264 Source... 2018-07-17 14:06:04.781 (100836.856s) [main thread ]ServerMediaSubsession.c:51 0|Creating Sink for format : video/H264 2018-07-17 14:07:05.776 (100897.850s) [main thread ] DeviceSource.cpp:110 0|V4L2DeviceSource::doStopGettingFrames 2018-07-17 14:07:05.776 (100897.851s) [main thread ] DeviceSource.cpp:110 0|V4L2DeviceSource::doStopGettingFrames 2018-07-17 14:07:06.068 (100898.142s) [main thread ]ServerMediaSubsession.c:25 0|Creating Source... 2018-07-17 14:07:06.068 (100898.143s) [main thread ]ServerMediaSubsession.c:29 0|Creating H264 Source... 2018-07-17 14:07:06.068 (100898.143s) [main thread ]ServerMediaSubsession.c:51 0|Creating Sink for format : video/H264 2018-07-17 14:07:19.411 (100911.486s) [main thread ] DeviceSource.cpp:110 0|V4L2DeviceSource::doStopGettingFrames 2018-07-17 14:07:19.411 (100911.486s) [main thread ] DeviceSource.cpp:110 0|V4L2DeviceSource::doStopGettingFrames 2018-07-17 14:07:30.106 (100922.180s) [main thread ]ServerMediaSubsession.c:25 0|Creating Source... 2018-07-17 14:07:30.106 (100922.181s) [main thread ]ServerMediaSubsession.c:29 0|Creating H264 Source... 2018-07-17 14:07:30.106 (100922.181s) [main thread ]ServerMediaSubsession.c:51 0|Creating Sink for format : video/H264

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.

Huynh-Tr commented 3 years ago

Could I ask how to watch on Laptop?

Darkblade48 commented 3 years ago

Could I ask how to watch on Laptop?

You can just use any software that can open an RTSP stream (such as VLC)

Huynh-Tr commented 3 years ago

Could I ask how to watch on Laptop?

You can just use any software that can open an RTSP stream (such as VLC)

Thanks for replying,

And I want to ask how to get link from MiHome app to open in VLC?

Darkblade48 commented 3 years ago

And I want to ask how to get link from MiHome app to open in VLC?

I am a bit confused. The whole point of this repository is to free oneself from having to use the MiHome app. If you want to use the MiHome app, you don't need this custom firmware, and vice versa.