recommend IP cameras that are easy to grab a single frame from?

1,793 views
Skip to first unread message

Eric K

unread,
Jul 2, 2021, 4:55:29 PM7/2/21
to weewx-user
Based on first hand experience, can people recommend various IP cameras (ideally an Ethernet or wifi camera) with a focus towards ease of grabbing a single frame from a Linux command line?
I'd like to be able to grab single frames to use in the weewx webpage.

I don't want an RaspberryPi camera because I'd like multiple cameras and I don't want to be tethered to a RaspberryPi via a short ribbon cable.

I've tested am Ethernet-connected camera that puts out an rtsp stream.  I successfully used an ffmpeg command line to start the stream, wait 10 seconds and then grab a frame.  Sometimes 10 seconds isn't enough and I have to try 12-15 seconds.
ffmpeg -loglevel info -rtsp_transport tcp -i "rtsp://192.168.7.51/rtsp-stream" -ss 00:00:10 -r 1 -vframes 1 -y /home/weewx/Pictures/image.jpg
It works, but I don't think rtsp is the ideal transport method for grabbing a single frame, because you have to wait about 10+ seconds for the stream to fully form a valid image.

I wonder if anyone has tried the ESP32-CAMs?  They get connected to an ESP6288 wifi module, and are thus small and wireless.

Eric Koester

unread,
Jul 2, 2021, 4:58:23 PM7/2/21
to weewx...@googlegroups.com
With regard to the ESP32-CAMs, I meant "ESP8266 wifi module".

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/0GQXzz0Cupc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/058f20b9-782e-408a-bca4-fdd8ca1d2d60n%40googlegroups.com.

Greg Troxel

unread,
Jul 2, 2021, 6:52:03 PM7/2/21
to Eric K, weewx-user

Eric K <eric.k...@gmail.com> writes:

> Based on first hand experience, can people recommend various IP cameras
> (ideally an Ethernet or wifi camera) with a focus towards ease of grabbing
> a single frame from a Linux command line?
> I'd like to be able to grab single frames to use in the weewx webpage.
>
> I've tested am Ethernet-connected camera that puts out an rtsp stream. I
> successfully used an ffmpeg command line to start the stream, wait 10
> seconds and then grab a frame. Sometimes 10 seconds isn't enough and I
> have to try 12-15 seconds.
> *ffmpeg -loglevel info -rtsp_transport tcp -i
> "rtsp://192.168.7.51/rtsp-stream" -ss 00:00:10 -r 1 -vframes 1 -y
> /home/weewx/Pictures/image.jpg*
> It works, but I don't think rtsp is the ideal transport method for grabbing
> a single frame, because you have to wait about 10+ seconds for the stream
> to fully form a valid image.

Long ago I played with a dlink camera and as was able to figure out a
URL that would get a single frame. You might log into the https
interface and look at the html on the live view page. Also check out
the zoneminder wikis and similar for the access methods.

I would not be surprised if you can find into for your camera on the web
someplace.
signature.asc

Les Niles

unread,
Jul 2, 2021, 10:40:39 PM7/2/21
to weewx...@googlegroups.com
I use an Amcrest wifi security camera (IP4M-1026B). It’s configured to push a frame every minute via ftp. Pulling frames would’ve been a little easier, but this works just fine since there’s no need for frames to be captured at specific times. The timing doesn’t drift and the camera uses ntp so the time stamps are accurate. It’s waterproof and has a good field of view for this application, and most importantly, I had it laying around when I got the bug to add a webcam. 
http://www.2pi.org/wx/index.html

  -Les


On Jul 2, 2021, at 1:55 PM, Eric K <eric.k...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Eric K

unread,
Jul 2, 2021, 11:48:33 PM7/2/21
to weewx-user
Long ago I played with a dlink camera and as was able to figure out a
URL that would get a single frame. 

Me too!  I had a Dlink DCS-900 and I could get a single camera image from the URL line.
But, I bricked it trying to update its firmware.  
Oh well, it was early-2000s vintage and had a pretty crappy image sensor, compared to what's on the market today.
I'm looking for a modern, functional replacement for it.

