Today I started to create a test environment for a not-yet-written video stream client. The problem: How do I create a HTTP live video stream to test? I tried
ffserver, but it wouldn’t work. Icecast might be interesting, but the stream has to play on Android, which does not support Theora video. In the end, I decided to look if I could find a way to use a normal web server (aka Apache) and limit the transmission data rate to simulate a live stream.
Now I’ve been working with Apache a lot, but this is something I never needed to do. Some online searching showed a number of Apache modules for that purpose, and I decided to use the one for which there is a Gentoo ebuild (and it looked most powerful anyway):
<VirtualHost *:80> ServerName video.example.com DocumentRoot "/var/www/video" CustomLog /var/log/apache2/access_log combined ErrorLog /var/log/apache2/error_log <Directory /var/www/video> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> CBandRemoteSpeed 700kbps 3 3 </VirtualHost>
As you can see, my
mod_cband configuration is rather short. The line sets the limits per remote client, which in this case are a data rate of 700 kbps, 3 requests per second and 3 open connections. I chose 700 kbps because it’s approximately the date rate of the video I used for testing. The other limits aren’t interesting for me, so they’re just randomly chosen. Maybe not optimal, but good enough. 🙂