Hi all
If you are like me, you may have tried to play some 720p or 1080p high definition H264 film clips on your computer and it has stuttered or lagged behind audio, making it unwatchable.
Even very fast pcs suffer from this, for example a core 2 quad Q6600 @ 2.4Ghz will struggle with some 1080p material sometimes.
There are two solutions to this problem:
- Use nvidia's new VDPAU acceleration architecture to speed up h264 decoding. If you have a 8xxx series or newer graphics card and use the proprietary nvidia drivers then it's a fair bet you can use this option.
- Use the latest multi-threaded branch of mplayer to try and speed up decoding. In my limited testing this has worked very well and gives massive speedups on dual core systems.
If you have a nvidia card already, vdpau is your best bet, you can head over to this thread for a step by step howto.
If you don't have a 8xxx series or high nvidia card, or don't want to use vdpau, the multi-threaded branch of ffmpeg is for you. I tried this on my core duo T2350@1.86Ghz laptop and I went from stuttering on 720p to perfectly smooth 1080p.
Dependencies
You will need to install mplayer's build dependencies and smplayer which is a nice frontend I like to use:
Code:
sudo apt-get build-dep mplayer && sudo aptitude install smplayer git-core
Install
Change to the src directory in your home folder. If you don't have one, create one:
Code:
mkdir ~/src && cd ~/src
Get and build the latest multi-threaded branch of mplayer:
Code:
git clone git://repo.or.cz/mplayer && cd mplayer && git checkout origin/mt && git submodule init && git submodule update && ./configure && make
The above method will not install mplayer to your system folders, so if it fails for some reason your old mplayer will work just fine. It also doesn't interfere with the package management system. You can of course install the multithreaded version to your system if you like using make install. You should be able to update the source to the latest upstream version by entering the mplayer directory and typing:
Configure Smplayer
Ok, the hard work is all done, now you just need to tell smplayer to use your new super fast mplayer version. Here is a list of configuration options you must change in smplayer:
- General/General tab/Select MPlayer executable: Point this to your newly compiled mplayer version, if you followed this guide to the letter it should be /home/$user/src/mplayer/mplayer
- General/General/Output drivers: You should make sure video is set to xv for best performance.
- Performance/Performance: Loop filter - enabled at first, if movie plays slowly or stutters then you can disable this to improve performance at the expense of some quality. You should be able to leave this enabled on 2Ghz+ dual core systems
- Advanced/Options for MPlayer/Options box: Enter the following line here:
Code:
-lavdopts threads=2
That's it! Try playing a 1080p or 720p movie that your computer struggled with before. It should play perfectly well and you should be able to see that both cores are in use rather than just one as before. If your computer still struggles despite these enhancements then you can disable the loop deblocking filter in smplayer as detailed above, this should give you a large performance boost at the expense of quality.
Bear in mind the multithreaded branch of ffmpeg is still experimental so some movies might fail to play. If you don't like using the new mplayer, you can easily tell smplayer to use the old reliable single threaded one instead by entering just "mplayer" in the mplayer executable box instead the path to your newly compiled one.
Hope this helps someone!
Sam
Bookmarks