I would not be surprised if you can find into for your camera on the web
someplace.

The camera with rtsp streaming that I was playing with can only deliver an rtsp stream via it's Ethernet port (no wifi).  
I know because it is made by the company I work in.  
I asked some of our software people about grabbing a single image for a webpage, and they said, nope, only rtsp via the Ethernet port.
It's primary function is to create full motion video for video conferencing, so delivering still frames for webpages was not on the required features list.

Eric

dvdhns

unread,
Jul 3, 2021, 3:30:33 PM7/3/21
to weewx-user
To grab single frames, this is what I use. I haven't had a problem with having to wait 10 seconds to get the image. It seems immediate. I'm using a cheap Jidetech IP Cam with POE. I wouldn't recommend it as it seems to lose network connectivity occasionally. 

/Applications/ffmpeg -i "rtsp://192.168.0.185:554/1/h264major" -frames:v 1 img.jpg

Greg from Oz

unread,
Jul 3, 2021, 7:05:16 PM7/3/21
to weewx-user
I use this command on a generic webcam:
ffmpeg -i "rtsp://admin:123...@192.168.0.201:554/mpeg4" -vf fps=1/60 -s 960x480 -strftime 1 $WEBCAMFILES/$DATEFOLDER/tmp/"%Y%m%d-%H%M%S.jpg" -hide_banner &

It runs in the background and generates a still every 60 seconds and I use those pictures to make a time plase.

I use a program called inoticoming that you can set up to do things when a file is created in a folder.
For example:
inoticoming  $WEBCAMFILES/$DATEFOLDER/tmp/ --suffix .jpg  /usr/local/sbin/weather-realtime.sh {} \; 

The above says if a picture is created then run /usr/local/sbin/weather-realtime.sh and use the generated photo as a parameter.
I create a webm movie so if you are viewing on an iphone it won't work.




Rainer Lang

unread,
Jul 4, 2021, 4:55:19 AM7/4/21
to weewx...@googlegroups.com
I use three different cameras, one Chinese brand PTZ PoE camera (H.View) and two German products (Lupus).
They all save a pic every 60 seconds (as part of their security camera feature) to my NAS - the PTZ via NFS, the others via FTP.

On the NAS the (files of the) latest pictures (showing an in-picture time stamp) are converted into a common file name like camera1.jpg, camera2.jpg, camera3.jpg
and then sent, copied via FTP to the weather sites where the picture(s) are to be displayed (as the display programs cannot handle changing file names).
It works perfectly.

So per picture it's a little batch job which converts the file name into a generic copy and then sends it via ftp to the destination site.
it's a Windows batch job with separate ftp inputs for each picture/site - run every minute via Windows Scheduler
(could of course also be a Linux shell script doing the same job and then run via CRONTAB)
One of my weather templates shows all three pictures in a row giving a 270° sky and ground view.

As for weewx skins, the pictures can be used like any other picture to be displayed in a skin.
For one template (Meteotemplate) I use the live camera feed picking up the http stream from the camera.

You can look the result(s) up at http://meshka.eu
the 270° pictures are with the pwsWD template
the live camera with the Meteotemplate

So far I don't display a picture in a weewx skin (still to come)

So, in my solution, the camera model doesn't really matter - it's the camera features which matter
- sufficient resolution 😁
- ability to save snapshots in a common graphic format (jpg, png, ...) every (to be customized:) 1-3600 seconds to a (NAS) server
(- reasonable price 😉 )
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Message has been deleted

mwall

unread,
Jul 4, 2021, 5:25:48 PM7/4/21
to weewx-user
On Friday, July 2, 2021 at 4:55:29 PM UTC-4 Eric K wrote:
Based on first hand experience, can people recommend various IP cameras (ideally an Ethernet or wifi camera) with a focus towards ease of grabbing a single frame from a Linux command line?

i've been using bullet and dome cameras from hikvision and dahua for years, from 3MP to 8MP.  gave up on dlink about 10 years ago.

