[HOWTO] Enjoy MLB games in Linux, with NexDef!

Updated 31 March 2013: I’ve written a new article with the changes in mlbviewer for the 2013 season. You can read it at [HOWTO] PLAY BALL! Enjoy the new MLB video this season on Linux with MLBVIEWER.

Original post from 8 July 2012:
Some may say this post is coming pretty late in the season, especially with the All-Star break upon us, but a few days ago I got an email from Major League Baseball telling me that as a thank you for participating in their All-Star Game Final Vote balloting I had two free weeks of MLB.TV Premium. Having perused the system requirements earlier in the season I hadn’t worried much about it before since their website says that you have to run either Windows or the MacOS to enjoy their streaming video coverage. I did some checking and discovered that not only can I watch LA Dodger games on Linux, I can even get the full feature set with their NexDef plugin!

Fair Warning: If you want to enjoy the best quality video you need just as important as your paid subscription, if not more important, and that’s a nice fat pipe to get on the internet. While you only need a 512 kbps connection to enjoy the Gameday Audio they recommend 768 kbps for standard video and a whopping 3000 kbps for HD video. If you’re not sure how fast your connection is you can use their Speed Test, but at my favorite Starbucks I had to crank my quality level way down, and even then I’d get a lot of stuttering as I watched the previous night’s game, and as more people came in and got online it got even harder to watch. I’ll probably just listen t the audio feed from KLAC for this afternoon’s game because I know damned well I won’t be able to get enough bandwidth for even their standard steaming  video.

Enjoying MLB games in your browser with NexDef

The good news is that if your favorite web browser can play the league’s highlight videos you have everything you need to enjoy the basic video streams of games (as log as you have bought a subscription, of course).  To get the whole feature set you’ll need the Java-dependent NexDef plugin. If you click the button on the MLB.tv Download page to install the plugin you’ll see a link for installing the MacOS version of the plugin. The MacOS is based on Unix, an older sibling of Linux, but that plugin isn’t what you want.

Luckily yesterday I did some hunting with DuckDuckGo and found a tutorial on the WebPath website on Using the MLB 2012 NexDef HD-plugin on Linux. If you run Debian Linux or a distro based on Debian like Ubuntu, Linux Mint or my favorite, Linux Mint Debian Edition (LMDE), there is a script you can run from a terminal to handle the installation chores. Save that script with an .sh extension, set it as executable by either changing the file’s Properties > Permissions from your file manager opening a terminal in the directory where you saved the file. Run chmod u+x debian-nexdef-installer.sh, replacing debian-nexdef-installer.sh with whatever you named the file when you saved it. Don’t close the terminal because you’re not done with it. If you’re not already in a terminal window launch one and change to the directory you saved it if you didn’t save the file in your /home folder. Now run the script by running ./debian-nexdef-installer.sh (or whatever you called the script when you saved it). No need to run it as root because the script will ask for your admin password when it’s needed. The script will make sure you have the dependencies for dmg2img and pax, then download and install the plugin, and even create a desktop file that can be automatically run when you start your computer.

If for some reason the script isn’t launched when you start your computer you can make sure it’s started by running this in a terminal:

java -Xmx128m -jar /opt/nexdef-plugin/Library/Application\ Support/NexDef/lib/nexdef.jar

You’ll want to run that in a terminal that you can tuck out of the way because once you close it you’ll love the ability to use the plugin. You’ll also need to run that before you open your browser window so the plugin is available. Regardless how you launch the plugin you can verify that it’s running by hitting the MLB.com NexDef Detector. If it shows that it’s not installed you’ll need to run that command in a terminal, and possibley close your browser and then relaunch it so it can see the plugin when you need to have it available.

Enjoy MLB.TV games without your browser with mlbviewer

Many of us love using Minitube to watch YouTube videos without the overhead of our web browser and the same thing is available for MLB.TV with mlbviewer, a terminal-based way to use mplayer to watch video content from MLB.TV. Unfortunately you can’t simply install packages to run mlbviewer, and you’ll definitely need to install some dependencies that I can pretty much guarantee you don’t have on your system already. The first thing you’ll need to get installed is Setuptools, a way to easily grab, build and install Python packages. Surf on over to http://pypi.python.org/pypi/setuptools and scroll down to the bottom of the page. You’ll see a list of setuptools .egg files and you need to grab the right one for the version of Python installed on your computer. (You should have Python installed already, if not install it before you do anything else.) You can use your package manager to see what version of Python you have installed but if your system uses apt there’s apt policy, a handy command you can use in a terminal to find this out. When I run it on my system I get:

:~$ apt policy python
python:
Installed: 2.7.3~rc2-1
Candidate: 2.7.3~rc2-1
Version table:
*** 2.7.3~rc2-1 0
500 http://ftp.debian.org/debian/ testing/main i386 Packages
100 /var/lib/dpkg/status
:~$

With this information in hand I know I want to get setuptools-0.6c11-py2.7.egg. Download the file, making sure you keep that specific filename with the .egg extension, and from a terminal open in the directory you saved it run sudo sh setuptools-0.6c11-py2.7.egg. Next you need to install PyXML, but when you go to the download page you’ll see Download Out of date. Do not use. Oh, crap! Luckily since you installed Setuptools there’s a way around that. In your terminal window run sudo easy_install pyxml. Whew!

