IPv6 Policy Routing Linux Gotchas

I have two IPv6 tunnels with subnets, one from SixXS and one from Hurricane Electric. (Why? Eh, I’m a tinkerer.) I had them both active and responding to tunnel broker pings on my Cisco E2000 with DD-WRT v24-sp2 rev 14929 firmware, but I couldn’t route from both my subnets at the same time.

My SixXS tunnel won’t accept packets from my HE subnet, and my HE tunnel won’t accept packets from my SixXS subnet, but I can only route by destination…with normal routing.

The answer—besides living happily with one subnet and tunnel—is policy routing. With policy routing I can set up more than one routing table and choose which routing table to use based on the source of the packet, so I should be able to send SixXS-subnet-sourced packets to the SixXS tunnel and HE-subnet-sourced packets to the HE tunnel.

Unfortunately my DD-WRT version doesn’t support policy routing for IPv6. So I designated my Linux server as the DMZ host under the DMZ tab under the NAT / QoS tab and set up my tunnels and routing on the Linux box.

Instead of setting up a piece at a time and testing it as I go, I brazenly typed up my whole configuration before trying any of it out on the Linux box. That cost me a few hours of troubleshooting, but the funny part is I mostly had it right the first time. The problem was that policy rule flushing works slightly differently with IPv4 and IPv6, at least on Ubuntu Lucid 10.04.2.

The default rules are as shown:

$ /sbin/ip -6 rule show
0: from all lookup local
32766: from all lookup main

The “gotcha” is that I decided to flush the rules before adding my own. I did this because I was duplicating rules when I brought the interface down and up again.

$ /sbin/ip -6 rule flush
$ /sbin/ip -6 rule show
0: from all lookup local

Flush works a little too well as it takes away the rule that uses the main routing table! Flushing the IPv4 rules puts the default rules back, but not so with IPv6. So when flushing IPv6 rules remember to add the main rule back:

$ /sbin/ip -6 rule flush
$ /sbin/ip -6 rule add priority 32766 from all table main

Here is my working policy routing setup that routes to the proper tunnel based on the source address. I have chosen to set up the HE tunnel and subnet as normal and make policy routing decisions for the SixXS tunnel. Other things I did to make this work was to enable IPv6 routing in sysctl and add “200 sixxs” to /etc/iproute2/rt_tables so I could have a routing table named “sixxs”, but I could have used a numbered table instead. Ubuntu/Debian /etc/network/interfaces file (partial):

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
        endpoint 216.218.224.42
        address 2001:470:1f0e:b56::2
        netmask 64
        ttl 64
          # Null route HE /48 to prevent sending back to internet
        post-up /sbin/ip -6 route add unreachable 2001:470:b967::/48 || true
          # Null route HE /64 to prevent sending back to internet
        post-up /sbin/ip -6 route add unreachable 2001:470:1f0f:b56::/64 || true
          # Global unicast range route (effective default)
        post-up /sbin/ip route add 2000::/3 dev he-ipv6 src 2001:470:1f0e:b56::2 || true

auto sixxs
iface sixxs inet6 v4tunnel
        endpoint 216.14.98.22
        address 2001:4978:f:178::2
        netmask 64
        ttl 64
        # doesn't work: mtu 1280
        post-up /sbin/ip link set $IFACE mtu 1280 || true
          # Null route SixXS /48 to prevent sending back to internet
        post-up /sbin/ip -6 route add unreachable 2001:4978:192::/48 || true
          # Set up SixXS routing table
        post-up /sbin/ip -6 route flush table sixxs || true
        post-up /sbin/ip -6 route add 2000::/3 dev $IFACE src 2001:4978:f:178::2 table sixxs || true
          # Set up routing table rules, he-ipv6 is default, sixxs is sixxs-sourced
        post-up /sbin/ip -6 rule flush || true
          # To local prefixes, use main routing table
        post-up /sbin/ip -6 rule add priority 100 to 2001:4978:192::/48 table main || true
        post-up /sbin/ip -6 rule add priority 200 to 2001:470:b967::/48 table main || true
        post-up /sbin/ip -6 rule add priority 300 to 2001:470:1f0f:b56::/64 table main || true
          # To nonroutable "global" prefixes, use main routing table
            # 6to4. Uncomment this if I implement local 6to4 conversion
        #post-up /sbin/ip -6 rule add priority 400 to 2002::/16 table main || true
            # Teredo. Uncomment this if I implement local Teredo conversion
        #post-up /sbin/ip -6 rule add priority 500 to 2001::/32 table main || true
            # Documentation: range reserved for dummy addy's in documentation
        post-up /sbin/ip -6 rule add priority 600 to 2001:db8::/32 table main || true
          # From SixXS subnet addr to global unicast (last rule), use sixxs routing table
        post-up /sbin/ip -6 rule add priority 32000 from 2001:4978:192::/48 to 2000::/3 table sixxs || true
          # Need the default main; flushing seems to delete the ip6 main rule
        post-up /sbin/ip -6 rule add priority 32766 from all table main || true
          # Flush routing cache to enable new routing info
        post-up /sbin/ip -6 route flush cache || true
          # Flush rules and re-add main table rule
        post-down /sbin/ip -6 rule flush || true
        post-down /sbin/ip -6 rule add priority 32766 from all table main || true