hikvision DS-2CD2043GO-I 4MP; DS-2CD2193GO-I 8MP
dahua
reolink RLC-410-5MP PoE

i prefer PoE cameras.  wifi can be ok, for example when trying to capture animals or for mobile applications.  but if you want timelapse for more than a few hours, or a 'permanent' location, PoE just keeps on working.

reolink is my current favorite - no browser extensions required, much simpler ui for setup.  their solar/battery powered pt/ptz camera is pretty slick (Argus PT).

be sure you keep then on a private network - there have been firmware vulnerabilities over the years, so if you put any of these on a public network, you'll probably get pwned.  also lets you firewall them to make sure they don't phone home.  make a single admin account, then create a 'read-only' account that you'll use to capture the still images.

 
I'd like to be able to grab single frames to use in the weewx webpage.

most cameras have a URL that will give you a still image:


i wrote some perl scripts years ago to do the image capture and to create timelapse videos from the still images.  also includes a browsing interface to page through the still images and any timelapse you create.


if you know any perl, you can easily add a couple of lines to insert weather data or other information as part of the capture process.

m


mwall

unread,
Jul 4, 2021, 5:29:31 PM7/4/21
to weewx-user
sorry, here is the link to the root level of the ispy database:


Eric K

unread,
Aug 7, 2021, 6:18:33 PM8/7/21
to weewx-user
Thanks for all the responses.

Shortly after posting this I got a couple of the ESP32-CAM modules and loaded Tasmota firmware into them.
You have to use the specific Tasmota32 webcam firmware:   tasmota32-webcam.bin
The maximum resolution of these is only 1600x1200.  
The upside is that you can easily grab a single frame using a simple URL command:  http://192.168.8.122/snapshot.jpg
The only downsides I see:  with the plastic lens and jpeg compression, the images are not great for fine detail.

Given the low cost, small size, MIPI camera interface, and wifi capability of the RPi Zero W board, I reconsidered an RPi camera.
I'm currently assembling a RPi Zero camera with a 5mp camera module.
I am getting single images out of it with the raspistill application:
raspistill -v -o /home/pi/Pictures/pi-cam-test.jpg

I'd like to grab an image every 5-10 minutes and have the current image show up in the Belchertown weewx page.
I'd also like to create a daily time lapse movie like others have done.
I recall seeing some webcam script examples in this weewx-user group to do these 2 things.  
I need to search for them again.
ESP32-CAM wide constrast -2 brightness -2 1600x1200.jpg
ESP32-CAM with Tasmota.JPG

Eric K

unread,
Aug 7, 2021, 6:24:15 PM8/7/21
to weewx-user
I also want to check out your perl scripts, @mwall!

p q

unread,
Aug 7, 2021, 6:32:12 PM8/7/21
to weewx...@googlegroups.com
Please continue to post your results. Particularly which hardware you choose. I'm interested in doing the same with my own skin.

As a side note, I'm playing around with Grafana to see what advantages it has compared to the standard graphs. It was easy to install on my raspberry pi and fairly easy to hook up to the SQLite DB.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.


--
Peter Quinn
(415)794-2264

Eric Koester

unread,
Aug 8, 2021, 7:08:41 PM8/8/21
to weewx...@googlegroups.com
I have been working with the ESP32-CAM wifi camera today.

In weewx, I'm using the Belchertown webpage skin.
In its stock setup, you get a weather RADAR image from Windy.com, that updates every 5 minutes.  
This afternoon, I replaced the Windy.com RADAR plot with the webcam image. 
I don't really want to trade the RADAR for the webcam, but I'm not sure of a slick way to have both, yet.

It takes about 10 seconds to transfer an image frame from the ESP32-CAM to the Raspberry Pi.
To remove this delay from the webpage, I wrote a simple executable bash script to grab the webcam image and store it on the Raspberry Pi micro-SD card.
Then, I have the weewx webpage fetch the webcam.jpg file from the "hard drive" so it loads instantly.

fetch script:
#!/bin/bash
wget http://192.168.8.122/snapshot.jpg -O /home/weewx/public_html/images/webcam.jpg

