How to get FTP to overwrite picture name each time?

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,680
Reaction score
14,041
Location
USA
Your Core 2 Duo scores 1122 or 1313 points on cpubenchmark.net depending on which CPU model it happens to be. This is about where entry-level mobile devices score. But those mobile devices all have solid state storage, making them feel faster.

The $200 ThinkCentre with the Pentium G2020, linked by Fenderman, scores 2771.

Haswell i3 CPUs range from 4800 to 5600 points, and these are the minimum that I can honestly recommend to anyone looking for a desktop system.

I agree, an SSD for the operating system and commonly-run apps would go a very long way to improving the apparent speed. But for anything CPU-limited, such as video playback, the SSD is not going to help at all.
 
Joined
Nov 11, 2014
Messages
16
Reaction score
0
Thanks for the help Fenderman! I just ordered the Intel SSD that you suggested. Appreciate the help!
 
Joined
Nov 11, 2014
Messages
16
Reaction score
0
Overall what I am trying to accomplish here is to upload my personal weather station data and a webcam shot every 20 minutes to my web server. My weather station is in a remote area and has its own broadband link already set up and running. So once I get the script running then I will bet all set. I think in the future what I will do is custom build a small solid state pc dedicated just to the weather station similar to this http://www.amazon.com/CompuLab-fit-PC2-2GHz-Atom-Z550/dp/B004KUWTFA/ref=sr_1_1?ie=UTF8&qid=1415979839&sr=8-1&keywords=compulab+fit-pc2. It would need very minimal processing power and capacity. That way it runs all the time unnoticed with minimal power consumption. You can build these way more reasonable than the Amazon version by the way.
 
As an Amazon Associate IPCamTalk earns from qualifying purchases.

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,680
Reaction score
14,041
Location
USA
For a little PC, http://www.amazon.com/dp/B00HVKLSVC this Intel NUC is a fantastic value. You just add RAM, SSD, and operating system, and you have a complete computer roughly equivalent in speed to your Core 2 Duo, but very tiny and about 10 watts of power consumption.

I have an older version of this, which I use for a lot of little services that are not CPU intensive. Periodic image uploads, weather data logging, NTP (time server). It is tiny and silent and I love it.
 
As an Amazon Associate IPCamTalk earns from qualifying purchases.

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
My main SSD for WIndows 8.1 is just a 128. It's enough for the OS and installing any game (I only play one game at a time). You could get away with 64 for an OS, but 128 is definitely preferable and gives some breathing room. I really think the difference in performance will be much appreciated. I curse with expletives my work laptop on a daily basis because of how slow it is, and it's entirely because of the hard drive.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,680
Reaction score
14,041
Location
USA
Yeah I once tried full-disk encryption with truecrypt on my old core 2 duo laptop from 8 years ago. The CPU doesn't have AES-NI encryption acceleration so the read and write speeds were cut down a lot and that thing was sloooooow. Once I reformatted without the encryption, that little speed boost make the machine usable again. The jump up to an SSD is much more significant than even this.
 
Joined
Nov 11, 2014
Messages
16
Reaction score
0
Well folks I installed the script temporarily on my laptop running Vista and it is working flawlessly! I then set up Task Scheduler to run the Powershell file every 5 minutes for the test. It works perfectly! Littlebrother you are DA MAN! :cool:
I cannot thank all of y'all enough for your generous help! All I have to do now is wait for hardware to arrive next week and get it set up. Now I can actually enjoy the benefits of this great little camera.......
 
Joined
Nov 11, 2014
Messages
16
Reaction score
0
Here is a peek at my temporary website showing my weather station and webcam snapshot. http://budbrinkley.com/flying_v_ranch.html While the website is rather crude and basic, my weather station is not. It sits out next to my runway on the ranch and uses a long range radio link to communicate data back to my home which is roughly 1/2 mile away. I am using Ubiquity equipment to do this. The 40 foot weather station tower has it's own broadband connection and IP address.The weather station is a high quality Davis VP2 and the tower and related equipment are completely self contained using solar panels for power. Eventually I plan to network the whole ranch including entrance gates and cattle pens etc. I would still be dead in the water if not for you good folks on here!
 

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
Here is a peek at my temporary website showing my weather station and webcam snapshot. http://budbrinkley.com/flying_v_ranch.html While the website is rather crude and basic, my weather station is not. It sits out next to my runway on the ranch and uses a long range radio link to communicate data back to my home which is roughly 1/2 mile away. I am using Ubiquity equipment to do this. The 40 foot weather station tower has it's own broadband connection and IP address.The weather station is a high quality Davis VP2 and the tower and related equipment are completely self contained using solar panels for power. Eventually I plan to network the whole ranch including entrance gates and cattle pens etc. I would still be dead in the water if not for you good folks on here!
Looks good. Is updating automatically, too. You could always make that image a link to itself. I can see you've got the raw one loading, but shrinking its size down in the IMG tag. If you link to itself with a _blank attribute in a link tab it would open a new window to the full size. You may know all this, though. :)
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
Just a thought, why do you need to FTP images if you can pull it straight from the camera in real time?

