michael-mccracken.net

Instant replay in QuickTime Player

A feature I really miss from having a DVR is the ‘8 seconds back’ button, to catch a play or repeat something funny.

Recently I’ve been listening to recorded interviews we’ve been doing of HPC developers, and updating my notes (in VoodooPad using them. Since people mumble and use jargon I don’t always understand, I decided I really needed an instant replay button in QuickTime Player. It’ll come in handy if I watch sports on my laptop again, too.

In order to get it, I wrote this quick AppleScript and bound it to a Quicksilver trigger. If you run it while the movie is playing, it backs up 4 seconds and keeps playing from there.

-- 4secondsback.scpt
tell application "QuickTime Player"
    set theMovie to movie 1
    
    set ctime to current time of theMovie
    set tscale to time scale of theMovie
    
    set current time of theMovie to ctime - (4 * tscale)
end tell

Update: I just realized that for transcribing interviews I also needed a ‘play/pause’ command that could control QuickTime Player while keeping it in the background, just as the 4secondsback script does. It’s a really simple script, but since QuickTime Player lacks the convenient ‘playpause’ command that iTunes’s scripting dictionary has, I had to do this:

tell application "QuickTime Player"
    if movie 1 is playing then
        pause movie 1
    else
        play movie 1
    end if
end tell

I have this set as a trigger for Control-Option-Space, and the 4secondsback script is control-option-’b’. This way I can listen, type, and control the recordings without leaving VoodooPad. Brilliant!

Comments:
  1. August 1st, 2006 | 1:16 pm

    [...] In relation to my previous post about instant replay in QuickTime Player - The script dictionary almost looks like a program wrote the documentation. For example: [...]

  2. August 1st, 2006 | 8:09 pm

    4secondsback.scpt is a bit wordy? I know, I know, even by AS standards. This works too:

    tell application “QuickTime Player” tell movie 1 set current time to current time - (4 * time scale) end tell end tell

    Didn’t notice time scale before — here I’ve been using the raw 600 “ticks” per second in my scripts. Thanks!

  3. Administrator
    August 1st, 2006 | 8:32 pm

    Hey, I forgot that you could use something that wasn’t an application as the target of a ‘tell’ block… good point.

    Really, most of my applescripts are super wordy, because almost without fail, the first attempt I make fails, and they get excessively verbose while trying various versions of what ’should work’ to debug the script - invariably, the final working script is half the size of the largest intermediate and could probably stand to be shortened significantly even so.

    In order to protect my ego, I consider this to be a failing of AppleScript and its poor error messages and debugging support…

  4. Tobias
    August 2nd, 2006 | 4:34 am

    http://www.inquirium.net/products/inqscribe/ is specifically made for this, but at 1.5.2 still only beta quality. You gave me courage to try replicating timestamp-jumping in AppleScript, using QT and some text editor.

  5. Administrator
    August 2nd, 2006 | 11:33 am

    Inqscribe looks really handy, but good lord - $70?!

    Good luck with your scripting, Tobias!

  6. Silks
    August 8th, 2006 | 4:14 pm

    is there a way to use this script without installing QS? i’d really rather not install it. thanks.

  7. Administrator
    August 8th, 2006 | 4:21 pm

    Silks: I’m not sure why you wouldn’t want to install QuickSilver, but aside from that, all this script needs is to be run. You can save it as an application in Script Editor and run it like that.

    You can double click it, maybe put it in your dock, or find any number of other hotkey programs instead of QuickSilver to use it with instead.

  8. August 12th, 2006 | 12:20 am

    [...] Instant replay in QuickTime Player: “A feature I really miss from having a DVR is the ‘8 seconds back’ button, to catch a play or repeat something funny.” (tags: useful reference macintosh) [...]

  9. December 1st, 2006 | 3:09 pm

    [...] While flipping through Michael McCracken’s blog, I found his blog post about his instant replay in QuickTime Player script, and decided that that would be a good thing to have in iTunes (especially when I want to quote some George Carlin to somebody). [...]

  10. March 28th, 2008 | 11:46 am

    Nice job on this script. I might implement something lik this in a QT based version of StarPlayr.

    gt :-)

  11. March 28th, 2008 | 11:50 am

    By the way,

    This might the least wordiest version of this script:

    tell document 1 of application “QuickTime Player” set current time to current time - (4 * time scale) end tell

    You can combine the tell into one statement instead of two.

    Here is one more variation:

    tell document 1 of application “QuickTime Player” to ¬ set current time to current time - (4 * time scale)

Leave a reply

Feed, Endorsements & other Links

my bookmarks

© 2005 - 2007 Michael McCracken.