AVI-to-MP4 while preserving creation dates?
September 8, 2009 1:06 PM   Subscribe

I'd like to make a script to mass convert .avi files from my digital camera into iPod-sized .mp4 files, while preserving the creation dates from my camera. I'm on a (non-snowy) Leopard mac.

My current workflow involves getting my movies off the camera through iPhoto and then exporting/converting the files to .mp4 via MPEG Streamclip. The downside is that the new .mp4 files have the current date/time rather than the time that the movie was taken on the camera, which messes up my organizational system. I'm sure there's a way to automate the creation date conversion, but I don't know how.

Free methods are obviously preferable to paid ones.
posted by philosophygeek to Computers & Internet (2 answers total) 1 user marked this as a favorite
 
If you write an AppleScript (or Automator) script around this, you can just get the original date/time before you begin, and set it back after. I'm sure there are fifty ways, but I'd just use the boring Unix 'touch' command, I think. The date setting bit would be:
tell application "Finder"
      do shell script "touch -t " & thedatetimeyouwant & " " & filename
end tell
Add that to the end of whatever you're using to shuttle items into your converter program. I don't know StreamClip, but I know it'd work with VisualHub. Most Mac apps are script-controllable.
posted by rokusan at 1:25 PM on September 8, 2009


You could definitely do this with some shell scripting and FFMPEG. I suspect you could do it with Automator actions as well, but I don't have a lot of experience with that.

I think the shell scripting pseudo-code would be something like:

for $i in *.avi; do ffmpeg -i "$i" [...etc, etc, mp4 conversion arguments of your choice, output file naming conversion, etc]; touch -r "$i" [name of output file here]; done

If you're not good with bash scripting, but you're interested in doing it with FFMPEG, let me know and I'll see if I can get around to fleshing it out.
posted by strangecargo at 1:28 PM on September 8, 2009


« Older help me find a non-scammy ringtone site with an...   |   Is learning Prince2 worth the time,energy and... Newer »
This thread is closed to new comments.