Video Scrubber

This workspace uses QuickTime Player as a helper application to allow you to visually locate and set the start time (in point) and end time (out point) of a Video cue in QLab. The example described in this chapter uses QLab 5, but there are downloadable examples for QLab 3 and 4 as well. The scripts will work with any version of QLab, and only require any reference to application id "com.figure53.qlab.5" to be changed to application id "com.figure53.qlab.3" or application id "com.figure53.qlab.4". The ability to insert slice markers at the current time in QuickTime Player is only available when using QLab 4 or 5.

Here it is in action:

How It Works

This workspace is best used with MIDI triggers, rather than hotkeys, since those will continue to work in QLab even when QuickTime Player is in the foreground. The example workspace also has hotkeys assigned so that you can play around with it even if you don’t have a MIDI device. The number of the cue is the hotkey trigger in square brackets, which is a useful convention for cues which are only usually triggered with hotkeys.

The first Script cue, triggered by MIDI note 60 or hotkey “K”, locates the target media for the selected Video cue, and opens that file in QuickTime Player. It also works for Audio cues, although there’s nothing particularly useful about opening audio files in QuickTime Player.

set userApplication to application "QuickTime Player"
tell application id "com.figure53.qlab.5" to tell front workspace
  set selectedCue to last item of (selected as list)
  if q type of selectedCue is in {"Video", "Audio"} then
    set fileTarget to file target of selectedCue
    ignoring application responses
      tell userApplication
        open fileTarget
        activate
        end tell
    end ignoring
  end if
end tell

You can then find the in point you want by scrubbing or using any other control in QuickTime Player. Useful controls are:

  • J - Play in reverse getting faster with each key press.
  • K - Stop
  • L - Play forward getting faster with each key press.
  • Right arrow - one frame forward
  • Left arrow - one frame back

Once you’ve found your in point, the Script cue triggered by MIDI note 62 or hotkey I transfers the current time from QuickTime Player to the start time of the Video cue in QLab:

tell application "QuickTime Player"
  set thecurrenttime to current time of the front document
end tell

tell application id "com.figure53.qlab.5" to tell front workspace
  set thisCue to last item of (selected as list)
  set inPoint to thecurrenttime
  set start time of thisCue to inPoint
end tell

You then find the out point in QuickTime Player and use MIDI note 64 or hotkey O to trigger another Script cue, which transfers the current time from QuickTime Player to the end time of the Video cue in QLab:

tell application "QuickTime Player"
  set thecurrenttime to current time of the front document
end tell

tell application id "com.figure53.qlab.5" to tell front workspace
  set thisCue to last item of (selected as list)
  set outPoint to thecurrenttime
  set end time of thisCue to outPoint
end tell

MIDI note 65 or hotkey J will close the file in QuickTime Player:

set userApplication to application "QuickTime Player"
tell application id "com.figure53.qlab.5" to tell front workspace
  activate
  ignoring application responses
    tell userApplication
      close front document
    end tell
  end ignoring
end tell

In QLab 4 and 5 you can also insert slice markers at the current time or on the fly if QuickTime Player is playing. MIDI note 63 or Key M runs this script:

tell application "QuickTime Player"
  try
    set thecurrenttime to current time of the front document
    end try
  end tell

tell application id "com.figure53.QLab.5" to tell front workspace
  try
    set inPoint to thecurrenttime
    set theOSC to "/cue/selected/addSliceMarker " & (inPoint as text)
    do shell script "echo " & quoted form of theOSC & " | nc -u -w 0 127.0.0.1 53535"
  end try
end tell

This script uses a special technique, which is useful when an OSC method exists that does not have an AppleScript equivalent. A shell script sends the OSC message as plain text to port 53535.

Finally, there is a script to reset start and end times and delete the slice markers of the selected cue. MIDI note 63 or Key M runs this script:

ttell application id "com.figure53.QLab.5" to tell front workspace
  try
    set thisCue to last item of (selected as list)
    set start time of thisCue to 0
    set end time of thisCue to 999999
    set theOSC to "/cue/selected/deleteSliceMarkers"
    do shell script "echo " & quoted form of theOSC & " | nc -u -w 0 127.0.0.1 53535"
  end try
end tell