quatanium / python-onvif

ONVIF Client Implementation in Python
MIT License
472 stars 321 forks source link

Retrieve - Download video recordings files from microsd card #73

Open braian87b opened 5 years ago

braian87b commented 5 years ago

Hi, I have several Onvif cameras that uses yoosee and v380/v380s android apps, I want to know if there is some way to download the files from the microsd using python on the LAN.

Since it is possible to do using the android app, It should be possible in some way using a python script.

Thanks.

thomaselemy commented 5 years ago

Were you able to figure this out? I need to implement this as well as only a windows program can access the camera and the micro sd card on the camera is not recognized by any operating systems.

braian87b commented 5 years ago

Yes, but the FishEye camera that uses v380/v380s is too shitty in other aspects so now I use another one. The yoosee camera was good, but I also discarded it.

I was able to get the files using FTP for the fisheye one... this hack probably works for all models here: https://www.google.com/search?q=v380+fisheye+camera&tbm=isch

Steps:

You should email to v380technical---@---gmail.com / minlai921915897---@---gmail.com ( developers of V380 / V380s Android Apps) .

With System, firmware and kernel versions, and asking them to sent you necessary files to enable RTSP for using the camera with your NVR.

There is more about upgrades info here: https://community.netcamstudio.com/t/fentac-v380-connection/1334 but DO NOT deal with changing the DEBUG variable, and DO NOT loose your time seeing the SDK. You just could brick your camera or loose your time if you do so. And just in case, DO NOT use upgrade files of other user, unless it has the same kernel, firmware and system versions (in that case it may work)

The patch that they will give to you can be modified, but you should balance the editing so the filesize is the exact same (you could delete some chars from line separators on the file). Later you should get the md5 of the file and replace on other file.

This is what I done to my patch file:

editings

That will enable you to get telnet on the first attempt to upgrade, (if you restart you should put again the upgrade on the SD card in order to get telnet working again, so keep reading)...

Now on the upgrade boot is when you should connect using telnet you should use telnet to edit some scripts, and put there necessary commands to enable telnet always at boot, and enable FTP always at boot., you could ommit to enable ftp at boot enable it each time using a shell/python script when you need to copy the recordings and put it off when you finish... even better, you could have a crontab to restart the camera at 0:00 hs and run your script on your nas/server to connect at that time using telnet, enable ftp, perform the copy of the new recordings, and later disable the ftp and telnet until next reboot of the camera that is even better.

There is no way to have telnet or ftp WITH password, both are password-less, at least I didn't know, but if you have your network protected or separate network you shouldn't have any problems.

The file to be edited has as name and md5 has and .patch extension. later, get the md5 hash of that file, rename it as that new md5 hash preserving the .patch extension and put that new md5 hash on local_update.conf file

These are the commands to use on telnet:

This script run at boot ( the >> means append to file) so this below lines will be appended to that script. you should un comment the inetd line in order to boot with ftp enabled.

cat<<'EOF' >> /mnt/mtd/nvipcstart.sh

if [ "$debug" == "0" ]
then
        telnetd -l /bin/sh &
        # inetd -fe /mnt/mtd/inetd.conf
fi
EOF

This configures and ftp daemon, this only allows ftp to be able to run, but does not run it by itself:

cat<<'EOF' >> /mnt/mtd/inetd.conf
21 stream tcp nowait root ftpd ftpd /mnt/
EOF

To verify added line:

cat /mnt/mtd/inetd.conf

This executes ftpd, it runs as daemon, background (run this command on telnet to enable it):

inetd -fe /mnt/mtd/inetd.conf
braian87b commented 5 years ago

I can help to write a python script to do the telnet connect, and get the files if you need to have it, but it seems that there is almost no others users in need of this thing and I had little time this days so probably It will cost you a beer.

thomaselemy commented 5 years ago

Yeah it would be great if you could help. This is the camera im currently using https://www.aliexpress.com/item/32918038983.html?spm=a2g0s.12269583.0.0.7053676022HeA9. there is not really any documentation on it but i was able to determine its derived from the Escam QF001 camera.

thomaselemy commented 5 years ago

I did talk to the manufacture and my model camera does not support ftp connections for security reasons so the above wont work for me.

braian87b commented 5 years ago

Do it anyway, copy here the system, firmware, kernel versions and will try to get the firmware patch for you...

In the upgrade patch they just will enable RTSP (h264 audio-video stream) handy to use it with Android generic App like Onvifer, VLC on Windows or to record stream to a NVR/XVR ...

In order to have telnet and ftp (to get the records from the microsd card YOU must edit the files to have it... (they do not give support for those features since the telnetd/ftpd of busybox that comes on the firmware does not have login (minimal security) capabilities.

braian87b commented 5 years ago

Sorry I didn't see the camera pictures...

https://www.aliexpress.com/item/32918038983.html?spm=a2g0s.12269583.0.0.7053676022HeA9. That camera works with V380 / V380s app ?

nice development camera... do you have any interesting comments on that camera? if you need more info on that camera you may have more luck searching for the SoC model "hi3516"

If you are "developing" something, you should ask for the SDK and for telnet, later you could use the SDK to put a dropbear (to have SSH instead of the busybox insecure/no-password telnet)... that should be easy to do... with dropbear you could transfer files using SCP(ssh) and you could compile some little ftp daemon like vsftpd for that SoC.

you probably have to copy the files to the microsd or wget them from an webserver somewhere.