Mac Applescript to automatically encode video

MacFan25863

macrumors 6502a
Original poster
Jun 20, 2004
557
0
Hi everyone,

I'm in my school's TV Production class. We produce a live 10 min. news show everyday which is broadcast to the school. Right now, we are just about to finish up our website, and would like to be able to post the show onto it everyday.

Right now, we record every show directly to DVD through a set-top DVD Recorder. I want to make an Applescript that will, when the DVD is inserted into our PowerMac, open Handbrake, rip the DVD using certain (web-friendly settings), then upload the newly created file into a special directory on our webserver. I've already written a PHP script that will detect the file on the server and add it to the index of viewable shows.

So, basically, I need something that will be able to do this:

-Open Handbrake
-Select the DVD in Handbrake
-Confirm and/or set Handbrake settings to a web-friendly form
-Rip the DVD
-Take new MOV and upload it to a web server
-(maybe..it would be a nice feature) Eject the DVD

Without any user intervention. I tried making an automator script for this, but I don't know how to integrate automator with Handbrake.

I have no experience using Applescript at all. Anyone have an idea on how I could accomplish this, or point me in the right way to learn the AppleScript I need to do it?

Thank you!
 

MacFan25863

macrumors 6502a
Original poster
Jun 20, 2004
557
0
live4ever said:
Handbrake is not AppleScriptable so unless you want to add that ability to the source it can't be done.

You could use MEncoder through Terminal.app and call it with a shell script.
http://axljab.homelinux.org/Mencoder_DVD_to_MPEG-4
I have no clue how to do any of that...I don't know anything with linux or the terminal..all my experience is in web programming.


Is there a DVD ripping application that I can run applescript through?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
3
MacFan25863 said:
I have no clue how to do any of that...I don't know anything with linux or the terminal..all my experience is in web programming.
Well get to learnin'! ;)
 

MacFan25863

macrumors 6502a
Original poster
Jun 20, 2004
557
0
kainjow said:
Well get to learnin'! ;)

Thats why I came here...I'm hoping to get pointed in the right direction to write an AppleScript application. The link he posted is helpful to understand how to rip the DVD (though I didn't understand it that much), but I still need help with everything else, and how to incorporate the mplayer into applescript.
 

mduser63

macrumors 68040
Nov 9, 2004
3,038
30
Salt Lake City, UT
You *may* be able to use GUI scripting to script Handbrake. What you're asking for is a lot of work, so I don't think anyone here is going to do it for you. However, if you look into GUI scripting using AppleScript and a program called Prefab UI Browser, that should be a good start.

To be honest, if MEncoder will do what you want, that might be less of a learning curve. I know you don't have any experience with Terminal and shell scripting, but you don't have any experience with AppleScript either, and using GUI scripting to control a non-scriptable app is quite advanced.

Scripting Terminal and/or using the "do shell script" command in AppleScript will let you control MEncoder (or any command-line app) via AppleScript.
 

MacFan25863

macrumors 6502a
Original poster
Jun 20, 2004
557
0
mduser63 said:
You *may* be able to use GUI scripting to script Handbrake. What you're asking for is a lot of work, so I don't think anyone here is going to do it for you. However, if you look into GUI scripting using AppleScript and a program called Prefab UI Browser, that should be a good start.

To be honest, if MEncoder will do what you want, that might be less of a learning curve. I know you don't have any experience with Terminal and shell scripting, but you don't have any experience with AppleScript either, and using GUI scripting to control a non-scriptable app is quite advanced.

Scripting Terminal and/or using the "do shell script" command in AppleScript will let you control MEncoder (or any command-line app) via AppleScript.

Of course I don't want anyone to do it for me! I'm just hoping to find an easy way to accomplish this.

Another option I have is importing it directly into iMovie using a dv cam as a bridge. Can applescript control iMovie, so that when we finish recording onto the computer, it automatically exports it and uploads it?

We also have Final Cut Pro, but I'm guessing iMovie is eaiser to script for.
 

mduser63

macrumors 68040
Nov 9, 2004
3,038
30
Salt Lake City, UT
MacFan25863 said:
Of course I don't want anyone to do it for me! I'm just hoping to find an easy way to accomplish this.

Another option I have is importing it directly into iMovie using a dv cam as a bridge. Can applescript control iMovie, so that when we finish recording onto the computer, it automatically exports it and uploads it?

We also have Final Cut Pro, but I'm guessing iMovie is eaiser to script for.
Final Cut Pro is not scriptable via AppleScript IIRC (shame), and I don't think iMovie is scriptable either. QuickTime on the other hand is scriptable, and assuming you have QuickTime Pro (you should, it comes with FCP) it should be able to do everything you want. It can capture video and export it in all the same formats as iMovie/FCP. I'm pretty sure AppleScript itself is capable of doing uploads to servers, but you could also use a scriptable FTP application like Fetch or Transmit.

AppleScript, like any programming language, has a learning-curve associated with it, but it's very rewarding and useful. You might be well-served by buying a book on the subject. AppleScript: The Missing Manual is a good, easily-read introduction, and there are other more comprehensive, technical books available.
 

MacFan25863

macrumors 6502a
Original poster
Jun 20, 2004
557
0
Awesome! Thanks for all the help guys.

We ended up training a student service from the next class to take the video, import it into iMovie, export from iMovie with "web settings" and upload it to the site. Maybe I'll look into scripting it when I learn more programming.
 

Mr. Mister

macrumors 6502
Feb 15, 2006
440
0
My school does the same thing, and the video production class ended up using Youtube or Google video, which was good because it loaded quickly with the streaming flash content, offloaded all the loading to YouTube or Google's servers instead of the school ones, and also let you rate them if you were a YouTube/Google Video user that stumbled upon them.

Then you can either watch them from the Directors' page on YouTube or have them embedded in a simple HTML page on the website.
 

MacFan25863

macrumors 6502a
Original poster
Jun 20, 2004
557
0
Mr. Mister said:
My school does the same thing, and the video production class ended up using Youtube or Google video, which was good because it loaded quickly with the streaming flash content, offloaded all the loading to YouTube or Google's servers instead of the school ones, and also let you rate them if you were a YouTube/Google Video user that stumbled upon them.

Then you can either watch them from the Directors' page on YouTube or have them embedded in a simple HTML page on the website.

We thought about that, too, but our school blocks both of them.