To make FLV's coming from flash streaming servers (FCS/FMS/Red5) properly work as a progressive download, it's often required to use a tool to inject 'missing' meta-data.
Up until now I used FLVTool2 for this, but it seems to load the entire FLV into memory (badd!), and now I'm getting nasty errors as well..
ERROR: EOFError ERROR: /usr/local/lib/site_ruby/1.8/flv/amf_string_buffer.rb:37:in `read' ERROR: /usr/local/lib/site_ruby/1.8/flv/amf_string_buffer.rb:243:in `read__STRING' ERROR: /usr/local/lib/site_ruby/1.8/flv/audio_tag.rb:56:in `read_header' ERROR: /usr/local/lib/site_ruby/1.8/flv/audio_tag.rb:47:in `after_initialize' ERROR: /usr/local/lib/site_ruby/1.8/flv/tag.rb:56:in `initialize' ERROR: /usr/local/lib/site_ruby/1.8/flv/stream.rb:447:in `new' ERROR: /usr/local/lib/site_ruby/1.8/flv/stream.rb:447:in `read_tags' ERROR: /usr/local/lib/site_ruby/1.8/flv/stream.rb:58:in `initialize' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:272:in `new' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:272:in `open_stream' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:238:in `process_files' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:225:in `each' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:225:in `process_files' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:44:in `execute!' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2.rb:168:in `execute!' ERROR: /usr/local/lib/site_ruby/1.8/flvtool2.rb:228 ERROR: /usr/bin/flvtool2:2:in `require' ERROR: /usr/bin/flvtool2:2
I wanted to try out FLVTool++ anyway, as it seems like a much more scalable solution.. This is how its installed on debian:
Grab the source:
tar xfvj Flvtool++.tar.bz2
Make sure you have a compiler installed (as root).
apt-get install build-essential
AArrghh! It doesn't compile :(. This is the error it gave me:
g++ -O2 -c -Wall -D_FILE_OFFSET_BITS=64 flvtool.cpp -o flvtool.o AMF.h:35: error: invalid pure specifier (only `= 0' is allowed) before ';' token flvtool.cpp: In function 'int main(int, char**)': flvtool.cpp:192: warning: too many arguments for format make: *** [flvtool.o] Error 1
Ok, lets dig into this code a bit.. the errors seems to give a few useful hints..
First thing I did was go to line 35 in AMF.h and change:
virtual std::ostream& operator << (std::ostream& os) const = NULL;
virtual std::ostream& operator << (std::ostream& os) const = 0;
Next, open flvtool.cpp (line 192) and change:
fprintf(stderr, "usage:\n", argv);
Now, for some reason you also need to manually create the bin/ directory in your source directory, after that you can start compiling again.
mkdir bin make
Success! Your bin/ directory will now contain the flvtool++ binary
./bin/flvtool++ #outputs: flvtool++ version 1640 2007/05/24 14:39:18 usage: flvtool++ <input file> <output file> (<start time> <end time>) flvtool++ -i <input file>