Recent

Author Topic: Writing Applications to access and control PTZ Cameras on a Local network  (Read 2173 times)

KenH75

  • Newbie
  • Posts: 2
I've installed some security cameras around my home, (due to vandalism at my home). I am not satisficed with the software available for controlling the camera and accessing and storing the videos captured. The software is only available for android phones and iphones. I want to be able to store the video captures on my PC. The current apps store it to the cloud. They are not automatically stores to the cloud. They are stored on micro-sd chips until I do my daily access to the camera; this means that if the cameras are stolen, I don't have a record of who stole the camera. The cameras do have an ip address for each on. Can anyone help me on this one.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7099
Is "PTZ" a brand or are you using that for "pan-tilt-zoom"? If it is the latter I suggest editing the subject line in your ORIGINAL message to make it clear.

At the very least, you'll need to be explicit about the brand and model of camera that you've got. The overwhelming likelihood is that the cameras are locked to the specific "cloud" servers as part of their business model, and that sooner or later they'll ask you to pay for an enhanced (or any) service.

You might possibly be able to replace your local app with something more appropriate, but it's likely that the servers will only talk to the apps the manufacturer supplies "as a security feature".

I'd suggest that you start by doing an exhaustive search for that specific camera (Github, Sourceforge, Hackaday, eventually Google etc.) and possibly also capture the protocol using Wireshark or something similar: you'll need to work out how to hook that into a switch or router between the camera(s) and overall Internet. If it's been done even half-properly the data stream should be encrypted, but these things often have extremely poor security with exposed Telnet ports etc... nmap is your friend, as ever.

The bottom line though is that you're likely to have to "break into" each camera and make substantial changes to the firmware. Lots of people have followed this route with various cameras, after making similar ill-advised purchases.

As such this isn't really a Pascal program per se and this isn't the best place to ask, but please keep us informed of how you get on.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

alpine

  • Hero Member
  • *****
  • Posts: 1171
Do you have documentation about the control API of the camera?

If you don't have it then you should reverse engineer it from the network traffic between the control app an the cam. And it can be quite impossible, especially if there are some basic security measures taken (https).
That is certainly a question that should be researched prior to purchase.

Saving the video stream on a PC (assuming there is a such published) is possible, but you didn't tell where the PC is (local network?) and what OS it will run.

Edit: MarkMLl post overtook mine, but his point is the same...
« Last Edit: April 09, 2023, 10:31:43 am by alpine »
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

af0815

  • Hero Member
  • *****
  • Posts: 1334
It sound like the cameras itself don't store to the cloud, only with the app it is possible. This can be made the search easier.

Make a research in your home IP Range if you find the cameras with a tool like advanced-ipsanner. Try to get the MAC of the camera. With the mac-adress you can often identify the producer of the chipset. With this information look with google if someone have found the communiction parameters for the cam.

If the cam is a often used modell, you can be lucky to find a soloution.
regards
Andreas

MarkMLl

  • Hero Member
  • *****
  • Posts: 7099
Thinking about the point made by af0815, if the cameras can cope with SD-Cards being hot-swapped than it wouldn't be too difficult to implement something that (electrically) switched the card to be accessible to (say) an ESP32, which would allow the data to be recovered over local WiFi.

Apart from a bit of electronics and a custom PCB, the problem would then be reduced to working out the data storage format (which might or might not be one of the standard ones).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

KenH75

  • Newbie
  • Posts: 2
MarkMLI, You are probably right about the PTZ meaning the camera to be a Pan-Tilt-Zoom camera. My wife's brother-n-law installs these cameras all the time but he always installs the app and lets his customers worry about the cloud access. Personally I don't like sending anything to the cloud; (just don't trust it), and these cameras are the first of anything sent to the cloud from any of my computers. I'll have to look at the setting in the app on my phone for additional info about the camera. I do know it has a model number but I don't remember seeing a brand name. The box the camera came in just says "Smart Battery PTZ Camera" nothing else, but it did come from Amazon and that's typical for Amazon to not show brand names. I do have some white papers on the PTZ camera I'm trying to get but they're giving me a hassle about my email address not being a business address although it has been for at the least 20 years. Still working on that one. Mark in a latter reply you mention micro-sd memory chips. The cameras to have 32 gb micro-sd chips in them. I'm not in a hurry for I have many irons in the fire and at this point the camera issues is not top priority. i'll continue working on it and watching the forum for other tips and comments as they come. 
Thanks KenH75

dogriz

  • Full Member
  • ***
  • Posts: 127
Most IP cameras are ONVIF compatible. https://www.onvif.org/
You should start there.
ONVIF PTZ Service Specification: https://www.onvif.org/onvif/specs/srv/ptz/ONVIF-PTZ-Service-Spec.pdf
https://www.onvif.org/resources/
« Last Edit: April 12, 2023, 07:54:48 am by dogriz »
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

MarkMLl

  • Hero Member
  • *****
  • Posts: 7099
MarkMLI, You are probably right about the PTZ meaning the camera to be a Pan-Tilt-Zoom camera.

In that case please edit your original subject line, to make sure that people who might be able to help understand what you're asking.

Apart from that I don't think I can usefully add anything, other than the fact that the manufacturer has probably tried to lock it to his own servers but isn't likely to have been very good at it.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 7099
Most IP cameras are ONVIF compatible.

It would be great if they were. However in the current case I'd say that's pretty unlikely to be used by something low-end, particularly since its initial intention for direct access to cameras rather than operating via a server.

Obligatory xkcd https://xkcd.com/927/

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1315
Most of those cameras are just Busybox Linux servers with a read-only filesystem. If you want to change their operation, the best option is to log in through a terminal and change it on the device itself. But that tends to require a root password, although the security varies wildly.

MarkMLl

  • Hero Member
  • *****
  • Posts: 7099
I think this (and cited links) might be close enough to be relevant.

https://hackaday.com/2022/12/12/getting-root-on-a-chinese-ip-camera/

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018