How can I build mplayer for the Pi?

How can I build mplayer for my Pi 2 B running Jessie?

I've tried installing the mplayer package, but it installs mplayer2, which seems to have been abandoned for a few years. As I've been having many issues with mplayer2 (described below), I'd like to install a fairly new version of mplayer (also to take advantage of its new flags and such).

My current issue with mplayer2 can be seen running these steps:

1. sudo apt-get update/sudo apt-get install mplayer
2. mplayer -idle -slave -ao null -vo x11 --display=:0
3. The above command should still be running. In the stdin, type loadfile /path/to/a/video.mp4
4. Wait for the video to finish playing.
5. Type loadfile /path/to/another/file.mp4.

I get a continuous list of X11 errors. mplayer2 closes the window after the first video is done playing, so when the second video is started, it gives me errors. I need to use mplayer in slave mode to add new videos, so I can't really work around it. (Even if I could work around it, mplayer2 still seems to randomly close the X11 window—presumably when the disk stalls/etc.—causing the same set of errors.) I feel like this is a bug that should be patched by now, so I really want to get an updated version of the software running. (This also isn't my first issue with mplayer2, so an upgrade may help with the issues I'm having.)

Depending on when you download the snapshot, you'll need to change the extracted snapshot directory cd mplayer-export-xxxx-xx-xx/

wget http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2
tar xf mplayer-export-snapshot.tar.bz2
cd mplayer-export-2016-10-02/
./configure
make
sudo make install


The make will take a little while to complete, but should finish with out any errors.

This is tested on building and installing, but did not test your particular use cases.

• Running overnight. Is it normal that it has tons of warning messages during compile? – Anonymous Penguin Oct 3 '16 at 3:32
• Yes, I had the same, no errors though. Should be done in 30-45 minutes – ElefantPhace Oct 3 '16 at 4:13
• To others wanting to do this same thing: in order to get X11 VO support, you must sudo apt-get libx11-dev libxv-dev before running ./configure. The configure script should automatically detect that these packages are installed and act accordingly. – Anonymous Penguin Oct 4 '16 at 4:15