The metadata generation tool flvtool2 crashes when run on .flv files created using Wowza Media Server Pro.
Solution
There is a bug in flvtool2 1.0.6 which causes a unrecoverable failure when run against a .flv recorded using Wowza Media Server Pro. This problem is easily fixed with a minor modification to the flvtool2 source code. The following instructions assume that flvtool2 is either going to be run on Linux or on Windows from within a Linux emulation environment like Cygwin or MinGW.
Install the ruby and ruby-devel packages on your machine.
Change directory to flvtool2-1.0.6/lib/flv and open the file audio_tag.rb in a text editor.
Navigate to line 47 and change the code as follows:
from:
def after_initialize(new_object)
@tag_type = AUDIO
read_header
end
to:
def after_initialize(new_object)
@tag_type = AUDIO
if data_size > 0
read_header
end
end
Change directory up two levels (cd …/…) and execute the following commands to rebuild and install the flvtool2 application:
You are done. The tool should now function properly.
I have submitted a bug to the flvtool2 team to try and get this resolved in a future release of the application. I will add a post to this thread when/if I hear back.
NOTE: I believe this problem will also occur with .flv files recorded using Flash Media Server.
Alternatively… I was able to get this working without having to recompile it… just edited the file: vi /usr/lib/ruby/site_ruby/1.8/flv/audio_tag.rb and then re-ran the command… and it worked! I didn’t have to download the source and recompile…
There is no possibility to get my windows server ready for emulating linux as described.
Is there any way to compile the corrected source as a win32 binary in order to work with wowza recorded flv files?
Has anybody done this before or is there a way to download such an flvtool2.exe already?
Thanks for your help
Mierco
Hi Mierco
i would like to know if you have got the binaries of the FLVtool2 which has changes as charlie pointed out so that it wud edit the flv files streamed from the FMS server
I used the fix but still ran into problems with a ffmpeg h264-encoded stream. I went through the ruby code to see where it went wrong, and in fact it’s where the code tries to extract the width and height from each video frame. The code was written before h264 was added to the FLV spec. So, I wrote a fix for it and decided to share it here.
In the file (video_tag.rb), in the function read_header, after parsing the codec_id, check if it equals H263 or SVC and only read further if it does.