I’m lost at sea. I’ve spent hours reading, installing, testing and I still can’t see how I’ll achieve my goal. It’s quite simple, really. I want to build a website that will allow me to:
record video using a webcam (flash)
concatenate such videos (ideally with videos of other formats)
be completely automated, using any combination of linux servers (on ec2) and commercial hosts if needed.
After a bit of research, I thought this would be pretty easy.
red5 is a cross platform solution to enable video recording. Alternative solutions would be Wowza or a hosted solution like influxis.com/uvault/…
ffmpeg is a cross platform tool that can deal with flv and other formats; there’s also mencoder that could help.
I didn’t find installation easy, but managed to have everything running both on my Mac and on Ubuntu. Where things fail miserably though:
- I can’t get a flv recorded with a fixed frame rate
- I have problems concatenating flvs
I do manage to record flvs. The beginning is always “jumpy” for some reason. If I play them back in Wimpy FLV Player, it plays alright, but the progress indicator doesn’t move smoothly or in a regular fashion.
If it plays OK, why should I worry about the progress indicator? The problem is that I can’t seem to transcode it to anything else using ffmpeg.
A naive “ffmpeg -i input.flv output.avi” will not work because the frame rate is wrong (1000.0). If I specify 15 fps explicitely by using “ffmeg -i input.flv -r 15 output.avi”, the visual is not synchronized properly with the audio because of the beginning part.
I tried multiple other techniques of recording and always some kind of problem at the beginning of the flv:
- a) Using red5 (v 0.6.3 and 0.7.0, both on OS X 10.5.4 and Ubuntu 8.04) and the publisher.html example it includes. Here’s the resulting flv.
- b) Still using red5, but publishing “live” and starting the recording after a couple of seconds. I used these example files. Here’s the resulting flv. The indicator still jumps to the end very rapidly, no sound at all with this method…
- c) Using Wowza Media Server Pro (v 1.5.3, on my mac). The progress indicator doesn’t jump to the end, but it moves more quickly at the very beginning, so the visual is not synchronized properly with the audio because of the beginning part. Just to be sure I tried the video recorder that comes with it, as well as red5’s publisher (with identical results).
- d) Using Flash Media Server 3 via www.influxis.com. I get yet another progression pattern. The progress indicator jumps a bit a the beginning and then becomes regular. Here’s an example.
I know it is possible to record a “flawless” flv because facebook’s video application do it (using red5?) Indeed, it’s easy to look at the HTML source of facebook video and get the http URL to download the Flvs they produce. When played back in Wimpy, the progress indicator is smooth, and transcoding “ffmeg -i facebook.flv facebook.avi” produces a good avi. Here’s an example.
OK, that should be easy enough, right? There’s even a full code example in the ffmpeg FAQ.
Well, pipes seem to be giving me problems, so let’s keep it simple and use normal files. Also, if I don’t specify a rate of 15 fps, the visual part becomes extremely fast. Let’s make it easier and simply try to concatenate the same ‘input.flv’ to itself instead of dealing with two different inputs. The example script thus becomes:
1 2 3 4 5 6 7 8 9 10 11
a) Why doesn’t the example script work as advertised, in particular why do I not get all the video I’m expecting?
b) Why do I have to specify a framerate while Wimpy player can play the flv at the right speed?
The only way I found to concatenate two flvs was to use mencoder. Problem is, mencoder doesn’t seem to concat flvs:
1 2 3
I get a Floating point exception…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
c) Is there a way for mencoder to decode and encode flvs correctly?
So the only way I’ve found so far to concat flvs, is to use ffmpeg to go back and forth between flv and avi, and use mencoder to concat the avis:
1 2 3
d) There must be a better way to achieve this… Which one?
Because of the problem of the framerate, though, only “clean” flvs (like facebook’s) will be converted correctly to avis.
Any help would be very appreciated.
I came to the conclusion that there is no existing solution, so I rolled my own. I’ll release flvedit soon, but if you need to join FLVs before ‘soon’, you can let me know!