I null-route my assigned prefixes/subnets to avoid sending inappropriate traffic back into the internet which will just get routed right back to me. When I add routes for my /64 prefixes they will override the null route because they more specifically match the destination addresses. I am also routing to 2000::/3 (all currently assigned global unicast addresses) instead of a default route so I don’t send out multicasts or other address ranges I don’t intend.

If you’re wondering about “|| true”, if I don’t have that and the command generates an error code, the interface set-up would stop. The “|| true” causes the command to return a “success” code to the ifup/ifdown scripts even if the command fails so that the ifup/ifdown script can continue with the rest of the setup.

My plan is that the main routing table will handle all cases except from the SixXS subnet to  the SixXS tunnel, in my case from the subnet to external global unicast addresses. I could just make sure each table has all the routes I need, but in my case I think it’s easier this way. Here are the resulting rules from the above configuration:

$ ip -6 rule
0:      from all lookup local
100:    from all to 2001:4978:192::/48 lookup main
200:    from all to 2001:470:b967::/48 lookup main
300:    from all to 2001:470:1f0f:b56::/64 lookup main
600:    from all to 2001:db8::/32 lookup main
32000:  from 2001:4978:192::/48 to 2000::/3 lookup sixxs
32766:  from all lookup main

Rules 100, 200 and 300 are my local prefixes. They don’t need to go out the SixXS tunnel, so I divert them to the main routing table. Rule 600 is the reserved documentation prefix. I think I may try to use that address range when making how-to videos, so I want to divert that to the main routing table and null route it there to prevent sending invalid traffic out to the Internet. Rule 3200 catches all remaining packets from my SixXS subnet that are to the global unicast address range and tells Linux to use the routing table I named “sixxs”. The last rule is what sends everything else to the main routing table. The last rule should exist by default, but “ip -6 rule flush” deletes it, and that’s the “gotcha” that cost me a few hours’ troubleshooting.

The sixxs routing table as configured above:

$ ip -6 route show table sixxs
2000::/3 dev sixxs  metric 1024  mtu 1280 advmss 1220 hoplimit 4294967295

 

View HTTP Headers With Chrome

I’ve been looking at my headers the old-fashioned way with curl -I and wget --save-headers, but I notice Chrome and IE have some pretty advanced site diagnostics built-in now. Here I am using Chrome’s F12 to check my HTTP headers which I just changed.

Downloads:
/videos/view-http-headers-with-chrome.mp4
/videos/view-http-headers-with-chrome.webm
/videos/view-http-headers-with-chrome.ogv

Whoops! I messed up those headers! I fixed them after I made the video, and then I used Chrome’s F12 to check them, and this time I got them right.

Show Meeting 2012-12-20

Sometimes, when we’re on the ball, we’ll meet and discuss ideas for the upcoming show as well as discuss technical production concerns.

I’ve been working on a new integrated chat and video page. I tried a couple of 2-column CSS layouts, tweaked one, picked it and started dressing it up.

phpFreeChat requires that IE be in IE7 compatibility mode which messes up some of the formatting. The big problem if the browser window is too skinny, but for now I think we’re safe (enough) to assume that IE users’ windows will be at least 1000px wide. IE7 mode also messes up one of the new Twitter widgets I added to the page, but it’s also functional enough and doesn’t detract. I might be able to work around these problems by putting chat in an iframe, but I haven’t tried yet.

