Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create a mosaic of movie clips in QuickTime Player Apps
Like many out there, I like to download clips from various video sites, as well as make my own. Being a child of the modern age, with attention spans being what they are, I like watching many clips at once in some cases.

I make this easier, I wrote this script as a "front end" for QuickTime Player. It will accept drag-and-drop files and open them in the player. It can also be double-clicked to run on all open files in the player. Either way, it will figure out the best use of the space available on the display (actually it uses the Desktop bounds; not quite what I want, but it works). It then distributes the windows into a mosaic (matrix) and starts them playing. It also sets looping on, and turns off player controls (wish I could get rid of title bars, too!).

Here's the code:
on open filelist
  tell application "QuickTime Player" to open filelist
  run
end open
on run
  tell application "QuickTime Player"
    set ratio to 4 / 3
    
    tell application "Finder" to set display_bounds to bounds of window of desktop
    set display_width to (item 3 of display_bounds)
    set display_height to (item 4 of display_bounds) - 42 -- menu height + title bar
    set window_count to count of windows
    set max_pixels to 0
    repeat with potential_cols from 1 to window_count -- try all possibilities - hardly optimal but who cares.
      set potential_rows to round (window_count - 1) / potential_cols + 1 rounding toward zero
      set {potential_window_width, potential_window_height} to {round display_width / potential_cols rounding toward zero, round display_height / potential_rows rounding toward zero}
      if potential_window_width / potential_window_height < ratio then
        set {potential_window_width, potential_window_height} to {potential_window_width, round potential_window_width / ratio rounding toward zero}
      else
        set {potential_window_width, potential_window_height} to {potential_window_height * ratio, potential_window_height}
      end if
      set used_pixels to potential_window_width * potential_window_height * window_count
      if used_pixels > max_pixels then
        set {window_width, window_height, cols, rows} to {potential_window_width, potential_window_height, potential_cols, potential_rows}
        set max_pixels to used_pixels
      end if
    end repeat
    
    set {x, y} to {0, 0}
    set wins to (get every window)
    repeat with win in wins
      set doc to document of win
      set controller type of doc to none
      set looping of doc to true
      set {wi, hi} to natural dimensions of doc
      if wi / window_width > hi / window_height then
        set dimensions of doc to {window_width, hi / (wi / window_width)}
      else
        set dimensions of doc to {wi / (hi / window_height), window_height}
      end if
      set x to x + 1
      if x = cols then set {x, y} to {0, y + 1}
    end repeat
    
    set {x, y} to {0, 0}
    set wins to (get every window)
    repeat with win in wins
      set {wi, hi} to natural dimensions of doc
      if wi / window_width > hi / window_height then
        set bounds of win to {window_width * x, 22 + window_height * y, window_width * x + window_width, 22 + window_height * y + hi / (wi / window_width)}
      else
        set bounds of win to {window_width * x, 22 + window_height * y, window_width * x + wi / (hi / window_height), 22 + window_height * y + window_height}
      end if
      set x to x + 1
      if x = cols then set {x, y} to {0, y + 1}
    end repeat
    set wins to (get every window)
    repeat with win in wins
      play document of win
    end repeat
    activate
  end tell
end run
Copy and paste the above into Script Editor, and save it as an Application. That's it. To use it, drag/drop movies onto the app, or just double-click it to run.

I opened about 50 files this way as a test, and while it took a bit of time to complete the task, they all played mostly at full FPS on my MacBook Pro -- kind of impressive, actually.

[robg adds: This worked when I tested it, though I used substantially less than 50 different clips.]
    •    
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[10,845 views]  

Create a mosaic of movie clips in QuickTime Player | 11 comments | Create New Account
Click here to return to the 'Create a mosaic of movie clips in QuickTime Player' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a mosaic of movie clips in QuickTime Player
Authored by: Pedro Estarque on May 18, '09 11:44:08AM

Really nice indeed.
Make sure "Show Content Guide Automatically" is disabled in your preferences or you'll get a "Can't divide by zero" error.



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: cregy on May 23, '09 12:37:11AM

I have a new error on a Macbook.

Finder got an error: Can't get bounds of window of desktop.

Any ideas please?

Thanks

Rich



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: willgonz on May 18, '09 03:47:51PM

This is handy when you are looking at surveillance videos.



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: Cliffo on May 18, '09 09:33:17PM

Actually, I think that would be a brilliant use for this tip! Thanks to the OP for the tip and this poster for an excellent suggestion!



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: osxpounder on May 18, '09 09:21:21PM

Great idea. Thanks!

I have done something similar manually, when putting together some music videos of sports footage. I had captured all of the plays the clients had logged, plus some b-roll, so I had lots of clips to work with.

I opened dozens of clips in QT Pro, shrunk each to Half Size (Cmd-0, as in "zero"), toggled looping (Cmd-l, as in "L") and then moved them around on the screen so I could see a "wall of videos". Then I rearranged them on the screen occasionally, to help me sort of "storyboard" a bit. I found this quicker than trying to review & compare the clips in Final Cut Pro.

I wish I'd had your tip then -- it would have saved me some clicking and dragging! I was already doing a lot of that.



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: fabache on May 19, '09 06:27:31AM

[robg adds: This worked when I tested it, though I used substantially less than 50 different clips.]

I believe you mean you used fewer than 50 clips, right?



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: Nikonman on May 19, '09 07:34:30AM

The mosaic is a neat trick. I'd just like to be able to link all the little movie clips together into one so I don't have to watch five or six clips of the same subject. (clip 01,02,03,etc.)



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: mark-levine on May 19, '09 08:11:11AM

Terrific! Can you save the resultant mosaic file and include it in an iWeb (or other) website?

---
Cheers, Mark



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: bodatnow on May 27, '09 09:45:11AM

I see no answer. I too would like to create a QT file of the video wall for use on my website and inclusion as part of a Final Cut movies.



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: bodatnow on May 27, '09 10:08:46AM

I would like to create a QT file of the video wall to include in a movie and my website...suggestions ??



[ Reply to This | # ]
Create a mosaic of movie clips in QuickTime Player
Authored by: cashxx on Feb 03, '13 06:51:10PM

Doesn't work anymore....was looking to use this in OS 10.8.2 but errors when compiling on "set controller type of doc to none".

Syntax Error
A class name can't go after this identifier.

Can someone please fix this?



[ Reply to This | # ]