Montag, 7. Mai 2012

Batch Convert Videoclips on Mac OSX CLI using Quicktime

by on Montag, 7. Mai 2012 20:51

While compressing the videos of my Pentax K-5 I searched for some scriptable solution because I have some 100 files lying around. Unfortunately the - via Google commonly advised - Handbreak-(GUI-) Solution uses ffmpeg to decode input sound, which puts you strange thump sounds to the output (even when set to "pass-thru"). I don't know who to blame, but this problem is also described in a post at pentaxforums.

I also tried DV Kitchen (another GUI-Solution) which had thump-free sound output but keept crashing randomly.

While working on a Cocoa- (meaning "programming-") solution (the first steps are actually pretty easy with Quick Time Framework "QTKit". Google for "qtmovie". The method "writeToFile:withAttributes" lets you specify QTMovieExportSettings, but this will only work with predefined export settings e.g. for playback on iPhone, iPad and some more. No custom encoding settings) I came across these handy qt_tools (the .dmg comes including C sources *nice*). IHMO their authors definitely have a SEO problem with their site ;-).

After installing (which actually means that you just have to find a way to get the bin/qt_export shellskript or the binary inside qt_tools.app) you can use this as follows:

qt_export --dodialog --savesettings=myExportSettings.st
A dialog will pop up with a lot of encoding configuration detail settings. Select your desired output codec and encoding settings and klick "OK". Your decision will be saved to the specified "myExportSettings.st", which you can now use for encoding:
qt_export IN.AVI OUT.MOV --loadsettings=myExportSettings.st
A simple shellscript which does this job for some 100 files in a certain directory could now look like this:

#!/bin/bash

QT_EXPORT="/Applications/qt_tools.app/Contents/MacOS/qt_export"
EXPORTSETTINGS="myExportSettings.st"

BASENAME="/usr/bin/basename"
TOUCH="/usr/bin/touch"
STAT="/usr/bin/stat"

if [ "$1x" = "x" ]; then
  PATH="."
else
  PATH=$1
fi

for filename in $PATH/*.AVI
do
  IN=$filename
  OUT=`$BASENAME -s .AVI $filename`.MOV
  $QT_EXPORT $IN $OUT --loadsettings=$EXPORTSETTINGS
  $TOUCH -t `$STAT -f "%Sm" -t "%Y%m%d%H%M.%S" $IN` $OUT
done;
[EDIT: added re-date for easier handling in iMovie]

comments. 0 tags. ,

Sonntag, 16. Oktober 2011

iMovie und die fehlenden Original-Clips

by on Sonntag, 16. Oktober 2011 15:52


Über Apple-Produkte kann man sagen was man will. Ich bin immer wieder überrascht, wie schön Apple sehr komplexe Dinge auf eine einfache und verständliche Art und Weise löst. Noch mehr überrascht bin ich aber mit unter, wenn ich feststelle wie diese tollen und "perfekten" Produkte aus einer furz-einfachen Aufgabe ein Ding der Unmöglichkeit machen...

So stand ich kürzlich vor folgendem Problem: ich hatte abendelange Arbeit in einen iMovie-Urlaubs-Film investiert. Nach dem Umzug auf einen neuen (schnelleren) Rechner sehe ich in iMovie kleine gelbe Warnschilder an meinen Clips mit dem Hinweis "Original-Clip fehlt." Verschiedenste Methoden des Exportierens, Importierens, Kopierens und Verschiebens (ob nun aus einer Apple-Anleitung oder selber erdacht) schlugen allesamt fehl. Die Google-Suche bestätige auch nur, dass andere sehr ähnliche Probleme aber keine wirkliche Lösung dafür haben.

Nach mehreren Tagen vergeblicher Bemühungen habe ich irgendwann folgendes ergoogelt, was nicht nur mein Problem lösen konnte, sondern auch weiteren Dirty-Tricks mit der iMovie Mediathek (endlich) Tür und Tor öffnet:
http://www.wellys.com/movies/iMovie%2009%20Source%20clip%20is%20missing.pdf

Der ganze Trick besteht eigentlich darin, dass "Project"-File (in dem u.A. die diversen Verknüpfungen versteckt verwaltet werden) selber zu editieren. Nun ist das "Project"-File - an das man mit "Paketinhalt anzeigen" noch relativ leicht heran kommt - leider binär ist, was das Editieren recht mühsam macht. Das ganze lässt sich aber mittels
> plutil -convert xml1 Project
in ein schickes und um so wichtiger: editierbares XML verwandeln und dann mittels
> plutil -convert binary1 Project
wieder zurück...

Es sollte klar sein, dass man in dem XML auch einiges kaputt machen kann, aber mit nem Backup des "Project"-Files sollte sich das Risiko einigernassen in Grenzen halten, also viel Spass beim Cheaten... ;-) (Feedback willkommen)

comments. 0 tags. , ,

twitter.

flickr.