If you've ever tried to stream HD Movies from another computer or a media server over Windows File Sharing and a wireless network, you know how slow the videos can be. Using the following, I went from slow and choppy slideshows to crisp and smooth videos. I wanted an easy way to watch my 720p movies on my laptop and this is a guide for making it very simple.
This guide assumes you have a recent NVIDIA card that supports VDPAU (Hardware Acceleration).
Check here to see if your Nvidia Card is supported:
If you haven't already, Install The Proprietary NVIDIA Drivers:
Next Install VDPAU:
Note: YouTube and other flash videos may appear with a blue tint after enabling VDPAU. There's a patch for that, just enable this ppa:
sudo add-apt-repository ppa:tikhonov/misc
sudo apt-get update
sudo apt-get install libvdpau1 vdpau-va-driver
Accessing the Videos on the Network:
We will mount the Network Share onto a folder on /media/. This will make it a lot easier when trying to play the videos later.
Install smbfs to be able to mount the folder and create a folder (mount point) for the share::
sudo apt-get install smbfs
sudo mkdir /media/SambaShare/
Next, mount the share to /media/SambaShare/
USERNAME is the user on the windows computer that is sharing the files. Also, you cannot mount a file within the shared folder, it must be the shared folder itself.
sudo smbmount //192.168.2.28/projects /media/SambaShare/ -o user=USERNAME
Refer to the first Answer Here for More details:
Creating a script to mount the shares
This next step makes it so you don't have to type in the previous code every time you restart your computer. You could add it to your /etc/fstab/ to have it mount when you start your computer but I chose to make it into a script and add it to /bin/ so I can mount with a simple command. It's easier than it sounds.
Open a text editor to save the script:
Paste the following and be sure to modify the second line to your settings.
sudo gedit /bin/mountshares
Now make it executable.
sudo smbmount //192.168.2.28/projects /media/SambaShare -o user=USERNAME
Now anytime you want to mount the network share, just type into terminal
sudo chmod +x /bin/mountshares
This is 10x easier than remembering all of that code. If you have extra shares that you want to mount, just edit /bin/mountshares as root.
Now we will install MPlayer and be much closer to playing that HD movie in lag-free super smooth quality.
The reason why the videos were choppy before is because of two things, the first was lack of hardware acceleration which we took care of in the first half. The second is a low cache size. Why MPlayer works so well is because you can specify both.
sudo apt-get install mplayer
We're going to make a second script that makes playing the movies soo much easier. We're going to add it to /bin/ as we did before.
Open a text editor to save the script:
Now paste the following:
sudo gedit /bin/playnetmovie
Now we're going to make it executable
echo "Playing Movie Starting at Time $1"
mplayer -ss $1 -vo vdpau -vc ffh264vdpau -fs -cache 99999 -cache-min $2 "$3"
sudo chmod +x /bin/playnetmovie
So that you don't have to go through all those folders to get to the movie files, make a symbolic link to the videos folder on your windows computer:
Now we can finally play our first movie. The syntax for playnetmovie is as follows:
ln /media/SambaShare/place/where/videos/are/stored/ ~/Videos/NetVids
The 00:00:00 is the start time. If you want to start from the beginning of the movie, just type 0 instead of 00:00:00. If you are continuing the movie from where you left off, just type in the time according to this format HH:MM:SS. The 30 is the percent of the cache that MPlayer should fill up before starting playback. The buffer size for playnetmovie is pre-set to 99,999 KB so if you do any more than 30%, you'll be waiting quite a while. If you're on a fast network you can probably do 10, if you are on a slower network you can bump it up to 50.
playnetmovie 00:00:00 30 ~/Videos/NetVids/Movie/filename.mkv
So that's it! Anytime after this you want to stream your HD videos, just type in two commands.
First mount the network drive:
Then play the movie:
This also works for streaming HD movies over the internet:
playnetmovie 0 20 ~/Videos/Movie/filename.mkv
For MPlayer Controls:
playnetmovie 0 20 http://website.com/file/directory/yourmovie.avi
*** This also works for MP4, AVI, and any other HD Video you wish to watch ***
Enabling VDPAU http://linuxforums.org.uk/index.php?topic=4232.0
Mounting Windows Shares http://askubuntu.com/questions/13701...buntu-x-ubuntu
MPlayer + VDPAU http://ubuntuforums.org/showthread.php?t=1037625