Wednesday, June 13, 2012

Photo and Video management in Linux - Shotwell

I hated every photo and video management in any OS.  Even for Picassa, you can import your pictures into Piscassa, and then you have an alternative view of your pictures.  The problem you never know where exactly the pictures are, which could be a real folder or something else.  And many software don't deal with both pictures and videos, which is too bad as nowadays they come from the same cam.

The default image management software in Ubuntu is Shotwell.  You can't fault it too much as it is built from 3rd party components.

The best thing is that when it imports pictures and videos from your cam. It put the images files into a tree of sub folders according to when the picture was taken, something like a top level folder of 2012, then subfolders for months, and then subfolders for days.  You can change the behaviour.  You can also re-import from a folder again into different arrangements.

You can publish to facebook, youtube, picassa, flickr etc but I haven't tried.

Imported pictures will not be imported again, which doesn't make much sense.  If the picture files are identical, it doesn't matter.  If not, it's rather complicated to tell them apart.

There are a few problems, but none that a little script cannot be solved.

When the date on your cam is wrong, you pictures may go everywhere that are difficult to find.  Shotwell doesn't seem to be able to edit the timestamp in the exif metadata.  You should use exiftool to shift the timestamp of all the pictures to get them corrected all at once before import.

Shotwell recognizes the default cam folder for pictures, but not videos.  You need to use the import from folder feature for video, instead of import from cam.

Shotwell doesn't recognize .MPO 3D pictures nor .THM thumbnails.  I use a simple script to change all the names to .mpo.jpg and .thm.jpg.  Since they are all basically jpg files, Shotwell can read the exif metadata and import.  MPO is two jpg images back to back for the left and right image.  THM is the same as jpg to me.

To save download time from older cams, Shotwell will compares thumbnails to decide if the picture needs to be imported.  The problem is that some cams have a .mpo file and a .jpg file for the same image.  The .jpg file is just the left image for easy viewing.  However, Shotwell is so clever as to ignore the filenames, timestamps, file sizes. Instead it only looks at the hash results of the thumbnail.  So the .mpo and .jpg files have the same hash because the first half of the files are almost identical with the same thumbnail.

To import both .mpo and .jpg files of the same shot, you need to import from folder instead of import from cam.  Whole files will be compared instead of just the thumnail.

Tuesday, June 12, 2012

Convert and display 3D MPO pictures on your 3DTV

3D pictures are typically in .mpo format, basically two jpg files concatenated. There many image viewer can see the first (left) image while ignoring the other.

First you have to split the two images. In Linux, there is a tool for that - exiftool. Just type in the command and the os will tell you how to install it.

Then you have to resize and stitch the pair of images together, side-by-side or top-to-bottom.  The former is for active 3DTV's, but for the newer passive TV's, top-to-bottom is the best option.  In Linux, there is imagemagick for everything (convert).

The complete bash script, let call it ttb:  (I put it together from the web.)

name=`basename $1 .MPO`
echo $fname
exiftool -trailer:all= $1 -o $fname.lt.jpg
exiftool $1 -mpimage2 -b > $fname.rt.jpg
convert -append $fname.lt.jpg $fname.rt.jpg -geometry '1920x540!' -mosaic $fname.ttb.jpg

The command
#ttb mypic.mpo

will generate mypic.lt.jpg and mypic.rt.jpg and then stitch them into mypic.ttb.jpg.  This assumes your picture size is 1920x1080 pixels.

It's trivial to modify the script to go through all the .mpo files on the camera attached as an USB drive.  Then image management software such as shotwell can import the left and right and ttb images separately.

Typically 3DTV's can't display the .mpo files directly, nor the TTB (or SBS) images.  They do recognize mpo files, nor expect any 3D picture formats.   Therefore in picture mode, the TV's don't allow or expect any 3D mode.

Typically 3D video cameras have mini HDMI ports.  You can display mpo files correctly via the HDMI into your TV.  But this is not practical.  You have to store everything in the cam, or load a slideshow into your cam every time.

Luckily, reading from USB drives is a capability for Vizio TV's as well as blu-ray players.  When the TV receive signal from the player via HDMI, the TV doesn't care it's video or pictures.  So you can set you TV to 3D TTB, the same as you set for 3D movies.  I still haven't buy a single blu-ray disk yet.  But the display of 3D pictures make it all worthwhile.

Unfortunately, although the Walmart TV can read from external USB drive, the Blu-ray player can only read from USB flash drives.