Friday, March 04, 2005

Thoughts on Streaming Media

Here are some random thoughts.

Well there are three main types of players: Real, Quicktime, and Windows Media Player. They all use different protocols. Most media players have two network “connections”. One for control and one for data. RTSP is the standard control channel. RTP is the standard data channel.

For Microsoft Windows Media Player they use MMS, a proprietary protocol, instead of RTSP. The data channel is also proprietary of course.

None of the players can use the other's streaming protocol. Apple and Real have open software versions of the server software so you can take a look at it. Apple’s is called Darwin. Real’s is called Helix. Interestingly they both say they support RTSP. If this is true why can't you play a Real stream with a Quicktime player? Maybe it's a codec issue, not a protcol issue.

Typically the data channel is UDP and has the encoded video/audio. The control channel send messages like “play” or “pause”. See the RTSP spec for details.

There is also support for multicast but most places don’t enable multicast so that’s probably not a big issue….

For monitoring there are well known ports used by these players. Each company has documentation on how to configure firewalls so the traffic can get through. This would be a good place to look for information on which ports each player type uses.

These players can also get their content via HTTP. Real has a “cloaking” mode where they send RTSP and maybe RTP over an HTTP connection. This is to fool proxies. You might be fooled by it as well if you base your traffic monitoring on ports only.

Generally the players will try multiple methods to get the data from the server. HTTP is the final fallback.

There is an open source media player for linux called mplayer. It can handle mms. If you want the mms details you could look at that code I believe. They might be using windows DLLs for that though, I’m not sure.

Monday, September 27, 2004

How to show all ip addresses in access_log

Given a standard access log, print out all the ip addresses in the log:

% awk '{ if (NF>1) print $1}' < access_log

If you want to just print the unique ones:

% awk '{ if (NF>1) print $1}' < access_log | sort -u

I you just want to know how many unique visit's you've had:

% awk '{ if (NF>1) print $1}' < access_log | sort -u | wc -l

