Thursday, February 28, 2013

Rename Panasonic and other DSLR movies automatically

Some cameras such as Panasonic ones that takes movies, name the movie files 00000.MTS, 00001.MTS, 00002.MTS, 00003.MTS etc. You copy them off, delete the originals and then of course the camera resets the number back ie it restarts at 00000.MTS.

Well thats tricky because you'll soon lose track of which movie is which.

Handily there's a script you can from here which renames the movies to the date and time they were taken. Direct download link:

1.  Put it in the same folder as your movies that need renaming

2.  Rename it to

3.  At the command line in OSX or Linux make it executable

    chmod +x

4.  Then call the script like this:

    for X in 00*MTS; do -d -p VIDEO- -a -1080p $X; done

5.  Bonus points: get the script's usage by doing

Monday, February 25, 2013

Convert old Photo CD scans on Mac OSX or Linux

Having a clear out, I found two Kodak Photo CDs from way back, I think the dinosaurs had only just died out.

Anyway, on OSX, neither Photoshop CS5 and presumably CS6 as well, would open them, and neither would Graphic Converter, which was quite the surprise.

Happily, turns out that on OSX Lion and Mountain Lion iPhoto handles them OK, certainly iPhoto 11 or v9. Drag all the .pcd files into iPhoto, add them to an album, and then Shift-Command-E to export them.

At full res they turn into 6 megapixel images.

Memo to self: you don't need to spend money on software such as this.

On Linux, I found that since I can run Photoshop CS2 under WINE, they open absolutely fine:

Saturday, February 23, 2013

Adobe Flash: unsafe at any speed outside of Chrome

Most folks don't realise that there are two versions / implementations of Flash: inside Chrome and outside Chrome.

The one outside Chrome, with its lack of sandboxing is plain unsafe. Its uninstalled from mine and my families computers, and if we need Flash then we use Chrome.

For OSX, here's the uninstall instructions.

And for Windows.

Friends don't let friends run Flash outside of Chrome.

If you must use Flash outside Chrome, and use with Firefox, the also install the noscript plugin and flashblock addons,  so you can actually control when it runs. Also on Firefox you can disable Flash:

And finally, for Firefox, you should also run BetterPrivacy which can delete the sneaky long term storage cookies.

And finally, Chrome has a very handy "click to play plugin" feature. You should use it! In a Chrome tab type "chrome://settings/content", scroll down and change to "click to play"

Tuesday, February 19, 2013

Fixing the wrong date and time in your photographs

Ever set the calendar date and time on your camera incorrectly? And then all your albums are wrong, or they upload to a service like Flickr or Picasa incorrectly?

Recently I came across some photos that were wrong by the year: I'd gotten a new camera for Christmas, it arrived in the New Year, and and set the year wrongly ie to the previous year. Everything else was right such as the date of the month and time.

This tip uses EXIFTool to adjust the EXIF data which is the data inside the photo that says when it was taken.

    exiftool -DateTimeOriginal+="1:0:0 0:00:0" IMG_0020.JPG
    exiftool -DateTimeOriginal+="1:0:0 0:00:0" /path/to/directory/ 

The command above adjust forward by one year for either a single file or a whole directory

the one below back by a year

    exiftool -DateTimeOriginal-="1:0:0 0:00:0" IMG_0020.JPG
    exiftool -DateTimeOriginal-="1:0:0 0:00:0" /path/to/directory/ 

You can see the fields which allows you to adjust by a variety of options:

    years:months:days hours:minutes:seconds

As always its best to try this on a copied file first.

Don't forget to set the file system date / time to the EXIF by running

    exiftool '-DateTimeOriginal>FileModifyDate' IMG_0020.JPG
    exiftool '-DateTimeOriginal>FileModifyDate' /path/to/directory/
This will make the photos display correctly when browsing them on your computer.

Friday, February 15, 2013

Geo tag photos on Linux / Ubuntu

With my move to Linux / Ubutu, I need to replace some Mac OSX specific applications, one in particular is GPSPhotoLinker

There are two solutions:

1.  If you want to apply a GPSx track to a batch of photographs, the near straight replacement is "GPSCorrelate" which you can get from either Synaptic or the command line

After installation it lives in the "graphics" section.

Launch and then add your photos, GPSx track and off you go.

BTW, instructions on how to create the GPSx file are here:

2.  For individual photos, "Geotag" works well. Its a Java runtime app you get from Sourceforge. It has an interesting approach where you load a photo, and when you want to tag it, a web client starts on a local port, and you can drag the marker around to set the co-ordinates

Tuesday, February 12, 2013

Recovering deleted JPGs and NEFs

Probably due to my own error, about 40 photos both JPGs and Nikon NEFs got deleted by accident from the CF card on my D300.

After trying a few "free" applications, which firstly did not recover everything and secondly cost $90 or more to recover NEFs, I came across the application "Photorec" which comes as part of a data recovery programme called "Testdisk". Its available for most major platforms, I chose to run on Ubuntu 12.04.

First install either through Synaptic or the command line:

    sudo apt-get install testdisk

after it installs, run as root

    sudo photorec

From here its pretty much wizard driven. Quick start is here.

On my 16GB card it took about 45 minutes to copy everything. A couple of things to note:

  1. The process will find ALL files deleted or not, and put the into a series of folders. The dates and times of each photo will be roughly correct (see below) so you can take a first pass at what you are looking for.
  2. The files and the folder will be owned by root, so you'll need to fix up the permissions to do anything else with them.
  3. The files will be recovered with generic non-sequential names.
To fix #2 I sorted through the photos, and copied the ones I had lost to a new folder. This keeps the "originals" safe while you fix them up.

To fix #3 I used EXIFTool to rename the files with their EXIF date / time creation:

    exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" file.nef

on occasion the file system modification time is wrong, which you can fix with:

    exiftool '-DateTimeOriginal>FileModifyDate' file.nef

You can then match up JPG and NEF from their dates and times, and reconstruct the filenames.