Counting bandwidth usage in PHP

Here's a question: is it possible, given a bunch of videofiles on your server, to keep track of bandwidth usage with PHP (+ Apache, Linux)? Maybe something like mod_throttle/3.1.2 can help?

I am thinking through different ways of dynamically generating different SMIL files (with PHP) based on how much bandwidth you've used already. The idea is that I can have movie files of different sizes on my server, and if they suddenly become popular, dynamically start serving smaller (more optimized) files, or even just some (SMIL) text saying "sorry, I'm out of bandwidth for movies this month, try again next month".

Ideas for approaches, code, examples or pointers, it's all appreciated. I'm just a beginner here, mucking around with techie stuff I should really leave well alone, trying to make videoblogging easier. Making sure you don't get hit with bandwidth costs is a big part of that.

# Aug 5, 2004