Ebuild for mplayer-mt package

May 19, 2009

The full HD format becomes more and more popular today. Decoding of high definition video requires a modern hardware but even with fast processors it's not enough to use one core for smooth playback of dynamic scenes. Proprietary decoders are used under Windows for a long time but open-source decoders under Linux are known as unstable. Nevertheless you shouldn't afraid of this word. In the Linux world "unstable" often means "not enough tested". This is true for ffmpeg-mt branch of ffmpeg project with experimental multithread decoding support.

Recently I compiled mplayer with ffmpeg-mt and was very pleased by result. Player is able to decode all my 1080p films correctly and without any glitches. Now I share the mplayer-mt.ebuild package for Gentoo users and also supply instructions for manual build.

First of all we must integrate ffmpeg-mt into mplayer. Take latest versions from repositories:

# svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
# git clone git://gitorious.org/~astrange/ffmpeg/ffmpeg-mt.git

Replace directories libavcodec, libavformat and libavutil in mplayer by new ones from ffmpeg-mt. Please note, that the latest version of mplayer could be non-compatible with current ffmpeg-mt. If you want to create an archive then you probably want to remove service folders of version control system that take away almost a half of all space:

# find . -name '.svn' | xargs rm -r

If you have no direct access to repositories (closed ports, etc.), you care about traffic and time or you're just a little bit lazy then you can download archive from this site. Compile and install it as usual:

# ./configure && make && make install

To enable parallel decoding use the following options:

# mplayer-mt -lavdopts threads=N file.mkv

where N is the number of threads.

Ebuild (for Gentoo users)

I've modified original mplayer ebuild and now it compiles new sources, installs player into /opt/mplayer-mt and creates a simlink to executable file into /opt/bin. Download the script, move it to /usr/local/portage/media-video/mplayer-mt (or another local overlay that is configured by PORTDIR_OVERLAY shell variable). Put mplayer-mt-20090510.tar.bz2 into /usr/portage/distfiles and run

# cd /usr/local/portage/media-video/mplayer-mt
# ebuild mplayer-mt-20090510.ebuild manifest

Now you're able to install mplayer-mt using a package manager.

Update (03.10.2009)

Update (02.12.2009)

Nikita Melnichenko.


Marios Andreopoulos
22.05.2009, 02:16

Thanx for this great ebuild! I was too eager to try ffmpeg-mt, yet I was a bit scared to install it without an ebuild. :)

Nikita Melnichenko
22.05.2009, 19:11

You are welcome!

Nikita Melnichenko
11.08.2009, 01:34

Size of file mplayer-mt-20090510.tar.bz2 is 8240477 bytes. If you experience connection breaks, try to continue download with wget.

18.08.2009, 02:16

newest git ffmpeg-mt works well with mplayer-1.0_rc2_p20090731

For gentoo users:
use ebuild from this post delete amr* flags and it should compile without problems.

21.08.2009, 04:51

http://bugs.gentoo.org/show_bug.cgi?id=282154 :)

kostas k
07.09.2009, 23:38

Thank you very very much. Finally i can play hi def movies on my lap.
It took me a while to get it running, since i was getting checksum errors for the tar.bz2 file. I kept on insisting though, since i got it right with the first attempt on my main pc (!!!) and on the nth attempt i got it!!!! YEAHHH ;)

19.09.2009, 20:55

I updated the ffmpeg-mt-enabled mplayer to latest version again (2009-09-19) due to a huge ffmpeg-mt update (197 git commits, bringing it in sync with latest upstream ffmpeg):


Nikita Melnichenko
03.10.2009, 20:23

A new version of ebuild compatible with the latest ffmpeg-mt and mplayer checkouts is available now (as well as source tarball). Links are in the post. I've made some tests on my full HD sources and it seems to me that everything is fine. Also I discovered that regular one-threaded mplayer has better perfomance now. There were scenes that hardly glitched before and now they are played flowly! Seems that developers have optimized decoding libraries!

