Tuesday, March 06, 2007

Episode 5: Video

The continuing adventures of one man's attempt to migrate his desktop PC from MS Windows to Ubuntu/Linux.

Fortunately, Ubuntu recognized my video card and automatically installed a driver that worked. So, this episode is not about trying to find a Linux driver for a certain video card. Instead, it is about getting Internet video files to play on my Ubuntu PC. Unfortunately for me, there was plenty of work to do before I was happy with my ability to watch Internet videos.

For licensing as well as philosophical/political reasons, Ubuntu automatically installs only software that is free and unrestricted. It is up to the user to determine what other software he or she wants/needs to install.

When it comes to video, this is not a trival matter, since Internet video comes in many different file formats (mostly proprietary). Some of the software needed to play these files/formats is easy to find and install; some is not. Some web sites serve videos in a Linux-friendly fashion while others do not. What follows is a step-by-step guide (without the false starts and blind alleys) with commentary.

Step 1:

The first step to a robust capability to play videos in Firefox on Ubuntu is to access software sources beyond the free and unrestricted ones that Ubuntu defaults to. From the System menu in the main panel, select Administration/Software Sources. In the window that opens, make sure that all the Internet options are selected in the Ubuntu tab (including multiverse and restricted). Click Close and your machine's cache listing of available Ubuntu applications will update.

Totem is the default Ubuntu application (plugin) in Firefox for playing many multimedia files, including mp3, RealAudio, Windows Audio and Video, Quicktime, and others. But, unless you download and install the codecs for these different file types, you will get a cryptic error ("Totem could not play 'fd://0'.") when you try and play such files.

Point(s) of Confusion: An application identified as Movie Player in the Applications/Sound & Video menu is included in the base install of Ubuntu. It is familiarly known and referred to elsewhere in Ubuntu as Totem.

Movie Player/Totem is not to be confused with another application called MPlayer, which is an award winning multimedia player that many people use and like. If you install MPlayer, it will appear in the Applications/ Sound & Video menu right below Movie Player. Trying to remember which application is which will be a source of further confusion.

Step 2:

The next step toward achieving a happy ending with Internet video is to download the codecs you need. From the Applications menu on the main panel, select Add/Remove... . Select the two GStreamer plugins ("extra plugins" and "ffmpeg video plugin"), and click OK. Totem will now play Windows Media files successfully. This will solve some of your video problems, but not all of them, unfortunately.

Now we need to get some additional media players to handle situations that Totem cannot handle.

Step 3:

Shockwave Flash is used by many web sites to deliver video, most notably YouTube. The good news is that there is a Flash player that installs easily and works well in Linux/Firefox. More good news is that YouTube makes it very easy to download and install the Flash player.

If you go to YouTube, you will see an icon on the page that looks like a jigsaw puzzle piece, and the words, "Click here to download plugin." Do it and click through the EULA and the Linux Firefox plugin is correctly installed. Hurray!

Step 4:

Real Networks has proprietary audio and video file formats that Totem cannot handle, even with the GStreamer plugins installed. Fortunately there are players that can play these files.

There is a free, unrestricted, open-source Real Media player called Helix. There is also a free but restricted player from Real Networks called RealPlayer 10. I'm not sure what the practical difference is between the two players. I installed RealPlayer 10.

You find it by selecting the Applications menu, Add/Remove... . You can search All for RealPlayer to find the application. You cannot browse the Sound & Video category to find it because it currently is grouped under Graphics applications. With RealPlayer 10 installed, Firefox can play Real Media files, embedded in the browser window. Hurray!

What is CNN thinking!?: If you try to watch a CNN video before loading the Flash player, you get a pop-up message from CNN that you need to upgrade to Windows Media Player 9. WTF!? CNN tests to see if you have the Flash player installed, but not what operating system you are using.

It just goes to show that Microsoft-centric websites you visit may unknowingly create unnecessary problems for you.

If you install the Flash player and then go back to CNN and try and watch a video, the Flash player loads showing advertising and navigation links, then an error message pops up saying, "Totem could not play 'mms://wmscnn.stream.aol.com.edgestreams.net/..."