Oh yeah, I added a Twitter search box that follows #DBAsAtMidnight and a button that tweets to #DBAsAtMidnight, so maybe we can get some cross-discussion people chat and Twitter. There is also a “Follow @MidnightDBA” button. The MSSQL community has a large and active presence on Twitter. (Pssst…search for #SQLhelp)

Sean wants a live viewer count on the page, and that’s a fabulous idea. But at the moment I don’t have comprehensive stats logging, but it was on my list to do real soon. We’ll probably manage something with an AJAX update from a text file we’ll refresh periodically. The trick would seem to be that we’re running two streaming servers: Windows Media Services for the main feed and a VLC h.264/AAC transcoder for the Flash and iPad/iPod viewers.

I’m hoping to get one integrated chat/video page to support all browsers, but that won’t happen this week. For now I’ll have 2-4 interface pages to support the various combinations. Targets include:

  • Windows Media Player plugin (primary, best stream)
  • Flash (transcoded)
  • HTML5 video (not sure yet if this works live, should work in iPad, transcoded)
  • Silverlight (might allow all browsers on Windows to access the primary stream)

Windows Media Services and player will likely continue to be our primary target because of the features we have. I hope to soon start multi-bitrate encoding so the streaming quality can rise and fall with the client’s bandwidth availability.

Now I need to go work on something else we talked about in the show meeting, but I can’t tell you what just yet.

Sound: Speaker Placement

As I mentioned before, for music and sound effects we just play them through USB-connected PC speakers and let the microphone pick it up. These are Sean’s fancy speakers with infrared remote and a subwoofer. I usually adjust the volume with the remote for convenience, although I should really find a better way.

Usually both speakers are facing away from Sean and Jen and the mic, towards where I sit. Up until Friday I turned one speaker towards them and left one facing me so the infrared remote would work. I watch the VU meter on the video encoder to gague where I need the volume to be, but it often seems a bit loud to Sean and me, and it isn’t coming across as well as I’d like on the microphone.

This week I realized their monitor (doubling as a stand for camera one) was between the speaker and microphone, so I moved the speakers forward so both of them face the microphone, and the IR-receiver speaker is also tilted towards me so the remote works. I think the music sounded noticeably better on this week’s recording, and the VU meter looked like it was picking up enough volume without Sean or me complaining about the in-studio volume.

I guess that’s so simple it’s stupid, but sometimes you don’t notice the blindingly obvious until you look at what you’re doing and ask yourself if something could be done better.

Expression Encoder 4 SP2 Captions

When I found out Expression Encoder could put captions on live broadcasts, I got excited. Unfortunately it is not what I thought. It does not overlay text onto the video, but instead sends the caption in a separate caption stream, and the viewer won’t see it unless they have captioning turned on. And even then the display is not consistent across video players.

So I still have no solution for putting text or image overlays encoded in the video stream. That seems so simple in concept, and the LifeCam driver lets me use all sorts of silly video filters like putting hats on a person’s head, sunglasses on their face or floating stars over their head. I don’t see how they missed letting me put a static logo or some text in there instead.

Camera Angles and Perspective Control

My first show-related post, production notes for the 2011-12-16 show.

First I want to talk about recent changes and last week’s show. We’re recently clamping one or two of the webcams to tripods, which gives us a lot of flexibility in placing the cameras and even moving them during the show. Previously we were using monitors or old laptops as camera stands or setting them on a table.

We had Sri Sridharan (NTSSUG president) live on set campaigning for a seat on the PASS board. I set up camera 3 on a tripod on the desk so it was eye level as he was standing at his podium, but when he came on live it looked like the camera was looking down on him.Webcam Perspective Problem Example I then realized the camera was angled down, and I had used the software’s zoom and pan controls to frame the set, and that caused a perspective control problem. See how the left side of the flag and backdrop converges inward, giving the perspective of looking down? If I had thought about or noticed this beforehand I could have physically moved the camera to frame the set and have both sides of the flag and backdrop appear vertical. If you want to know the details look up view cameras, architectural photography or shift lenses, but make sure the webcam—specifically the focal plane—is parallel to the backdrop or whatever virtual plane you want to appear flat.