Then I have the Belchertown skin put the webcam.jpg file into the page,

from the Belchertown index.html.tmpl file:
                    <!-- Radar image -->
                    <div class="col-lg-5 radar-map toprow-height">
                        <img src="./images/webcam.jpg" width="640" height="480">
                    </div>
                </div>
                <!-- End of first row -->

I'd like to polish this a bit, but it is working.


dvdhns

unread,
Aug 9, 2021, 5:29:28 PM8/9/21
to weewx-user
One thing to keep in mind is the microSD cards will start to fail after so many write operations. I had one fail after about six months, after saving an image to it once every minute.

I'm currently a cheap IP camera that seems to loose it's network connection whenever weather gets hot. Looking for a better POE IP cam. 

Marty b

unread,
Aug 10, 2021, 12:29:11 PM8/10/21
to weewx-user
I use the Ubiquiti Cameras which are PoE and they work quite well. (Snapshot example URL: http://192.168.1.95/snap.jpeg)

I have a process on a Raspberry Pi that will grab an image every minute and saves it to /dev/shm (the ram disk - which saves wear and tear on the SD card).  The image can be viewed via a php webpage grabbing the image from /dev/shm.  See code below for example:


<?php

$content = file_get_contents('/dev/shm/webcam.jpg');
$type = 'image/jpeg';
header('Content-Type:'.$type);
echo $content;
?>

Hope this helps.

vince

unread,
Aug 10, 2021, 4:47:36 PM8/10/21
to weewx-user
I use a cheapo USB cam on a pi and save a still periodically using 'motion' as the software on the pi.  I write the file to ramdisk to avoid the SD card file write issue and grab the still via cron from my weewx system.

Eric K

unread,
Aug 10, 2021, 4:58:50 PM8/10/21
to weewx-user
I like the idea of writing to the RAM disk, to avoid multiple rewrites the micro SD card.
I didn't know it was an option.

This is all there is to it?  
https://www.linuxbabe.com/command-line/create-ramdisk-linux
Looks easy!

Eric K

unread,
Aug 10, 2021, 6:57:47 PM8/10/21
to weewx-user
I changed my scripts to put the pictures into a ramdisk.
But, the web server can't find them in the ramdisk.

First I tried this - web server didn't find it:
                    <!-- Radar image -->
                    <div class="col-lg-5 radar-map toprow-height">
                        <img src="/tmp/ramdisk/webcam-time.jpg" width="640" height="480">
                    </div>
                </div>
                <!-- End of first row -->

I searched for some guidence and then tried this - web server didn't find it:
                    <!-- Radar image -->
                    <div class="col-lg-5 radar-map toprow-height">
                        <img src="file:/tmp/ramdisk/webcam-time.jpg" width="640" height="480">
                    </div>
                </div>
                <!-- End of first row -->

How are others accessing a ramdisk for webserver photos?



Eric K

unread,
Aug 10, 2021, 8:26:50 PM8/10/21
to weewx-user
I just tried making a symlink to the /tmp/ramdisk directory, inside the public_html directory, and that worked.

pi@pi3:/home/weewx $ ln -s /tmp/ramdisk /home/weewx/public_html/ramdisk

NOW the web server is able to pull the image from the ramdisk.

                    <!-- Radar image -->
                    <div class="col-lg-5 radar-map toprow-height">
                        <img src="./ramdisk/webcam-time.jpg" width="640" height="480">
                    </div>
                </div>
                <!-- End of first row -->

Graham Eddy

unread,
Aug 10, 2021, 10:25:18 PM8/10/21
to weewx...@googlegroups.com
i mount a ramdisk on /home/weewx/public_html

Eric Koester

unread,
Aug 10, 2021, 10:49:22 PM8/10/21
to weewx...@googlegroups.com
Interesting.  Is that to prevent all of the webpage content from being written and re-written to the microSD card?  
Seems like a good idea.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/0GQXzz0Cupc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/2B036A11-D12A-4A75-AE8A-DAC108F8607E%40gmail.com.
Reply all
Reply to author
Forward
0 new messages