If you’re working with video on the web, you’re most likely transcoding to Flash Video format. Whether you use FFmpeg, On2, or another transcoding package, if you are FLV streaming via lighttpd or nginx, you’ll need to add keyframe metadata to the FLV in order to allow your player to seek to different points in the video that have yet to be downloaded.
Being that our site is built with Ruby on Rails, it was natural for us to leverage flvtool2 (which is written in Ruby) to add this metadata. Lately, we’ve been having intermittent failures with flvtool2 that appear to be related to choppy audio.
Although the ideal way to deal with this issue is for us to fix the problem in flvtool2, given some of the other things that we’re working on we may not be able to look at this near term. One alternative that we’re starting to experiment with is using flvtool++.
We’re in the process of setting this up in a linux environment, but for people interested in trying it out on OS X (we’re using Leopard), here are some instructions on how to install for folks that use MacPorts:
1. Grab the latest http://mirror.facebook.com/facebook/flvtool++/ (thanks Facebook!)
2. sudo port install scons
3. sudo port install boost
4. tar xzvf flvtool++-1.1.tar.gz
5. cd [flvtool++ directory]
6. Add a build path to SConscript:
5. Manually create byteswap.h:
6. scons
7. And voila!
./flvtool++
flvtool++ 1.0
Copyright (c) 2007 Dan Weatherford and Facebook, inc.
http://developers.facebook.com/opensource.php
Published under the BSD license.
usage: flvtool++ [-nodump] [-nomerge] [-tag name value] [input filename] [output filename]
-nodump: do not dump the metadata when done (kinda quiet)
-nomerge: do not keep existing metadata from the input file
-strip: remove all metadata (do not write it to the output file)
-tag name value: Set a metadata tag named 'name' to the (string) value 'value'
Note that manually set tags will override automatically generated tags.
8. To add keyframe metadata to an FLV simply run a command like:
./flvtool++ in.flv out.flv
We hope this is helpful. We’ll keep you posted on how things go as we’re just beginning to experiment on linux.