Example of Better Webcam PerspectiveThis week’s show: I tried hard with camera 1 to keep the backdrop looking square while being eye-height with Sean and Jen. It took more camera-moving than I expected, but it looks a lot better. Actually the photo doesn’t look as good as I thought I had aligned it, but when I aligned it the backdrop was rolled up, so I had to align by the top only. I guess next week I need the backdrop down before adjusting the camera.

This week we had Denny Cherry as a live guest. It’s hard to properly fit three people on camera one. I’m not sure how much we can do about this with the current set. Camera one sits on top of a monitor Sean and Jen use during the show. I might be able to mount it elsewhere, but there is a lot of desk and table and stuff to work around. There is also the problem that moving the camera back exposes even more space not covered by the backdrop, but I don’t think we’re too picky about that.

Camera two is our favorite camera for Sean’s rants. Due to inertia it has been sitting on a spare monitor on a PC to Sean’s camera-left. He can look down into it, and it provides I think an interesting different perspective to the set. Well, the PC and monitor got moved for this week’s show, so I used a tripod. I wanted the camera to still look up at Sean, but I overdid it. It was almost down to tabletop level, and the perspective was too jarring. It doesn’t have to be much below eye level to make a difference.

Camera three has generally been to Jen’s camera-right and high. It’s sort of been a backstage look where you can see what’s on the desk and what’s around them. I would like to be more creative with camera three, but not much has come to mind.

Actually we’d really like at least four cameras. We have more than four, but so far due to USB bandwidth limits we have only been able to get three going.

Things to work on this week include restyling the chat page and video windows. Currently I have the video launch in a new window. Sean wants the video and chat side-by-side, but getting that to work properly in all our viewers’ browsers is tricky, and modifying the width of phpFreeChat has proven problematic.

Speaking of browsers, I would have thought that MSSQL DBAs would be watching the show with Windows and IE, but most of them use other combinations like Chrome, Firefox and iPads.

I also need to make progress on figuring out how to get live video guests on live, and preferably either split-screen or PiP with the live cams.

midnightFreddie, Tech Producer: Production Setup

So please allow myself (IT Know-It-All) to introduce myself (midnightFreddie) as our new blogger!

Why, thank you, me!

We are currently using Microsoft Expression Encoder 4 to produce and record the live video. This allows us to switch between multiple webcams, screencasting and prerecorded media, however you can’t add or remove media or alter the screencast settings while broadcasting, and all the webcams are active at the same time.

We were excited about using multiple cameras, but since Expression Encoder keeps them all on at the same time we found out that multiple webcams will use up your USB 2 bandwidth in a hurry. We currently manage to run 3 webcams and a USB microphone, but hope to be able to add more with some equipment changes. Also, with all the webcams active, all the “live” lights are on, so Jen and Sean can’t tell which camera is currently broadcasting.

Between Expression Encoder and the LifeCam driver we are unable to split-screen, picture-in-picutre or even overlay text or graphics while broadcasting live. Silly face-tracking, distortion effects and color filters are plentiful, but we can’t put text or a logo on the video? Really? I tried using WebCamMax‘s virtual webcam as an input to Expression Encoder to add capabilities, but I can’t get WebCamMax’s output resolution to change from 800×600, and we’re broadcasting widescreen. WebCamMax also does not seem to switch smoothly between input cameras, and it takes up a lot of CPU cycles. It has been very difficult to get what I want with consumer webcams and software.

A big goal is to be able to have live video-chat guests on the show. We’re thinking Skype but haven’t worked out how to get the Skype video on our video. We might try something hackish like screen capturing the Skype video window, but we really want to have the show hosts and the guest on the screen simultaneously.

For sound we have a Yeti USB microphone, and any music and sound effects are played from speakers and picked up by the microphone. This is very convenient, but the sound is not top-notch. I would like more quality and control over sound, but it is adequate for now, and we have other features to work towards first.

Please Allow Myself to Introduce…Myself

I am going to blog about the technical production of the weekly live webcast DBAs@Midnight, but I will be posting as midnightFreddie, the nickname and Twitter handle I adopted when joining the show. The name is based on Freddy from iCarly. Freddy tech produces the in-show iCarly webcast, so I became “the Freddy” for the DBAs@Midnight show.

Sean and Jen McCown, the MidnightDBAs started recording a weekly video in 2009 and later started live broadcasting the show and posting the recording on their website later.

