Flash Media Server is the leading server for on-demand and live video delivery, but there are some nice features in the interactive edition (FMIS) of the server that are less well known. Flash Media Interactive Server 3.5 supports a feature to record H.264/AAC streams. In combination with some server-side Actionscript, you can actually use this to edit and export video clips as H.264 .f4v files.

An example would be a DVR enabled live event. To export highlight clips during the event in real time, it’s possible to create a server side playlist (e.g. first an opener, then a selected part of the live recorded event, then a section of an archived clip), and create a physical copy of this playlist as .f4v file – no special playlist logic required to play these clips, just point your streaming player to the exported .f4v file.

The key to enable this is the server-side Stream class. The following is an example how to create a server-side playlist and save it as a file.

// Set up the server stream.
application.myStream = Stream.get(“foo”);
if (application.myStream){
  // Like the previous example, this server stream
  // plays “Live1”, “Record1”, and “Live2”
  // for 5 seconds each. But this time,
  // all the data will be recorded to a recorded stream “foo”.
  application.myStream.record();
  application.myStream.play(“Live1”, -1, 5);
  application.myStream.play(“Record1”, 0, 5, false);
  application.myStream.play(“Live2”, -1, 5, false);
}

This works with live DVR, live streams and on-demand files, but might depend on keyframe positions for accurate edits. The clips don’t need to be located on the same server. It’s possible to point to external clips on other FMS and add them to the playlist.

The exported F4V file works with Flash Media Server, but needs to get patched with the Adobe F4V post processor command line tool to work as progressive download. Enjoy.