And two words about difference between this ebuild and ebuild by RealNC. My script installs mplayer executable to /opt directory and gives it another name, mplayer-mt. So you will have two versions of mplayer on the same system. His ebuild overwrites regular mplayer so you will have only multithreaded mplayer on the system. It's up to you what script to use.

11.10.2009, 05:15

ffmpeg-mt just got updated again (299 Git commits), bringing it in sync with upstream ffmpeg again. So I guess improvements you're seeing with upstream, non-mt mplayer are now available with -mt :)

I updated the ebuild again (http://bugs.gentoo.org/show_bug.cgi?id=282154) because of that. I changed it a bit to make it stand-alone now; it will fetch the mplayer tarball and mt-patch automatically, so no need to do that manually anymore. It's still designed as a replacement for the portage version, since some people prefer it that way.

04.11.2009, 19:00

Hello, i tried to compile it but i got error:
libx264.c: In function 'encode_nals':
libx264.c:75: warning: implicit declaration of function 'x264_nal_encode'
libx264.c: In function 'X264_init':
libx264.c:190: error: 'x264_param_t' has no member named 'b_bframe_pyramid'
make[1]: *** [libx264.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/var/tmp/portage/media-video/mplayer-mt-20091001/work/mplayer-mt-20091001/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2

[ebuild N ] media-video/mplayer-mt-20091001 USE="X a52 aac alsa ass cddb cdio dirac dts dv dvd dvdnav enca encode faac faad gif iconv ipv6 jpeg live mad mmx mp2 mp3 network opengl osdmenu png quicktime rar rtc samba schroedinger sdl shm speex sse sse2 theora tremor truetype unicode vorbis win32codecs x264 xinerama xscreensaver xv xvid -3dnow -3dnowext -aalib (-altivec) -bidi -bindist -bl -cdparanoia -cpudetection -custom-cpuopts -debug -dga -directfb -doc -dvb -dxr3 -esd -fbcon -ftp -ggi -gmplayer -jack -joystick -ladspa -libcaca -lirc -lzo -md5sum -mmxext -mng -nas -nut -openal -opencore-amr -oss -pnm -pulseaudio -pvr -radio (-real) -ssse3 -svga -teletext -tga -v4l -v4l2 -vdpau -vidix -xanim -xvmc -zoran" VIDEO_CARDS="mga tdfx -nvidia -s3virge" 0 kB [1]

Thanks for help.

04.11.2009, 20:23

now it works :) thanks

23.11.2009, 21:01

Hello I also got the same error during make:
libx264.c: In function 'encode_nals':
libx264.c:75: warning: implicit declaration of function 'x264_nal_encode'
libx264.c: In function 'X264_init':
libx264.c:190: error: 'x264_param_t' has no member named 'b_bframe_pyramid'
make[1]: *** [libx264.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `../mplayer-mt-20091001/work/mplayer-mt-20091001/libavcodec'
make: *** [libavcodec/libavcodec.a] Error 2

Any help would be appreciated

Nikita Melnichenko
24.11.2009, 14:59

the problem is in incompatibility of these mplayer-mt sources and fresh x264 headers. The package successfully compiles with x264-0.0.20090908 and doesn't compile with x264-0.0.20091021.

Temporary solution is to disable x264 flag since it's only used in mencoder. You'd better use encoder from original package. I will release a new version of ebuild for newer mplayer sources soon.

12.01.2010, 04:00

This is a quick fix, commenting the conflictive part:


Nikita Melnichenko
12.01.2010, 11:36

First, you don't have to apply any fix, just use a new version that I released in December. Second, I'm not sure that player will work properly after commenting this part.
Anyway, thanks for contribution. Any help is appreciated.

13.04.2010, 22:29

thanks for the x264 solution!

13.11.2010, 13:14

Great ebuild, thx a lot! is there any update for this now or still the version of 2009 the latest?

Nikita Melnichenko
14.11.2010, 14:12

Yep, 20091127 is the latest. Actually, it's well tested and I hadn't any problems with video playback, so I have no reason for update.

Comments are closed