czietz / wifimicroscope

22 stars 5 forks source link

Framerate a bit low and connection is unstable. #3

Closed TheCrazyT closed 4 years ago

TheCrazyT commented 4 years ago

Not shure if it is because of the error-handling, but the framerate seems to be a bit low.

I modified the code to show a "live" image without storing the frames as files: https://gist.github.com/TheCrazyT/364ff5d6e893905af9d950f70daa2f29

Another problem is that everything just stops at some time.

Sadly I'm using a slightly different model, not shure if it could have an impact. Compared to the "DM Wifi" app on my android smartphone the framerate seems to be faster.

Maybe I'm just missing an additional command for resolution or something like that?

Edit: Solved by myself. Beside some checks about buffersize the "frombuffer"-method needed dtype="uint8". Will update the script in the url above.

TheCrazyT commented 4 years ago

About "connection is unstable": maybe it is missing a "heartbeat". Atleast inside the lib there is a function called "F_SentRTPHeartBeep":

https://github.com/aivenlau/JH-Libary_N_FFMPEG/blob/f61ec630330918ba2ea16aaed8e0c88f54901d8f/JH-Libary/JH_WifiCamera.m#L6710

Edit: Also wonder if it is possible to use a tool called "vlc" to receive the video. It would be much easier if it would be possible (for example for recording small videos etc.). Of course i already tried using it, but for some reason I only see a loading bar.

Edit again: Alright, although the call their functions "RTP" the raw data clearly isn't the RTP-protocol, sadly. Its probaby something self-defined protocol.(although something inside me still hopes its some other sort of protocol that can be used with other programs)

czietz commented 4 years ago

Sounds promising. If you add the "heartbeat" to your code, please keep me updated if it solves the instability of the connection.

TheCrazyT commented 4 years ago

@czietz I added "F_SentRTPHeartBeep" to my script, and it already solved the disconnection problem for me.

I still have a small problem with artifacts, but i guess that the result buffer is not allways full during receive(you only give it a maximal buffer size at that location). But that problem happens not so often, it is ignorable for now.