When I joined the show they were using Ustream.tv for live broadcast and chat while using a second webcam and Debut video capture software to record the show for republication. I was able to change to widescreen video and update the quality and features within the Ustream controls, but Ustream had a habit of frequently changing the user interface and increasing ad intrusion until we finally got fed up and looked for other options.

I will write up articles on how we live stream self-hosted video as IT Know-It-All, but I decided I will also post weekly show production notes.

So please allow myself (IT Know-It-All) to introduce myself (midnightFreddie) as our new blogger!

JaguarPC, I Recommend Them

When I don’t have the proper home internet service to run my own public servers I get an unmanaged Virtual Private Server (VPS). I’ve spent quite a few years running everything off of a VPS because I’ve been moving from home to home. I am settled now, have the home internet service and servers ready and am about to cancel my VPS, but I wanted to thank JaguarPC (Twitter, email) for their proactive service and their equal interest in keeping existing customers and getting new customers. (JaguarPC also offers managed VPSes and other hosting products.)

I’ve had bad experiences with other hosting providers, both mine and for my clients. With other hosts I’ve often had host-related problems while their reporting services claim that their services are up and their support line doesn’t answer, later to find out they’ve had major problems. At least in the age of Twitter it’s easy to find other clients of the same host and verify the problem is with the hosting company and not with my or my client’s server.

But when I decided to leave my previous ill-behaved host who had my VPS down for 5 days and couldn’t tell me if or when it would be back up—thankfully I keep my own backups—I looked for a VPS hosting provider that had been around for many years, appeared to care about existing customers and offered a good value. I picked JaguarPC partially because of some recommendations and partially because they had a special running where I could get my umanaged VPS with 390 MB of RAM for the price of 256 MB.

Well, the special never ended like I thought it might. In fact, three years later they—on their own initiative—upgraded me to a new plan that had over three times more storage, three times the RAM (four times the RAM of the base plan I had) and ten times the monthly bandwidth at a lower plan cost. They explained in the email that they want to thank and retain their existing customers. The actual upgrade itself caused no issues, outages or reboots on my VPS. (This is possible due to the VPS solution they are using.)

I have not known of any outages or slow server issues since I’ve been with them. I haven’t had to contact them once since I opened the account. However, they proactively notified me of a DDoS issue that they were experiencing and thought might affect me, and they kept an updated status report available. I checked my server and didn’t seem to be affected, but it was very refreshing to hear from the hosting provider and having regular updates. That is vastly superior to any other host I’ve dealt with.

I semi-publicly shared the adventure with some online friends. I posted the following on May 10, 2008 about my leaving my previous host and starting with JaguarPC:

When I suggested he [the VPS reseller] set up a new VPS for me he liked the idea at first but then asked if I wanted to go direct with the company that hosted my old server. That’s the second time he’s tried to pawn me off onto another company, and I suddenly recalled I had been concerned about performance issues, anyway, and now he suggests I go with the company who apparently lost a host server and can’t seem to get it back up? Nope, time to go with someone totally new. JaguarPC apparently has been doing this 10 years, so hopefully after 3 years they’ll still want my business. Plus they were having a sale that’s supposed to give me more RAM at the same price which should help with the concurrent requests I’ve talked about before.

I haven’t closed the old account yet. I don’t really expect for them to bring my VPS back up as it was, but I’d like to see how my backups restore before I totally give up on it. So far I think I’m missing a few emails, a static website I forgot to back up (no biggie) and perhaps some config info that might be handy to look at but isn’t critical.

I posted the following on January 19, 2011:

Well, so far I’m pleased with JaguarPC. There have been no major issues for me overall, and they emailed me an outage notice yesterday and linked to a support thread that was keeping running updates on a DDoS attack that was affecting several of their servers and networks. And as far as I can tell my server didn’t even go down, but I got the updates anyway.

It’s so nice to find out about a problem from the hosting company and be offered a place to find updates before I even know there is a problem.

The last two major host company problems I’ve had (with other host companies) usually involved no public mention of the issue for at least an hour or two after a major outage, and support lines and support system jammed and giving no information or false positive information. Here they have proactively notified me, so if I start having problems I know what’s probably going on and know where to look for updates rather than waste hours trying to troubleshoot something I have no control over.

I posted the following on February 4, 2011:

