Channel 9 media hacking

In honor of my first get-together with the MSDN Channel 9 and 10 folks later today, I thought I’d do a spot of media hacking in support of the cause. One of the things that caught my eye recently was Brian Jones’ screencast on data/view separation in Word 2007. It’s published as a SWF (Shockwave Flash) movie and, like other SWF files on Channel 9, it’s delivered into the browser directly, without a controls wrapper. So there’s no way to see the length of the screencast, or pause it, or scroll around in it, or — as I was inclined to do — refer to a segment within the screencast.

I figured it would be a snap to grab the controller that Camtasia Studio emits and tweak its configuration file to point to Brian’s screencast. But that seemingly simple hack turned into a merry chase. It turns out that the Camtasia controller isn’t entirely generic. It embeds (at least) the width and height of the controlled video. I could use Camtasia to create a new controller, but I don’t have that software here with me, and in any case it seems like there should be a way to override those values.

First, though, I took a step back and spent some time looking for a generic SWF component to play back SWFs. For FLV (Flash video) files, I’ve made great use of flvplayer.swf 1. It’s a nice simple widget that does just the one thing I want: it accepts the address of an FLV file as a parameter, and it plays that file. There has to be an analogous swfplayer.swf, right? Well, I looked hard and didn’t find it, maybe someone can enlighten us on that score.

Circling back to the Camtasia controller, I asked myself another question. There has to be an easy way to not only display, but also edit, the header of a SWF file, right? Again, I looked hard and came up empty handed. Now it was a challenge, so I dug into things like SWF::File and Flasm, tools for picking apart and reassembling SWF files. Neither quite did the trick. Then I remembered a tip from Rich Kilmer about Kinetic Fusion, a Java toolkit for roundtripping between SWF and XML. Using it, I was able to convert the SWF to XML, alter the width/height values, and recreate the SWF 2.

I know, I know, this is crazy, there has to be a better way, and I hope someone will enlighten me. But in any case, I finally did succeed, sort of. Here’s a controllable version of Brian’s screencast:

s3.amazonaws.com/jon/9/DataViewSeparation.html

One further complication: I’d hoped to publish only the modified controller and configuration file, leaving the screencast in situ on Channel 9. But the cross-domain nature of that arrangement seems to rule it out. So I wound up rehosting the video on the same server as the controller and configuration file. In this case, just to keep things interesting, that server happens to be my Amazon S3 account.

Anyway, if you’ve made it this far, I can now refer you to the segment of that screencast. At 6:45 (of 9:53), Brian shows how to swap out one batch of XML data associated with a Word document and swap in another. I’ll say more about why I found that interesting in another post. Meanwhile, I’ll be pondering how one of my perennial interests — URL-adddressable and randomly accessible rich media — can help expose more of the considerable value that’s contained in the Channel 9 screencasts.


1. If you’re a Flash developer, it’s trivial to whip up your own playback control. But it’s non-trivial for regular folks who just want to embed videos in HTML pages. These folks find themselves rooting around on the net for components that should be way easier to find and use.

2. If you try this on the Camtasia controller, note that the decompiled XML won’t immediately recompile. The generated ActionScript contains a handful of references to this:componentName that instead should be this.componentName.

10 Comments

  1. Jon, we’ve talked about having a URL format to specify a timecode within our videos…

    something like http://on10.net/blogs/duncanma/StarTrekLegacy/234ms or http://on10.net/blogs/duncanma/StarTrekLegacy/3m32s

    that would resolve to the normal entry URL with the player starting at the time specified…

    It seems quite possible and certainly is on our feature list… we thought it would be a great way to handle some of the work that our ‘clipster’ feature does on C9 today… is this something like you had in mind for “URL-adddressable and randomly accessible rich media” ?

  2. As well as the flv player at jeroenwijering, there’s also a more generic flash media player: http://www.jeroenwijering.com/?item=Flash_Media_Player

    “The Flash Media player supports playback of a single media file of any format the Adobe Flash Player can handle (MP3,FLV,SWF,JPG,PNG or GIF). It also supports RSS/XSPF playlist (with mixed mediatypes), a wide range of flashvars (settings) for tweaking both behavior and appearance and an extensive, documented javascript/actionscript API.”

  3. “we’ve talked about having a URL format to specify a timecode within our videos”

    That’s the ticket. The matrix of possibilities is a bit fearsome: streaming vs progressive download on one axis, multiple formats along another, yet ideally you want a /single/ URL syntax because you don’t want to divide attention streams, instead you do want all of the conversation around identified segments to cluster together.

    If I can be of help, I’ll be interested to work with you guys on this.

  4. Hey Jon,

    I’m at least partly responsible for the Camtasia Studio Flash controller and would love to answer any specific questions you may have via email or IM if you’re so inclined.

    Changing the object/embed tag width and height dimensions should override the hard coded dimensions that are written in to the swf controller (dimensions are hard coded for use cases where files are being played back in the standalone Flash Player). Changing the object and embed dimensions also means that the config.xml file values (video1 dimensions and controller dimensions match as well).

    The folks doing Ruby on Rails screencasts have successfully used the Camtasia Studio controller generically to display their screencasts recorded on the mac so it should be feasible for you to do the same.

    As far as parsing the header goes, the width and height are stored in a packed bit Rect format described in the flash file format specification that can be found on the adobe web site. A cheat sheet of sorts can be found here: http://www.the-labs.com/MacromediaFlash/SWF-Spec/SWFfileformat.html

    Let me know how I can help,

    Brooks

  5. “Changing the object/embed tag width and height dimensions should override the hard coded dimensions that are written in to the swf controller”

    I would have thought so, but I went around and around on that and it just didn’t seem to work that way. One point of confusion for me: it wasn’t clear which width/height values refer to the controller and which to the controllee.

    Based on your feedback, though, I’ll take another look, thanks.

  6. Does anyone know where i can download a version archived or otherwise of Kinetic Fusion?

    i can’t find it anywhere im getting abit desperate. could a kind soul just email it to me? pleeeeeeeeeeeeeeeeeeease, thanx =)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s