Lo and behold, high quality HD video recording over slow connections is finally possible with Red5.
But 1st… some history.
Video recording with Red5 has been plagued for a long time by various issues. All this time developers and their clients had to resort to rather expensive Adobe Media Server and Wowza licenses to add quality video recording to their website.
Here’s a recent excerpt from a discussion on the Red5 mailing list about it’s recording capabilities:
From: Angry Red5 User & Developer
Subject: Does anybody succeed in recording valid FLV videos in ANY version of Red5?
Date: Feb 13 2014
I am fighting with Red5 recording from about 2-3 yers. And the sad truth is, that it propably NEVER worked.
Dont achieve simple succesful recording in any single version – it is a shame.
The last nail in the coffin with Red5 1.0.x
We’ve experienced our own issues in the past but none were as painful as the no-video-only sound-in-flv’s bug we experienced when recording video over slow connections in Red5 1.0.x . The resulting flv video files were devoid of video content. Entire 1 minute clips were turning out to contain just 1 or 2 video keyframes, the rest was audio (we were using yamdi to extract the keyframe data from .flv files).
On top of that, this was happening only when fileconsumer.delayed.write was turned on in conf/red5.properties. The delayed write mechanism was introduced in Red5 1.0 to account for Flash Player’s prioritisation of audio packets over video packets when broadcasting over slow connections but in Red5 1.0.x it was clearly not working. Instead of waiting more for the video packets and mix & sort them with the audio packets, it was doing more harm resulting in flv files devoid of any video data.
Giving back to open source
So, last week, after Red5’s official 1.0.2 release – which didn’t fix the issue – , we’ve finally decided give it a try and investigate the no-video-only sound-in-flv’s issue. Because the way of open source is such that you can download the source code and play with it, we did just that and downloaded the latest Red5 source code from GitHub and started looking at the video recording classes (src/main/java/org/red5/server/stream/consumer/FileConsumer.java).
12 hours later:
- we had identified the issue ( I described it in detail in the Red5 mailing list thread )
- fixed it
- confirmed the fix with different recording scenarios, various codecs and queue sizes
- 2 other developers confirmed it as well with good results
- submitted a patch to the Red5 team
- The Red5 team committed the changes to the official Red5 source code (with my name on it 😀 ).
Our patch is now part of the Red5 source code and it will be included in the next Red5 build. Until then you can download the build below compiled by us and give recording another chance:
Red5-server-1.0.3-SNAPSHOT_with_recording_fixed.zip (Download 45.9MB)
This Red5 build includes:
- Our patch for the video recording process
- fileconsumer.queue.size is set to 120 (in conf/red5.properties) which should be enough for 2 minutes of HD video recording.
You can find more info about what fileconsumer.queue.size is in the updated “Recording HD Video With Red5” HDFVR documentation.
This Red 5 build produces:
- crisp HD video over slow connections
- flv files with synchronised and properly distributed audio and video frames
[DEMO] You can test this build at:
For any developer new to doing video recording here are the 4 steps you need to take to record high quality, crisp, properly synchronised, HD videos with Red5:
- Download and install Red5-server-1.0.3-SNAPSHOT_with_recording_fixed.zip
- Download HDFVR ( 1.1 build 609 or later needed )
- Install HDFVR using the Red5 1.0.2 hdfvr web apps folder (in the HDFVR archive)
- Open http://yourwebsite.com/hdfvr/VideoRecorder-hd.html and record a HD video
- Done, you now have new crisp HD video content for your website