img border="0" src=http://budbrinkley.com/ftp/snapshot.jpg width="668" height="340"
Instead go with -

img border="0" src=http://budbrinkley.com:camport/onvif/snapshot width="668" height="340"
 
Joined
Nov 11, 2014
Messages
16
Reaction score
0
I may be mistaken, but wouldn't that allow someone to bust my ISP data cap? At least with FTP I have control over how much data is pulled from the camera and weather station and uploaded via my ISP to my server space. After its on the server, then it becomes public and it does not matter. Is there a way or command that someone can use the camera directly and theoretically use up my data cap?
 

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
Just a thought, why do you need to FTP images if you can pull it straight from the camera in real time?



Instead go with -
That syntax doesn't seem to work any longer, since Hikvision released 5.2.0. I did use it on 5.1.0, though... I just tried it on a cam and nothing happens; no error result, just seems to do nothing. I prefer this, though. I think it's awful that Hikvision used to let a person without any authentication at all pull images from a camera.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,680
Reaction score
14,041
Location
USA
I did not know about that /onvif/snapshot URL, but it does not surprise me. Backdoors like that are scattered all over IP cameras, and are the main reason you should never port forward directly to a camera.

For example, here are the Dahua equivalents that I know about:

bp2008 said:
I have discovered two ways of obtaining imagery from the camera without authentication.

------------- Full resolution Jpeg snapshots. Very low frame rate. -------------

http://xx.xx.xx.xx:9989/onvif/media_service/snapshot?channel=0&subtype=0

Actually, it seems to ignore everything after the port number, so just http://xx.xx.xx.xx:9989/

------------- Full h.264 video stream -------------

No-authentication video stream URL: rtsp://xx.xx.xx.xx:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

The key here is to use &proto=Onvif to bypass authentication.

---------------------------------------------------------

I imagine this works with any Dahua camera that has ONVIF support, and it is yet another reason you should probably not have your camera accessible directly from the internet. I imagine most of the camera settings can be changed without authentication too; it would just be a matter of discovering the URLs.
FYI, Hikvision's jpeg snapshot support isn't really capable of providing live, constantly refreshed images to more than one user. In my experience it will actually return error messages to one of the users while returning images to the other.
 
Last edited:

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,680
Reaction score
14,041
Location
USA
I may be mistaken, but wouldn't that allow someone to bust my ISP data cap? At least with FTP I have control over how much data is pulled from the camera and weather station and uploaded via my ISP to my server space. After its on the server, then it becomes public and it does not matter. Is there a way or command that someone can use the camera directly and theoretically use up my data cap?
Yes, this would make it rather easy, especially if your data cap is low. For example anyone could put your image URL into Blue Iris and have it pull images continuously. This would not even require malicious intent. If someone with malicious intent was to target you, there would be easy ways to make you hit your data cap whether you had a listening port on your router or not.
 

networkcameracritic

Getting the hang of it
Joined
Mar 10, 2014
Messages
719
Reaction score
203
Depends. Currently you send one every 20 minutes 24/7, that's 72 even if nobody comes to your site. Some can in theory click refresh a lot, but not likely.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,680
Reaction score
14,041
Location
USA
One picture every 20 minutes is just a gigabyte or two per month. I suppose if it is a cellular data plan that could be more than desired.
 
Joined
Nov 11, 2014
Messages
16
Reaction score
0
The main point here is that by using FTP to upload at a frequency that I choose, keeps me in control of my ISP bandwidth. Once it's uploaded on my paid server( in Germany), it does not matter if I have 0 or 1000 hits as I have unlimited bandwidth there. A least I hope that I am explaining that correctly.:)
 

richisup

n3wb
Joined
Apr 17, 2015
Messages
18
Reaction score
6
Here is a walkthrough to get you started. I have written these steps while confirming they work on my machine. Lots of text here, but only because I'm thorough :)