Wow! JaguarPC just auto-upgraded me to a new plan that is cheaper and has 3-10 times the specs the old plan has! I’ll post a redacted form of the email later when I’m not on my Droid. The jist is they want to treat existing customers as well as new ones.

Hoo boy, now I can increase the concurrency here and give some more cache RAM to the database.

So yeah, apparently JaguarPC does still want my business after nearly 3 years.

This is the (redacted) email they sent me about the February 2011 upgrade:

We are very pleased to inform you of an immediate upgrade of your VPS package. This free automatic update is to express gratitude to our loyal customers like yourself. We are upgrading all our VPS plans in next several weeks and today your VPS was upgraded on the new plan.

No action is required on your end. There is no other change to your hosting, domains, or IP.

“It is common in the web hosting industry to promote plans to attract new customers, but we really wanted to do something that was a way of saying thank you to our existing customers,” says Greg Landis , CEO of JaguarPC. “We could not imagine a better way to do that to give more for less. Our philosophy has always been to treat our customers with utmost respect regardless of their size, and we hope to maintain our strong customer loyalty with this movement.”

The upgrade details are as follows:

[server account name]

Your old VPS plan name: VPS – Freedom Plan
Your old VPS plan cost: $[...] + addons
Your old VPS plan specs: 15GB Disk, 256MB RAM, 300GB Bandwidth + addons

Your new VPS plan name: Linux VPS Pro
Your new VPS plan cost: $[...] + addons
Your new VPS plan specs: 50GB Disk, 1024MB RAM, 3000GB Bandwidth + addons

[VPS management products info]

We just turned 12 years old in last October and getting stronger in 13th year of business! This is a tribute to the loyalty of our clients and reflects our business concepts of good value, integrity, and honesty. It wouldn’t be possible without the ongoing trust and business from clients such as yourself. Thank you all again for your business and referrals. We wish you all the very best.

Streaming a Live Webcast — Concepts and Know Your Audience’s Tech

Computer video concepts can be very confusing, and streaming adds more complexity, live streaming possibly more so. This is largely because there are competing proprietary methods for encoding, storing and transporting video. I’ll try to break it down for you as it is in August 2011.

First, it should be noted that when we talk about video we usually mean video and audio together. Video and audio are different forms of information, but they have to be delivered together for the expected experience. The overall conceptual breakdown:

  • Video source: Most likely a USB webcam for a small web show broadcast
  • Audio source: Often integrated with the webcam, but could be a discrete microphone
  • Encoder: For our small live web show this is a laptop or PC that the webcam and microphone plug into. On professional setups this could be a piece of professional hardware as part of a camera system or a standalone device. The encoder will encode the audio and video streams and multiplex them into a container format. More on these terms later, but the data stream that leaves the encoder will be readable by viewer clients.
  • Media server: The encoder sends the video/audio data stream to the media server to be delivered to all the viewer clients. It’s possible the encoder machine could also be the media server, but it’s more flexible and scalable if the media server is a separate server box.
  • Client: The viewers are looking at their PCs, Macs, tablets or phones which are pulling the video (and audio) from the media server.

As the audio and video moves through the above progression, there are several properties that transform it, store it or transport it:

  • Video codec: Codec is “coder/decoder”. It is the algorithm or language, if you will, that turns what the camera sees into computer information. At its very basic, video is a series of still photographs played after one another, but that would take up a prohibitive amount of disk space and network bandwidth to store and transmit, so there are various competing and evolving codecs to encode quality video in a small data space. The encoder you choose and configure will determine the video codec, and the media server you choose may only support certain codecs even though the media server itself doesn’t need to encode or decode the video. (Examples: h.264, VP8, VC-1, Theora)
  • Audio codec: Same concept as video, but it applies to audio instead. Your choices in components and software may dictate which audio codec you can use. (Examples: MP3, AAC, WMA)
  • MUX or multiplex: When playing video (with audio), you are playing two different types of information at the same time: audio and video. But you are playing only one data file or one live data stream. How do both audio and video get delivered in one data stream? Multiplexing. In brief, each elemental data stream (video, audio, etc.) is split into data chunks, and chunks of each individual stream take turns being delivered through the actual one data stream. There are different standards for multiplexing, and again your choice of components may dictate a particular MUX. Note also that other data may be multiplexed in your streams, like subtitles, alternate video or audio streams or metadata.
  • Container format: At its most basic, this is the file storage type, and is usually indicated by the file extension like .AVI, .MOV, .MP4 and .M4V. Conceptually this would seem to blend with MUX, but somehow in ways not completely clear to me they are different from MUX, and some container types work with different MUX types.
  • Streaming protocol: This is the method the data stream is transported or delivered over a network. (Examples: HTTP, RTP, RTSP, RTMP, MMS)

