Upload to FTP on Motion Detection? DS-2CD2432F-IW

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
I've got a DS-2CD2432F-IW that I'd like to upload an image on motion detection to my FTP. I know that my FTP configuration is working as I was able to test it successfully (the directory got created and the test file put on the filesystem). My problem is that I've got "Upload to FTP" checked on my Basic Event, and I don't ever get an image uploaded to my FTP. Am I missing something? I know for a fact that motion detection is happening because my Synology NAS is sending me a push notification of the activity.

Thanks!
 

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
bump - is nobody is using hikvision cameras in this manner? Maybe there is a better way to get what I want to achieve - is there any way to perform an HTTP post or something on motion detection? If I could get a hikvision to do that, then I could handle the logic elsewhere (on a raspberry pi or something...)

Thanks!
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
I ran into the same thing just a few hours ago. The annoying this is that it also crashes the hikvision. It was 100% stable before I activated the FTP option...
 

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
I ran into the same thing just a few hours ago. The annoying this is that it also crashes the hikvision. It was 100% stable before I activated the FTP option...
Wow, that is even more annoying than not getting an image at all.... What model camera do you have and what software version? I've got 3 different models, all gray market, so I don't think I can update the firmware on them.
I think as a workaround, I'm just going to wire up actual outdoor PIR's and hook them up to my automation system to have them handle motion detection
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
Wow, that is even more annoying than not getting an image at all.... What model camera do you have and what software version? I've got 3 different models, all gray market, so I don't think I can update the firmware on them.
I think as a workaround, I'm just going to wire up actual outdoor PIR's and hook them up to my automation system to have them handle motion detection
I paid around 50 bucks extra to get a white market version, it's a model DS-2CD2032-I and firmware V5.3.0 build 150814. I noticed that if I activated the snapshot option, it actually works (the FTPing) but I had one crash so far.... Now one day stable.
Hopefully a firmware update will make it 100% stable again.
 

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
Good to know, thank you! How reliable is your motion detection? Are you getting many false alarms?
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
I get the occasional cat in my email, I don't really look so much at the movies that are recorded. I'll probably do that more if I see something suspicious, when someone is crossing the virtual border. I investigated the FTP upload option since I got fed up opening my email client to see the three pictures. So now I am building a small tool that monitors the ftp upload folder and sends me a telegram (whatsapp alternative) message with the three pictures included.
 

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
I get the occasional cat in my email, I don't really look so much at the movies that are recorded. I'll probably do that more if I see something suspicious, when someone is crossing the virtual border. I investigated the FTP upload option since I got fed up opening my email client to see the three pictures. So now I am building a small tool that monitors the ftp upload folder and sends me a telegram (whatsapp alternative) message with the three pictures included.

