navigationGo.pngQuick Navigation
allprojects32.pngAll projects
hardware32.pngHardware
links32.pngLinks

favoriteStar32.pngTop projects
Alan numitron clock
Clapclap 2313/1386
SNES Pi Webserver
USB Volume/USB toys
Smokey amp
Laser cutter
WordClock
ardReveil v3
SNES Arcade cabinet
Game boy projects
cameleon
Home Presence Detector

github32.pngGitHub
AlanFromJapan

navigationMail.pngContact me

alanfjmail.png
3flags.pngWho's Alan?


Akizukidenshi
Elec-lab
Rand Nerd Tut
EEVblog
SpritesMods
AvrFreaks
Gameboy Dev
FLOZz' blog
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)

ipcampy

Last update: Thu Jun 5 22:25:41 2025
This version works but since installing OpenCV in spring 2022 on a RaspiZero is a nightmare, I made another version that is simpler to setup/develop.
It's Ipcampy.nocv.

A lightweight web app in python meant to run on a raspi to show the feed from an IP Camera while forbidding the IP Camera itself to access/be accessed by internet.

Presentation

Principle

I have an IP Camera at home, but I don't trust the software on it: easily hackable (purposedly or not), malware on it, etc. Don't want to take risks, plus I'm always in for a little chance to code something. So instead of having an untrusted piece of hardware connected to the net, it will have access to intranet ONLY and a Raspi-ran app will do the bridge and present the camera live feed (as stills not video).

Points of interrest

  • Python and Flask because it's a great combo for a small website
  • OpenCV to access the IP Camera via RTSP protocol
  • Points of pain: building OpenCV on a Raspberry Pi

    Install on a PC with Ubuntu 20.4 is a breeze and quite fast (with a good CPU):
    #get python an pip
    sudo apt-get install python3-setuptools python3-pip --yes
    
    #get flask
    sudo python3 -m pip install Flask
    
    #opencv for python
    pip install opencv-python 
    
    ... but, installing on a Raspi (and I'm masochist to I mean a Rpi Zero W) that is more complicated and VERY LONG. Like the final pip install triggers a build and it takes 2-3h to complete. And cherry on the sh*t cake is that opencv-python doesn't build (as of the moment I write these), you get an error "read cmake output" after HOURS. Reading further apparently it's a problem of memory so you need to allocate a lot more swap memory to the OS, otherwise it will just fail miserably.
    Here are some manuals I found for memory:
  • https://towardsdatascience.com/installing-opencv-in-pizero-w-8e46bd42a3d3
  • https://learn.circuit.rocks/introduction-to-opencv-using-the-raspberry-pi
  • https://pimylifeup.com/raspberry-pi-opencv/
  • https://tutorials-raspberrypi.com/installing-opencv-on-the-raspberry-pi/ (doesn't work build fails)
  • https://medium.com/codemonday/opencv4-python3-raspberry-pi-installation-guide-9182ed893ae6
  • https://pyimagesearch.com/opencv-tutorials-resources-guides/
  • Implementation

    Bill of materials

  • An IP Camera (Amz is your friend) that supports RTSP
  • Raspi
  • A dynamic DNS (http://www.duckdns.org/ is your friend 💛)
  • Schematics

    Source code

    On GitHub https://github.com/AlanFromJapan/ipcampy

    Pictures

    Links

    For memory or if it helps anyone you can stream your RTSP camera stream to VLC and view on your PC and even save it as a video:
    vlc rtsp://(camera-ip):554/(streamName)
  • https://itectec.com/superuser/linux-capture-rtsp-stream-from-ip-camera-and-store/ Discussing the above and a command line alternate openRTSP
  • Helpful sources

    Inspiration

  • Nearly all the meat is here https://stackoverflow.com/questions/49978705/access-ip-camera-in-python-opencv#49979186
  • All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated)
    electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025])