Tag Archives: JPG

Accessing JPG from IP Cameras

I use off-the-shelf IP cameras but monitor them from a central server instead of looking at each camera’s own interface. In this setup it can be better to PULL images off the camera from the server instead of being PUSHED from the the camera to the server. Pushing images requires setting up each camera with the server information and a schedule to upload pictures, which can be sparse in options depending on the camera.

By pulling images on demand, the server can control the time interval and no special setup is required for each camera other than possibly setting up a user name and password for access. Most will require Basic Auth to access in image.

Here’s the JPG access URLs for cameras I’ve tested:

Panasonic cameras (C30A, C131A, C20A, C1A)

http://your.camera.ip.addr/SnapshotJPEG?Resolution=640x480&Quality=Standard&View=Normal&Count=1

Foscam (FI8918W, FI8910W, FI8904W, FI8905W, etc)

http://your.camera.ip.addr/snapshot.cgi

Trendnet (TV-IP110W)

These cameras are not good for this purpose. Only an ActiveX viewer is available for the web or FTP for single images to a server.

Windows PCs with webcams running Yawcam.

Enabling the web access port 8888 for example.

http://your.camera.ip.addr:8888/out.jpg

Using ffmpeg to create a video from image sequences

This PHP script will take a sequence of archive images stored in time-specific sub folders hh/mm and renumber them sequentially. Then use ffmpeg to convert the sequence into a video file. The operation is looped over an array of cameras and a staging folder is cleared prior to each video creation.

<?php
include_once("config.php");
$ftppath = "/root/path/to/images/";
$stagepath = $ftppath . 'staging/';
$date = date('ymd');

foreach ($cams as $cam) {
 exec('rm ' . $stagepath . '*');
 $camfile = $cam['fileroot'];
 $idx = 1;
 for ($j=0; $j<24; $j++)
 {
 for ($i=0; $i<60; $i++)
 {
 $n = sprintf("%02d/%02d", $j, $i);
 $pathfile = $ftppath . $n . '/' . $camfile . '_320x240.jpg';
 if (file_exists($pathfile)) {
 $sidx = sprintf("%04d", $idx);
 copy($pathfile, $stagepath . $camfile . $sidx . '.jpg');
 $idx++;
 }
 }
 }
 exec('ffmpeg -r 4 -i ' . $stagepath . $camfile . '%04d.jpg ' . $ftppath . $camfile . '_' . $date . '.mp4');
}
?>

Using a Trendnet IP110W camera with a fixed FTP location

The TRENDnet TV-IP110W has few options when setting up an FTP transfer. It will always place the image in sub-folder based on the date such as 20110308/230117_9.jpg for the image taken on March 8, 2011 at 23:01:17.9. This makes it difficult to use the image on a static html webcam page.

To move the last picture taken to a fixed file location, a cron job is needed to find the JPG file and move/rename it to a fixed name. In this case the camera is set to take an image every 60 seconds and FTP it to the server. The following script is also set to run as a cron job every 60 seconds.

In this example trendnet is the Filename Prefix set in the Event Configuration >> General Setting tab and /path/to/ftp is the location set in Event Server

# move current picture to *_old
mv /path/to/ftp/trendnet.jpg /path/to/ftp/trendnet_old.jpg

# find where the trendnet put the image and move it to the ftp root location
find /path/to/ftp/trendnet -name '*.jpg' -exec mv {} /path/to/ftp/trendnet.jpg \;

GeoSetter on photos from Nikon NEF

So you’ve done a photo shoot in RAW, spent time adjusting each photo’s composition, and saved the final results to a set of JPGs. Now you want to geo-tag the set, GeoSetter appears to correctly geo-locate each photo, all looks good until you save changes and get:

Warning: Unknown format (800) for SubIFD tag 0x0
Warning: [minor] Entries in SubIFD were out of sequence. Fixed.
Error: Bad format (800) for SubIFD entry 0

Now you can’t save the updates, you can’t GeoTag your photos. Ok, so we try Google’s GPicSync, but it also fails. If you enable storing the Lat/Lon as keywords, that does work, but neither can seem to modify the lat/long of the image.

So we need to strip out the offending unrecognized data for these programs to correctly store the location, but keep the neccessary information such as time stamps. And we need to do so in a batch process, we don’t want to have to hand edit the EXIF data for each image. Many of the high level photo management tools (including GPicSync and GeoSetter) depend on the low-level tool ExifTool.

Using the Window’s GUI interface to this tool, it will report the Nikon information as warnings, data it does not understand. Unfortunately, I saw no way to tell the tool to remove that block of data from the image, only to modify data within sections it understood.

What did work was the tool ViewNX which is provided by Nikon.  Select the images and from the File menu click Convert Files… Check the Box “Remove XMP/IPTC information”, leave the others unchecked and click Convert…

Now the unknown parts are removed, and GeoSetter will have no problems re-saving the files after geo-tagging.