So, the encoder transforms the information from the video and audio sources using particular codecs and MUX’s them into a container format, then uses a streaming protocol to deliver the container stream to the media server, and clients use a streaming protocol—not necessarily the same one used between the encoder and media server—to receive the container stream from the media server.

But you can’t just pick whatever codecs, MUX, container and protocols you want. They don’t all work together. The real pain of the situation is that your audience’s clients may need particular codecs, MUX, container and protocols. The really real pain is that if your audiences’ clients are different, they may be incompatible with your choices and incompatible with each other.

I’ll remind the reader that the following are described from the point of view of a small, not-for-profit web show that wishes to grow from a viewership of 20-50 live viewers with no or minimal cost, assuming an existing 25mbps upstream connection and existing Windows 2008 Server and Linux server available. The organized portion of our show is recorded and made available for free download later, so content protection is not a concern for us. The community is rooted in Microsoft-based applications and therefore are generally assumed to have Windows, IE and Windows Media Player available, but in practice many of them own iPhones, iPads or iPods and desire to view the show on them. I also want to avoid clients having to install extra plugins or software to be able to view the live web show.

I’ll use a team metaphor for the types of clients the audience may have. There are three big teams, one fading team and one emerging team:

  • Team Flash video: The ubiquitous Adobe Flash browser plugin supports video in certain formats across multiple platforms and browsers. Flash is almost assumed for general web surfing, and our existing broadcasts over Ustream require Flash, making Flash a likely choice for us since our audience already has it. There is a free version of the encoder, limited but useful, and a free Flash-based player whose only restriction is an unobtrusive logo, but the Flash Media Server software costs at least $1000. I have yet to find a free and simple substitute for Flash Media Server, but I have managed with much difficulty to use VLC as encoder and media server. I will blog about that separately, and I think there are other possibilities, but the free options require a lot of tinkering and testing and time. However, the popular iPads, iPhones and iPods cannot use flash and aren’t otherwise natively compatible
  • Team Windows Media: If you’re sure all your viewers will be using Windows and Internet Explorer to view your show, this may be the option for you. Microsoft offers Windows 2008 Media Services (media server) as a free download, and there is a free version of Microsoft Expression Encoder. I found them easy to set up and use, but with the free tools most of the touted neat features like forward error correction, smooth streaming, adaptive streaming and multi-bitrate encoding aren’t available with the free tools. Still, with the free tools I was able to easily set up a live webcast viewable by Windows/IE/Windows Media Player users. However, those using other browsers or other platforms couldn’t view the stream. There may be a Java applet that will play the streams on other platforms, but I moved on to other teams before I really tried to make this work.
  • Team Apple: Even though our web show is inseparably tied to Microsoft and Windows, a vocal number of the audience want to use their iPads and iPhones to view the show. At first glance team Apple and team Flash seem to overlap on compatible codecs, but they use different streaming protocols and possibly different muxes and containers. Since our primary target is Wintel platforms this does not seem to be the best server platform for us. However the Quicktime encoder pricing did seem to be quite reasonable, and Darwin Streaming Server is freely available and compatible with Windows, although I found the download page excruciatingly hard to find.
  • Team RealMedia: I consider this a fading team. That may or may not be fair, but the RealPlayer plugin or player has to be installed for clients to use this, and I don’t believe most have this installed already, so for me it was a nonstarter. I didn’t look into pricing.
  • Team HTML5: The great news: an open standard, and a choice of codecs including an open free video codec (VP8 / WebM). The bad news: this is an emerging standard, and I don’t think I can assume my viewers will be using an HTML5-compliant browser, although I could be wrong about that. And apparently the current VP8 encoder is not fast enough for live webcasts. HTML5 with its video tags brings hopes that the proprietary video format wars may be over in a few years and streaming video will be easier and cheaper, but it’s not here yet.