HOWTO: Compiling mplayer with multi-core decoding support

来源:互联网 发布:苏州大禹网络 知乎 编辑:程序博客网 时间:2024/05/01 05:43
HOWTO: Compiling mplayer with multi-core decoding support

I'm posting this HowTo since I think it is a great advancement in HD playback on Linux and people should be able to take advantage of it. I found out how to do this from the following post on doom9.org: http://forum.doom9.org/showthread.ph...45#post1221445


Overview: To use mplayer with multithreaded decoding abilities all you have to do is compile mplayer as per usual, but having replaced the normal ffmpeg source code (within the mplayer source code directory) with the ffmpeg-mt source code (http://gitorious.org/projects/ffmpeg/repos/ffmpeg-mt).

I'm going to use the following guide written by andrew.46 entitled [Howto] Successfully install the svn mplayer + gmplayer + all the codecs as the basis for my tutorial as it's very thorough and I feel there's no need to reinvent the spoon.


How to install:

1. Follow andrew.46's guide until you reach the point "Download and Compile the svn mplayer" (you can skip the step "Installing the amr libraries" if you don't need these, I skipped it)

2. When you reach the step "Download and Compile the svn mplayer" proceed as andrew.46 says with downloading the mplayer source code from SVN:

Code:
$ cd $HOME$ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
When this is done it's time to download the ffmpeg-mt source code. First you need git, install it with the following command:

Code:
sudo apt-get install git-core
Then download the source code for ffmpeg-mt using git:

Code:
git clone http://git.gitorious.org/ffmpeg/ffmpeg-mt.git
In order to make use of the now downloaded ffmpeg-mt source code you need to replace the three following folders from the mplayer source directory with the folders from the ffmpeg-mt directory: "libavcodec", "libavformat" and "libavutil".

Code:
cd mplayer #enter the directory where the mplayer source code isrm -rf libavcodec libavformat libavutil #delete the three aforementioned folderscp -a ../ffmpeg-mt/libavcodec . #copy the three folders from the ffmpeg-mt source dir to mplayers source dircp -a ../ffmpeg-mt/libavformat .cp -a ../ffmpeg-mt/libavutil .
Now you have the mplayer source code in which the ffmpeg source has been replaced with the ffmpeg-mt source. You should be ready to go.

Now just follow the rest of andrew.46's guide starting from:

Code:
$ cd $HOME/mplayer$ ./configure --enable-gui$ make$ sudo make install$ make clean
and mplayer should compile with no problems.



Here are some benchmarks of mplayer with the normal single-threaded ffmpeg decoder compared to the multi-threaded ffmpeg decoder playing various 1080p H.264 video samples (using my Core2 Quad 2.83GHz CPU):

Code:
SINGLE-THREADED FPSMULTI-THREADED FPSPERCENT INCREASE IN FPSThe Dark Knight37121329%In Bruges45134296%(no -ss 120)The Bank Job46141305%The Terminator37126341%(no -ss 120)(MPLAYER ARGUMENTS: -vc ffh264 -lavdopts threads=4 -vo null -benchmark -frames 1000 -ss 120 -nosound)
I hope you've enjoyed this guide, I basically just snatched the guides from the two aforementioned users and joined them, thanks goes out to them.

Happy HD viewing
原创粉丝点击