LearningAPI has moved to a new blog!

The learningapi blog has moved to a new URL. These posts will remain here, but all new content has moved to learningAPI.com: Digital Media, Streaming Video & Educational Technology. You may also subscrdibe to the RSS feed for the new learningAPI.com blog.

October 11, 2006

Video Editing Online - A Keyframe Extraction Script

Video processing and editing online is becoming a more common occurrence as video sharing and hosting sites are finally catching on.  YouTube, of course, is the one getting all the press this week with Google's $1.6B acquisition.  But other sites have begun offering some very impressive video editing capabilities on the Web.  EyeSpot and JumpCut (owned by Yahoo!) both offer simple, but capable, video editing, including some combination of cuts, remixes, transitions, effects, and audio tracks.  

What's new about this is that it's all done over the Web.  Tools like Apple's iMovie or Final Cut Pro, Adobe Premiere, Avid Liquid or Pinnacle Studio and others are more powerful, sure.  But being able to do this on the Web from any computer at any time, with no software to buy or install, is very cool.

That got me to wondering about the engines behind these sites -- is it all custom code or are there vendors developing and separately selling parts of these solutions?  My initial digging around didn't answer that question, but it led me to one rather simple, but very interesting video manipulation tool called VideoScript.  

Available on Windows and MacOS, VideoScript is a free tool that lets you write simple Basic-like code that manipulates, analyzes, assembles and edits video.  Record time-lapse movies, detect motion in video frames, subtract backgrounds, extract keyframes, blend and composite frames...it's all here and it's suprisingly simple to do.  It's not entirely bug-free - I found that my own first script, which extracts keyframes from a QuickTime movie (based on diff'ing frames and extracting as a JPG any frame that differs more than 25% with its predecessor) and writes an HTML page to look at them, tended to hang the program upon completion.  But it's a neat tool and sheds some light on how folks who aren't Google or Yahoo can do some Web-based video manipulation of their own.

My first VideoScript program, its source code, and its output is here in the extended entry:

Extracting keyframes from movie using VideoScript

Link to original movie on Harvard University's Video Archives

This is a movie assembled from just these keyframes

And here is the relevant part of the source code:
 set frame_count to (length of m) - 1;
 set new_movie to movie;
 set keyIndex to 0;
 set keyFrame to m[0];

 set n to 0;
 set i to 1;
set myHTML to "><html><head><title>Video Keyframe Extraction with VideoScript</title></head><body><br><br>";
    repeat frame_count times increment i
      set currentFrame to m[i];
      set diff to Math.Difference(currentFrame, keyFrame);
         if (diff > 0.25) then
  	 set n to n+1;
         append keyFrame to new_movie;
         set file "frame"+n+".jpg" to keyFrame;
	set myHTML to myHTML + "<img src='frame"+n+".jpg' style='border: 4px grey outset;width: 90px; height: 70px;'>\n";          
        set keyIndex to i;
        set keyFrame to m[i];
set file "keyframes.html" to myHTML as text;     
set file "keyframes_only.mov" to new_movie;

TrackBack URL for this entry:

Listed below are links to weblogs that reference 'Video Editing Online - A Keyframe Extraction Script' from learningAPI.com: Media and Learning Technology - Larry Bouthillier.
Pinnacle Video Editing Software
Excerpt: Avid Technology announced the latest version of it
Weblog: Pinnacle Video Editing Software
Tracked: May 23, 2007 01:26 AM


Great post, thanks for all the info

Post a comment