I've already built something like this in bash. It runs on my raspberry pi. I haven't tested it extensively (because I can't get this **** upload to FTP to work), but it does work though, then sends me a pushbullet notification on my android device. Not sure what you were planning to run your tool on, but if you'd like, I can attach it here.
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
I've already built something like this in bash. It runs on my raspberry pi. I haven't tested it extensively (because I can't get this **** upload to FTP to work), but it does work though, then sends me a pushbullet notification on my android device. Not sure what you were planning to run your tool on, but if you'd like, I can attach it here.
That sounds nice, what's the basis of your message system? Telegram?
I'm almost done with the code (in python btw) but am interested in hearing other solutions. Did you enable snapshot already on your camera?
 

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
I am using a bash implementation of PushBullet for notifications. These push directly to my phone. Keep in mind that script is rough, and took me roughly 20 minutes to setup. There are probably a million different ways to write this more efficiently than I have written it, I just wanted to POC the idea and test it out.

Code:
#!/bin/bash
# Notes: This script runs in an infinite loop.  It watches the $TMP directory for changes by tar'ing it up
#       and checking the md5sum. It will then wait a specified time check the TMP dir again. If a change
#       is detected, it'll send out the most recently modified file. It requires PushBullet be setup 
#       and working for notifications.  See below for details
# Req Files: $PB is a bash interface for PushBullet, found here: https://github.com/Red5d/pushbullet-bash
#


####################################################################
TMP=/home/pi/tmp
PB=/home/pi/scripts/pb.sh


check() {
    fil=$(basename $TMP)
    tar cvf $fil.tar $TMP &> /dev/null
    chsum1=`md5sum $fil.tar | awk '{ print $1 }'`
    chsum2=$chsum1


    while [ $chsum1 == $chsum2 ]
    do
        sleep 10
        tar cvf $fil.tar $TMP &> /dev/null
        chsum2=`md5sum $fil.tar | awk '{ print $1 }'`
    done
    # folder md5 didnt match, push the file and re-execute the check()
    # echo "Found a new file!"
    NEW_FIL=$(ls -tp $TMP | grep -v /$ | head -1)
    $PB push all file $TMP/$NEW_FIL
    check
}


check #$*
####################################################################
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
When you've finished your python code - would you mind posting it?
No problem. Your code is pretty lean, mine is a big bigger but it's also an POC, just grabbed some sample python code from internet and adjusted it:

Code:
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler




class MyHandler(PatternMatchingEventHandler):
    patterns=["*.jpg"]


    def process(self, event):
        """
        event.event_type
            'modified' | 'created' | 'moved' | 'deleted'
        event.is_directory
            True | False
        event.src_path
            path/to/observed/file
        """
    def on_modified(self, event):
        #print event.src_path, event.event_type  # print now only for debug
root@ubuntu:/opt/tg/script# more start_monitoring
FOLDER=/mnt/usb/cam1/uploads


python monitor_folder.py $FOLDER
root@ubuntu:/opt/tg/script# more monitor_folder.py
# http://brunorocha.org/python/watching-a-directory-for-file-changes-with-python.html
import os
import sys
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler




class MyHandler(PatternMatchingEventHandler):
    patterns=["*.jpg"]


    def process(self, event):
        """
        event.event_type
            'modified' | 'created' | 'moved' | 'deleted'
        event.is_directory
            True | False
        event.src_path
            path/to/observed/file
        """
    def on_modified(self, event):
        #print event.src_path, event.event_type  # print now only for debug
        # /volume1/camera_ftp/cam1/uploads/10.0.0.200_01_20160123205259698_LINE_CROSSING_DETECTION.jpg modified
        path = event.src_path
        command = "/opt/tg/bin/telegram-cli -k /opt/tg/bin/tg-server.pub -W -e \"send_photo poweruser " + path + "\""
        os.system(command)
        print command
        self.process(event)


    def on_created(self, event):
        self.process(event)




if __name__ == '__main__':
    args = sys.argv[1:]
    observer = Observer()
    observer.schedule(MyHandler(), path=args[0] if args else '.')
    observer.start()


    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()


    observer.join()
Btw, that pushbullet looks pretty cool. But is it able to push pictures as well? I can send the pictures directly to my telegram chat and they show up directly in the chat. I used this tutorial for setting up the telegram app on my ubuntu server (but the tutorial is focused on the pi)

http://www.home-automation-community.com/telegram-messenger-on-the-raspberry-pi/
 

jon102034050

Young grasshopper
Joined
Dec 10, 2015
Messages
31
Reaction score
4
PushBullet is able to send text or pictures as notifications. It sounds very similar to Telegram in that sense. Telegram seems to tout itself on their encryption used, with is cool. I'm going to look into it a bit more to see if I like it better. Thanks!!
 

steve457

Getting the hang of it
Joined
Jan 7, 2016
Messages
113
Reaction score
37
Location
USA
Were you ever able to get an image FTP'ed on motion detection? I'm having the same issue when trying to send an image using line crossing detection. I'm also on the 5.3.0 firmware with a genuine U.S. (rebranded) version.
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
Were you ever able to get an image FTP'ed on motion detection? I'm having the same issue when trying to send an image using line crossing detection. I'm also on the 5.3.0 firmware with a genuine U.S. (rebranded) version.
Hi yes I am now able to use FTP on the smart even Line crossing detection. I am not using it for the basic event motion detection, that will probably generate too many false positives. Did you enable snapshot on your camera? If you succeed, let me know if you experience any stability issues. I have to manually reboot the machine every few days since it's not longer stable anymore. I created a new thread : https://www.ipcamtalk.com/showthread.php/8553-Stability-of-device-when-FTP-functionality-is-enabled?highlight=FTP
 

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
I have FTP on motion on three cameras running 5.2.0. Brief settings I have as I go through config are:

Advanced > events > Motion Detection tab I have check on enable motion detection and check on enable dynamic analysis for motion On same tab I have arming schedule set for 24/7 with Upload to FTP checked

I do not have line crossing or intrusion detection enabled

In advanced > stroage > snapshot I also have checked enable event triggered snapshot. I believe it is this plus the FTP check under motion detection that combine to actually FTP the image

And of course under advanced > network > FTP I have the FTP server set with checked upload picture.

-----

FTP just simply didn't work properly prior to 5.2.0 despite settings in the firmware that pretended it it. It's entirely possible the developers at hikvision screwed it up after 5.2.0. I don't think they are particularly good at their jobs to be honest.

For what it's worth I have three 3 MP cameras doing this and they've been extremely stable for over a year now. One of them is on my porch and only fires a hundred images a day or less basically when we are walking by. The one pointing on my driveway and back yard are cranking out with high regularity and a ton of false positives, but I am okay with false positives (better than false negatives). Motion detection works really nicely on the porch because it isn't looking at much yard that has shadows moving and things like that.
 

steve457

Getting the hang of it
Joined
Jan 7, 2016
Messages
113
Reaction score
37
Location
USA
In advanced > stroage > snapshot I also have checked enable event triggered snapshot. I believe it is this plus the FTP check under motion detection that combine to actually FTP the image
That is definitely the key setting. Without that option checked no images are captured and nothing is sent. Once I enabled that setting FTP works fine. I'm running on 5.3.0 and 5.3.6 firmware on a 4mp mini-dome (DS-2CD2542FWD) and 4mp turret camera (DS-2CD2342WD). I have not noticed any stability issues so far, but I only have had FTP running for 2 days now.

I also was able to get a script running using the Python-watchdog library as per an earlier recommendation and it is working great. As soon as a new file appears I have the script call push bullet and get an instant alert on my phone and computer.
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
That is definitely the key setting. Without that option checked no images are captured and nothing is sent. Once I enabled that setting FTP works fine. I'm running on 5.3.0 and 5.3.6 firmware on a 4mp mini-dome (DS-2CD2542FWD) and 4mp turret camera (DS-2CD2342WD). I have not noticed any stability issues so far, but I only have had FTP running for 2 days now.

I also was able to get a script running using the Python-watchdog library as per an earlier recommendation and it is working great. As soon as a new file appears I have the script call push bullet and get an instant alert on my phone and computer.
Yes the python watchdog works perfectly. I will now test the powerline connection to my garage and see if that is the culprit instead of the camera...
 

haizman

n3wb
Joined
May 30, 2016
Messages
2
Reaction score
0
I just purchased the DS-2CD2432F-IW with the intention of uploading to FTP, but so far nothing is being written. I am on firmware V5.4.0 build 150513.

I've tried PIR detection, which works as expected when selecting "Audible Warning" as the alarm siren goes off, but "Upload to FTP" is not working. I"m wondering if an SD card is required for this functionality?

Options selected so far are -

Network>FTP>Upload Picture checked (Test button is working and test file is written to FTP share)
Basic Event>Enable Motion Detection checked (also tried Enable Dynamic Analysis for Motion checked)
Basic Event>Arming Schedule 0:00 to 24:00 (blue)
Basic Event>Linkage Method>Upload to FTP checked
Other Alarm>Enable PIR Alarm
Other Alarm>Normal Linkage>Upload to FTP checked
Storage>Snapshot>Event-Triggered Snapshot checked

Ideally it would be nice to record video and/or JPEG to FTP on PIR alarm (my "private cloud" solution instead of paying for a dropcam type service), but not sure if this is the right product for that. I tried playing around with Storage>NAS section, and was able to successfully add my Unraid server IP and file path, but under Storage>Storage Management it shows the share as "Uninitialized", and I am too chicken to click the Format button for fear of wiping out the disk.

Any thoughts or tricks would be appreciated! Thanks!
 

poweruser

Young grasshopper
Joined
Nov 27, 2015
Messages
36
Reaction score
1
I just purchased the DS-2CD2432F-IW with the intention of uploading to FTP, but so far nothing is being written. I am on firmware V5.4.0 build 150513.

I've tried PIR detection, which works as expected when selecting "Audible Warning" as the alarm siren goes off, but "Upload to FTP" is not working. I"m wondering if an SD card is required for this functionality?

Options selected so far are -

Network>FTP>Upload Picture checked (Test button is working and test file is written to FTP share)
Basic Event>Enable Motion Detection checked (also tried Enable Dynamic Analysis for Motion checked)
Basic Event>Arming Schedule 0:00 to 24:00 (blue)
Basic Event>Linkage Method>Upload to FTP checked
Other Alarm>Enable PIR Alarm
Other Alarm>Normal Linkage>Upload to FTP checked
Storage>Snapshot>Event-Triggered Snapshot checked

Ideally it would be nice to record video and/or JPEG to FTP on PIR alarm (my "private cloud" solution instead of paying for a dropcam type service), but not sure if this is the right product for that. I tried playing around with Storage>NAS section, and was able to successfully add my Unraid server IP and file path, but under Storage>Storage Management it shows the share as "Uninitialized", and I am too chicken to click the Format button for fear of wiping out the disk.

Any thoughts or tricks would be appreciated! Thanks!

Hi, sorry, reply was in junk mail. Everything works fine @ my end, so I don't come here much often. Did you specify the share on your unraid server as a specific shared folder? I'd make sure that you make something like that with a specific user/pass combi that has limited access right (to ease your mind). After that you should format the disc, otherwise recording videos wont work. It works really well after that, I never have to erase stuff, the cam makes sure that only take the space that is assigned and erase stuff if necessary.
Perhaps after that FTP uploading works as well. You can check by also using the email alerts. I get my images via Telegram but also in the mail as a backup which is nice.
 
Top