Turns out that CNN has embedded a Windows Media file in a Flash presentation. That is not elegant, but it is not the problem. The problem is that CNN is using an obscure protocol called Multimedia Messaging Service to stream the Windows Media file.

Multimedia Messaging Service (MMS) is a standard for telephony messaging systems that allows sending messages that include multimedia objects (images, audio, video, rich text) and not just text as in Short Message Service (SMS). It is mainly deployed in cellular networks along with other messaging systems like SMS, Mobile Instant Messaging and Mobile E-Mail.

Totem doesn't know how to handle the MMS protocol. The resolution is to use a different media player; one that has the stuff to handle mms://... .

Step 5:

We are almost home. The next-to-last thing to do is install at least one more all-purpose media player to deal with files the other players cannot handle (e.g., Quicktime files) and/or web sites that are not Linux/Firefox friendly (e.g., CNN). There are candidates that you can choose from.

I have read the reviews, and I have tried several different, capable media players. I went with the VLC Media Player. Select Add/Remove from the Applications menu on the main panel. Click on VLC Media Player. Then click OK. This will install VLC.

Step 6:

After installing VLC, we need to change the file associations in the Firefox browser so that Firefox knows when to use the VLC media player. If you think that you do this using Firefox's Edit/ Preferences/ Manage File Preferences, you are wrong.

You need to load a Firefox extension called MediaPlayerConnectivity (MPC). You can get it by using Firefox's Tools/ Add-ons/ Extensions and click on the Get Extensions link at the bottom of the pop-up window. This will take you to https://addons.mozilla.org/firefox/extensions/. Here you want to search for "MediaPlayerConnectivity" to find the download/install page.

After installing the extension and restarting the browser, the MPC wizard starts (if it doesn't, go to the Tools menu in Foxfire, select MediaPlayerConnectivity/Configure... , then click the Wizard button in the pop-up window). The wizard performs a scan to detect the media players you have installed, and then it lets you set the player associations for several popular file formats. Next, the wizard has you choose between Autoplay and Smartplay. I don't know what the difference is between Autoplay and Smartplay, and I couldn't find any documentation on it. (Documentation on MediaPlayerConnectivity is limited.) I went with the default, which is Smartplay.

Once the wizard is finished, your video setup is complete -- until:
  • You find a file type you cannot play or a web site that crashes your browser instead of showing you a video.
  • Upgrades come our for Firefox, MPC and the various media players.
Congratulations are in order, I think.

MPC in Action: Assuming you click a link or button in Firefox to view a video, often the link will lead to a web page with the video as an embedded stream in the page. Unless it is a file type like Flash or Real Video, MPC will replace an embedded video stream in the browser with a button in a black screen, like this: If/when you click the button, the player MPC associates with the file type is launched in a pop-up window. For example, if we go to CNN and play a video now, the Flash page loads and instead of the Totem error we got before, now there is simply a button icon as above in (black) embedded player frame. If/when we click the button, the VLC player pops up and plays the video we selected. Yippee!

During the configuration of MPC, you can elect to let MPC handle Real Media, Flash and other file types. If you do, then MPC prevents the video from embedding in the host web page and launches the RealPlayer or the Flash player in a pop-up window. This is unnecessary since the RealPlayer and the Flash player work well in Firefox, so I don't let MPC handle Real Media and Flash videos. From the Firefox Tools menu, you can change the configuration of MPC if/when you encounter troubles.

Warning: If the browser link or button clicked to play the video leads to a video file instead of a web page with a video stream embedded, quirky things happen. I don't know if this is a flaw in MCP or if it is a result of the (mis)configuration of MPC. For example, when I click on links to different .wmv files, I can get the following results:
  • Totem plays the video, full-screen, in the browser window
  • MPC puts a button like the one above in the middle of a black browser window. Clicking the button plays the video in a VLC pop-up.
  • The browser window goes to black, and the video plays in a VLC pop-up without further ado.
I suspect that these behaviors have to do with the Smartplay option selected during setup. In any case, I can live with this.

Episodes: 1, 2, 3, 4, 5, 6.

No comments: