Friday, July 6, 2007

Automatic iPhone Video Conversion with VisualHub

Everything I could possibly say about the iPhone has been said. Its an amazing phone and I am addicted to mine.


So the other night I made an automator workflow that can have the wonderful mac application VisualHub automatically convert any video files to iPhone compatible video.


Obviously, to use this, you're going to have to have a mac with at least Tiger, and a copy of VisualHub.


I should also perhaps say that I have no experience writing tutorials, so this may or may not work for you. This is what worked for me... so hopefully it'll work for you, too! :)



Ok. So let's say you've got your iPhone, your mac with Tiger, and a copy of VisualHub.



  • First, you need to be able to script VisualHub. To do that, you're going to have to download this special script dictionary.


    Next you're going to install this script library. To do so you need to (taken right from VisualHub's instructions):



    1) Control-click (right-click if you got 'em) on the VisualHub application, and select "Show Package Contents" from the contextual menu.


    2) Drill down a couple folders. Double-click on "Contents", then "Resources", and finally, "Script".


    3) Drag the "automation.scpt" file you just downloaded into this Scripts folder. You can close the window when done.
    If you did it right, then the next time you open VisualHub its title bar will read "VisualHub 1.x Automation Tech Preview".





  • Now that you can automate VisualHub, you can download the Automator workflow & VisualHub iPhone settings file here.


    The settings file just tells VisualHub to convert to the iPhone format, at a standard ("WiFi") quality, and to automatically add the finished file to iTunes.





  • Next, to install the settings file, you can really do this anywhere you like, but I installed it in my user's documents folder. To do this, just drag the "VisualHub" folder to your documents folder. After installed the path would look like HardDrive/Users/ShortUserName/Documents/VisualHub/settings.vhub.





  • Now that you've instaled the settings file, all you have to do is install the workflow. Double click the "Export to VisualHub" workflow and it should open in Automator.





  • Once it is open, set the correct paths in the applescript. The applescript window in Automator should look like this:



    on run {input, parameters}


    tell application "VisualHub" to set VisualHub to load script
    (scripts path of main bundle & "/automation.scpt" as POSIX file)


    tell VisualHub
    LoadSettings("HardDrive:Users:
    ShortUserName:Documents:VisualHub:
    mysettings.vhub")
    SetSaveLocation("HardDrive:Users:
    ShortUserName:iPhoneVideosFolder)
    AddFiles(input)
    StartConversion()
    QuitApp()
    end tell


    return input
    end run



    Change the two file paths in to the proper locations of the settings file and a folder you'd like the converted video files to download to. Make sure to change "HardDrive" to the name of your hard drive, and "ShortUserName" to the name of your home folder (your short user name) in both paths.





  • All that is left to do is to save it. Now you have to decide how you'd like to use it. You can:


    1) Save it as Finder Plugin.


    2) Save it as a Folder Action.


    Saving it as a Finder Plugin will create a Contextual Menu item in the finder. So, whenever you select a video file you'd like to automatically convert, you'd just control-click (right-click) the file and select "Export to VisualHub" from the "Automator" menu in the pop-menu that comes up.






Saving it as a Folder Action will cause any file that is placed in a specified folder to automatically be converted ti the iPhone format.


Note: If you save it as Folder Action, make sure you have the new iPhone video file saving to a different location (the second file path that you set above) than the original, or you will just have an continuous loop of file conversion going on.


Both methods are useful and its up to which one you choose.


That should be it with any luck. Now you should be able to have just about any video file you'd like automatically converted to the iPhone format for watching on your new iPhone! :D




applescriptautomationautomatorextrasiphonemacsoftwarevisualhub

No comments:

Post a Comment