Thursday, April 22, 2010

Modifying Sony Webbie MP4 creation date for iMovie to be happy

I recently had issue with my Camcorder that messed-up with Movies creation dates.


The Sony Webbie Mpeg Camcorder is cute but really messy. I don't advise you to acquire it although it is a rather cheap device.


The main problem is that the time of this camcorder doesn't move forward when the device is Off (!!). So, everytime I switched-On the camcorder, the time always started from where I originally set it in the options…


The consequences are not so obvious when using any sort of movie editor that is capable of sorting original movies by name. But when using iMovie, this time-stamp issue starts to be really annoying because iMovie is only able to organize events according the creation time (this is again amazing to see how Apple is reluctant to expose features "in the name of simplicity").

A simple workaround: gather all the files in alphabetic order and incrementally modify their creation time.


I tried Automator with no success : I couldn't find any command to modify the creation date.


Bash shell script turned out to be the most convenient way. After I found few things from here

http://www.ibm.com/developerworks/library/l-bash.html

I wrote this script that can increment the creation-date according to the order in which the files are processed (alphabetically):


s=10

m=10

for f in ./*

do

echo "SetFile -d 04/17/10\ 02:${m}:${s} $f"

SetFile -d 04/17/10\ 02:${m}:${s} $f

s=$(($s+1))

if [ "$s" = 60 ]

then

m=$(($m+1))

s=10

fi

done

Notes:

  • The reason why I didn't use touch : can only change the modification and access dates
  • SetFile command is part of the toolkit of XCode

Friday, April 2, 2010