With your specific requirement in mind, as opposed to taking the FTP file that is being deposited and renaming it, another possible approach is this one. Confirmed as working on 5.2.0 firmware, and should work on some earlier ones as well. This is an authenticated approach, which is necessary to grab images on 5.2.0 (earlier it wasn't necessary to authenticate to pull the jpg).

1) Go to this address: http://admin:12345@192.168.1.150:80/Streaming/channels/1/picture

- for this example I'm using the default admin and 12345 password, but you can make another account on the camera with less permissions that can do this
- change 192.168.1.150 to whatever your camera's IP address is
- note the specification of port 80. You can leave that out, as port 80 is default, but if you change the TCP port you can put a different one in
- When you visit that URL you should see a JPG pulled. Unlike the FTP setup you can't specify its image quality (there may be a way with variations on the URL but in very brief fiddling I didn't find one that worked well)

Assuming step 1 worked, go to step 2:

2) Install Power Shell in your system if it's not already there. It is installed by default in modern versions of windows. If you don't have it on XP you can google how to install. It's a free microsoft product

3) Create a folder called c:\powerimages (or whatever, it doesn't matter what!). Within that folder create a new text file, give it an extension of .ps1. Call the file something like imagepull.ps1

4) Put exactly this into imagepull.ps1, changing only where you see a word encapsulated with < >. Then save.

$url = "http://<ip address>:<TCP port>/Streaming/channels/1/picture"
$wc = New-Object System.Net.WebClient
$wc.Credentials = New-Object System.Net.NetworkCredential("<username>", "<password>");
$wc.DownloadFile($url, "C:\powerimages\snapshot.jpg")

5) You now have a powershell script that when executed pulls an image from the camera and names it snapshot.jpg. It will overwrite previous snapshot.jpg if there is one.

6) With your powershell window open go:

c: <enter>
cd powerimages <enter>
.\imagepull.ps1 <enter>

Notice how you probably received an error message about permissions? That's because powershell isn't setup to allow even locally created scripts to run. Fix that by typing:

Set-ExecutionPolicy RemoteSigned <enter>


Now try again. Is the script working properly?

Just had another idea. If it's STILL not working properly, google "download .net", to make sure you have a recent version of .net running, since this script leverages that. Assuming your XP machine is being used for anything though chances are it's already got a version on there that will work here.


7) if it is, now you can right-click the imagepull.ps1 within your windows explorer and say "run with powershell"


Assuming all the above is working for you, let me know and then the final step will be to get your machine to automatically run this script on the interval you specify, which you'll do with windows scheduled tasks, as they can be set to run 24/7 on whichever interval you like, specifically with this syntax:

powershell -file c:\powerimages\imagepull.ps1 -WindowStyle Hidden

One caveat there is that even with windowstyle hidden your system may still have a brief pop up every time it runs. If so, and that is unacceptable, you'll need to create a second user account on your system and specify that account for the windows scheduler to run under. That way, since you're logged in as John Doe, and the other user account that the windows scheduled tasks is running is Jane Doe, you never see what she's doing, thus the powershell runs without you seeing a pop up.

Just wanted to say you have saved my bacon with this.

Here is my version which saves the image then uploads to our ftp server:

#Retrieve image from camera and save to c:\IMAGEDUMP

$url = "http://192.168.0.5/Streaming/Channels/1/picture"
$wc = New-Object System.Net.WebClient
$wc.Credentials = New-Object System.Net.NetworkCredential("putuserhere", "putpasshere");
$wc.DownloadFile($url, "C:\IMAGEDUMP\netcam.jpg")


#Login to Ftp server and upload image

.\Move-FtpFile.ps1 -Username ‘putftpuserhere’ -Password ‘putftppasshere’ -FilePath ‘C:\IMAGEDUMP\netcam.jpg’ -ServerName ‘putftpserverhere’ -Action Upload

__________________________

This then calls the following script saved as Move-FtpFile.ps1


param($Username,$Password,$FilePath,$ServerName,$Action)
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($UserName, $Password)
$file = Get-Item -Path $FilePath
$uri = New-Object System.Uri(“ftp://$ServerName/$($file.Name)”)
if ($Action -eq ‘Download’) {
$webclient.DownloadFile($uri, $FilePath)
} elseif ($Action -eq ‘Upload’) {
$webclient.UploadFile($uri, $FilePath)
}
 
Last edited by a moderator:

LittleBrother

Pulling my weight
Joined
Sep 16, 2014
Messages
480
Reaction score
119
Great, glad my post wasn't for nothing :cool: I wondered where it had gone, man I did spend some time on that lol
 
Top