Note that the last one will count all the accesses from behind a proxy (like AOL's) as the same visit. So it's not perfect but it's a first cut.

How to start Apache

To start the apache server at boot time:

% apachectl start

To make sure apache starts at boot time:

  • edit /etc/rc.local
  • add "apachectl start"

This works for Apache 2.x on Fedora Linux. It will probably work on a lot of other versions as well.

Wednesday, September 22, 2004

Vonage and Tivo

I use Vonage for my phone service and I've had some trouble with my Tivo being able to make calls. After a bunch of scouring of the internet and bunch of trial and error, I have a solution that seems to work.

When making a data call (like a fax call) using Vonage they recommend that you prefix the call with *99. This pretty much works for me. I have three Tivos and they all seem to be happy with it. For a while I was also prefixing it with #34 which is supposedly a special Tivo prefix that slows down the modem. This didn't seem to make a difference though. There is a suggestion that you put a pause (comma) after the *99 but I haven't been doing that and it works just fine.

In general the Vonage service is great as long as you're not doing a lot of heavy surfing at the same time. I've also had problems when I use call waiting. I'm guessing keeping two open phone connections just stresses my DSL line a bit more than it can take. We also have two phone lines on the same Vonage router (Motorola vt1000v) and we haven't run into any issues when using both lines at the same time. Odd that it can handle this well but not the call waiting.

PS Thanks to the reader who suggested the Safari built in spell check under the edit menu. Very nice.

Monday, September 20, 2004

AdSense Channels

AdSense has the concept of channels. This allows you to track where you're getting the most traction for your ads. For instance, this blog has it's own channel. The impressions and clicks can be viewed for just this blog. The script includes a variable called google_ad_channel and it's set to a number. This number is somehow generated from the string that makes up the channel name, probably a hash of the string.

If you view the source for this blog you'll see the variable setting:

google_ad_channel ="3396865929";

Nice Shell Tutorial

Here's a great little shell programming tutorial. Sometimes you just need a little cheat sheet on the basics. This seems to date back to a course that was taught back in 1997. Lovely.

Monday, September 13, 2004

DynDns Rules

If you want to really control your own domain name, try They have a bunch of DNS realted services. I started using them when I wanted to be able to ssh to my linux box at home. Since I have DSL, my IP address changes occasionally. With DynDNS you can setup a free domain name that points to your machine. You run a client on your home box that monitors your IP address. When it changes, the client can automatically update the your entry at Now you just have to remember to run the client. (cron is your friend). And then you need to remember your free name.

You can also register domain names through them or manage domains that you own. They offer really nice mail forwarding and web redirect services. The prices for these services are reasonable too. Say you own For around $45 per year you can forward an unlimited number of email addresses. I currently use Yahoo for this and pay about the same amount. The problem with the Yahoo service is you can only give out email addresses that point to Yahoo accounts.

The web redirect service is free with ads or without ads if you're paying for some other service through them.

In My Own Mind

Just saw a great new video by Lyle Lovett for his new song "In My Own Mind". I've been a Lyle Lovett fan since the late 80s. I just caught the video by accident. It's on seriously high rotation on CMT. I was just flipping channels and caught it.

Other great Lyle Lovett songs:

  • Good Intentions
  • Bears
  • If I Had a Boat

Too bad it didn't work out with Julia Roberts....

Friday, August 27, 2004

Today is Your Birthday

Time to relax, have some fun, and see a show. The javascript hacking will have to wait.

We'll be staying at the York Hotel, as seen in Alfred Hitchcock's Vertigo. Cool.

Wednesday, August 25, 2004

This Adsense Thing

So google has this way of adding their ads to your own web pages. It's pretty easy to do . You sign up with them for an account. They check out your web site to see if it has enough content on it to be interesting for them. And if it does, they give you an account.

Once you get an account, you can log into where you can manage your ads. This is also where you get the "code" for your website. The code is made up of some javascript that you stick in your web page. They have a nice page for selecting the look and feel of your ads.

The code you put on your site allows them to match the content of your site with ads that are related to your site. Of course this may be a problem if your competitor's ads are showing up on your site. They give you some amount of control over this when you configure your ads.

Hacking Adsense

Being a curious type I wanted to take a look at the code that they are using to do this. Here's what mine looks like:

google_ad_client = "pub-6255829795248391";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_channel ="";


I had to remove some of the tags so it would show up here in my blog. You can see that they set a few variables and then source the javascript that does all the magic. Notice the google_ad_client variable. That's how they tell that it's me. Feel free to use it if you like. The more ads shown with my publisher id the better.

Now that show_ads.js is kind of intriguing. So I wanted to take a look at it. Well, a simple wget should do the trick right? Well, not quite:

adam$ wget
=> `show_ads.js'
Resolving done.
Connecting to[]:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
10:12:14 ERROR 403: Forbidden.

So how do they forbid me to get the JavaScript directly but allow browsers to get it? Perhaps they use some HTTP header like referer? Sure there is an option for wget to send any http header you want. I can't remember the format for the referer header off hand so I tried user agent. Voila:

iMac:~ adam$ wget -U "Mozilla/4.03 [en] (X11; I; SunOS 5.5.1 sun4u)"
=> `show_ads.js'
Resolving done.
Connecting to[]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7,145 [text/javascript]

100%[====================================>] 7,145 303.37K/s ETA 00:00

10:16:03 (303.37 KB/s) - `show_ads.js' saved [7145/7145]

Now it's possible that the javascript I got is targeted to my user agent. Actually, it should be since there is great variation in javascript support among browsers.

Turns out this javascript is about 220 lines of code. Should be fun reading. Perhaps I'll post more later when I've had a chance to look it over.


(BTW, the blogger spell checker doesn't seem to work with Safari. Please excuse any sloppy spelling errors...)