The next thing you can install is mlbhls, although you don’t need it to listen to the audio stream or watch the standard streaming video, and you do have the option of watching the HD video in your browser, but I really like watching video outside of my browser whenever I can. When I originally wrote this tutorial for IJaA I wasn’t able to get mlbhls working but thanks to the good folks over at the MLB.tv NexDef (HLS) App Google Code site I am able to walk you through this install as well. Make sure you have the dependencies met by installing libcurl4-openssl-dev and libconfig8-dev, as well as subversion to be able to get the latest version of the source code for mlbhls. Then open a terminal window in wherever you like to do your installs (I use ~/Installers just to have them all in one easy to find place.) In the terminal run

svn checkout http://mlbtv-hls-nexdef.googlecode.com/svn/trunk/ mlbtv-hls-nexdef-read-only

Drill down one directory in your terminal with cd mlbtv-hls-nexdef-read-only and run make. If you’ve met all the dependencies it will give you a few lines of output and then return you to a command prompt.

Of course you don’t need mlbhls to listen to the audio feeds of games or watch the standard streaming video, and if you really want the HD video you can use the NexDef plugin in your web browser. The next thing you definitely need to install is RTMPDump. The easiest way to install it is by getting the latest code with git, and you’ll need subversion installed to do that. If you don’t know if you have it installed already you can run sudo apt-get install subversion in your terminal. If it’s already installed Apt won’t try to install it again. To install RTMPDump run these commands one line at a time in your terminal:

git clone git://git.ffmpeg.org/rtmpdump
cd rtmpdump/
make sys=darwin
make sys=posix

(If you’re running Linux you want to build for posix, not darwin as the MacOS needs. I’m surprised I missed that before now.) Yesterday I also ran into an issue since I had to reinstall things after a complete system reinstall that’s making me add an extra step to the RTMPDump install. Once you’ve built it you should copy the rtmpdump binary to /usr/bin by running this in the terminal once you’ve run make:

sudo cp rtmpdump /usr/bin/rtmpdump

That’s it, you now have RTMPDump installed and are ready to install mlbviewer itself. Download it from the mlbviewer website, extract it and then point your terminal at the folder where you installed it.  Before you run mlbviewer you need to make an edit or two if you have mlbhls installed. Open mlbplay.py from the mlbviewer folder in your favorite text editor and look around line 239 for a line that says

sys.exit()

Comment that out by puting a hash sign (“#”) before it so it now reads

#sys.exit()

In that folder run

python mlbviewer.py

When it finishes it will tell you to review the settings of ~/.mlb/config and set your user name and password. Open that file in your favorite text editor and at the top you will see

# See README for explanation of these settings.
# user and pass are required except for Top Plays
user=
pass=

You’ll need to put your username (email address) and password associated with your MLB.TV account. There are a number of settings in this file, such as a way to note your favorite team(s), and to see what everything is look at the READMEfile that came with mlbviewer. If you’ve installed mlbhls you want to change line 54 so it reads

use_nexdef=1

Once you’ve finished changing the settings (please don’t break anything) save it and go back to your terminal window. Once again run

python mlbviewer.py

As you can see from the screenshot I’ve set the LA Dodgers as a favorite team and set the favorite color to blue, and since I’ve scrolled down to that game you’ll see that the pregame coverage has started. If you want to watch the video for a particular game just use your up and down arrow keys to scroll down to the game you want and hit Enter. You can also change to the AWAY coverage of the game by hitting s anywhere on this screen, and if you want to get the audio for the game as I’m about to do just press a when your game is selected. If you have a favorite team specified mlbviewer will default to the team’s coverage, regardless whether they’re at home or on the road. If you want to change the date for the games shown you can use your left and right arrow keys to go back and forward one day and if you want to jump to a particular date just press j and enter the date.

There are a number of other keys you can use and they’re all listed in the README file, or you can simply press h. Enjoy your baseball games, and may your beloved team win more than it loses. Unless they’re playing the Dodgers, of course.

In addition you can also create a launcher for mlbviewer. I used the KDE Menu Editor to create it and you can use whatever tool you prefer to create launchers. The important information is:

  • Name: I used mlbtv since that’s what I use mlbviewer to watch
  • Description: Watch MLB.tv with mlbviewer
  • Command: This is the path to where you have mlbviewer installed.

I’m noticing a problem with not being able to use the cursor keys to change selections but if you know what I’m doing wrong please let me know in the comments so we can all fix the bug.

I created a custom icon for the launcher that uses the league’s logo as a starting point.  I do not have permission to use this and if you download and use it you may be in violation of US copyright laws but if you want to use it as well you can get it here.

About these ads

About BostonPeng

Disabled SolydK user with KDE SC 4.9.5 Also big fan of NPR and the LA Dodgers.
This entry was posted in Baseball, GNU/Linux and tagged , , , , , , , , . Bookmark the permalink.