Avoid stuttering streaming from NFS shares with XBMC on the Raspberry Pi

I’ve been using my Raspberry Pi with XBMC (using the awesome Raspbmc distro) for a while now, I even control it using my CEC-Compatible HDTV’s remote, but I pretty much always experienced stuttering while playing 1080p videos streaming from my home server, which was mounted on the Pi via NFS (directly through its /etc/fstab).Raspberry XBMCI dismissed the issue telling myself “it’s just not powerful enough”. But that’s not really the case. Not always, at least.

A little background

The Pi has an onboard GPU capable of decoding 1080p H.264 video, but it has no hardware acceleration for audio, which often leads to issues. DTS and AC3 often are difficult beasts for the board’s underpowered processor, unless you have a TV which is capable of decoding them on its own, in which case you just have to enable DTS/AC3 passthrough in XBMC’s settings.

If you quickly google “raspberry xbmc stutter”, audio tracks are often mentioned as responsible for poor playback, and it usually helps to play stereo versions of the movie sound track, if available. I convert all my movies (which generally come in the form of MKV files) using iFlicks, in order to make them iTunes and iOS-friendly. It always creates an AAC-encoded stereo track for each language, so it’s always available to help the poor ARM chip.

A solution (for me)

Still, my 1080p files stuttered, while 720p played flawlessly. Just for the sake of curiosity, I tried copying one of these movies to an USB thumbdrive, and I attached it directly to the Raspberry Pi. To my surprise, it played smoothly.

I also noticed that playing the same file over HTTP (I also have a web server running on my home server), was just as good.

So it looked like NFS was the one causing troubles. I posted on STM Labs’ (the makers of Raspbmc) forum, and I was told to try to play around with NFS mount options in my /etc/fstab, since I was probably getting an insufficient throughput that caused stuttering. Well, that did the trick. After some trial and error, here is my “magic” line that gives me a great 11,7 Mb/s speed reading files from my NAS (that’s very close to the physical limit of the Pi’s 100 Mbit port, which is more than enough even for 1:1 BluRay rips). /thor nfs udp,noatime,rsize=32768,wsize=32768,nolock,nfsvers=3 0 0

You’ll have to adjust your server address, path and mount point, but the mount parameters will likely work for you as well.


UPDATE: Andrew T suggested a better way to configure OpenELEC to mount NFS shares at boot, you will find it in the comments below this post.

AsΒ MartinP pointed out in the comments, due to OpenElec’s root filesystem being mounted read-only, editing /etc/fstab isn’t possibile.

However, it is possibile to editΒ /storage/.config/ to run the mount command at boot. As an example, you can edit it like this:

sleep 25
mount -t nfs /thor -o udp,noatime,rsize=32768,wsize=32768,nolock,nfsvers=3

As noted for /etc/fstab, adjust the server IP, share name and mount point as needed.

56 replies on “Avoid stuttering streaming from NFS shares with XBMC on the Raspberry Pi”

Dear Luca,
I also experience stuttering and because I have a receiver decoding the sound output the problem must be something else.
The strange part is that the stuttering began when I changed from my Xbian to an Openelec install on my Rasp. I changed cause I had some issues with Xbian. Ironically enough, stuttering wasn’t one of them.
With Openelec all my problems were gone, but it left me with stutter playback of x264. ;-(
So I read on some fora that Xbian is overclocked by default and Openelec is not. So I began overclocking to medium settings and noticed maybe a small improvement.
I was doubting maybe my NAS DS109 was maybe to old and couldn’t cope with this high level of streaming. Although a new NAS would be nice, my DS109 still covers all my needs, and to just purchase a new system just for decent playback is maybe a bit over the top.

Than I ran into your site and thought this could be it.
But now when I want to do this, I would just need a bit more background info.
I found the file fstab, but with me it’s empty.
If that’s the normal case and it’s just a matter of adding your “line”. What is it than that i need to change?
Is it Or do I need to change the /Thor as well?

Hope you can give me this little more info?



Hi Koen,
you need to do a couple things to get everything working.
First, this guide assumes you’re using NFS to share from your NAS to the Pi, so make sure it’s enabled in the admin interface of your DS109.
The purpose of this fstab edits is to have the OS mount the network share, which is more efficient than having XBMC do the job. So, make a directory to mount the share in, in my case I use /thor, but that’s totally up to you. Let’s use /nas as an example, but feel free to change it.
sudo mkdir /nas
Then we need to add the line into fstab to have the share mounted automatically at boot time. To do so, make sure you set the proper IP address of the NAS and the share name, they should be easily obtainable from its admin interface. The line will be something like: /nas nfs udp,noatime,rsize=32768,wsize=32768,nolock 0 0
Add the line (using sudo, of course) and then use this command in order to mount the share without needing to reboot:
sudo mount /nas
Check if your share has been correctly mounted into /nas and if so delete your current XBMC movie/tv shows/music/photo sources you might have added before and re-add them choosing their paths from /nas (it should be something like root/nas in XBMC, I don’t remember the exact name). This is required in order to force XBMC to get the files through this more efficient method, to reduce the CPU load.

I hope I’ve been clear enough, otherwise feel free to ask further details.

Have a nice day,

Hi Luca,
Thanks for your quick reply.
The only thing I bump into is that fstab is readonly. I tried the command mount /flash -o remount,rw but that didn’t do it. Do you have a clue?

Kind Regards

That’s odd, I didn’t know that xbian used a read only file system.

If you have write access to /etc/rc.local (which is executed at boot time) you can circumvent the issue by having it mount your NFS share. Add this line before exit 0:
mount -o udp,noatime,rsize=32768,wsize=32768,nolock /nas
and make the file executable (sudo chmod +x /etc/rc.local).

If you don’t have write access things become trickier, since you have to find another way of mounting the share, maybe using some XBMC script.

I’m using Openelec as I had some issues with Xbian. Maybe I should switch back to Xbian and try the new version. I believe the write permissions would then also be open. I’ll keep you informed

Yeah I meant openelec, sorry.
Also give raspbmc a shot, I’ve been using it since the beginning and it’s been very solid, with a nice monthly update cycle.

You got it! I’m starting with NES games. I think I have a deecnt solution that I’m going to blog soon if it works out. My Pi is currently hard to work with until I get another HDMI cable (which is in the post).

I’ve changed a setting under Playback. Adjust display refresh rate to match video
It was out and I turned it on.
Stuttering is now gone…..
I just ordered myself a new USBstick and SDcard. Maybe when I got them I will install Raspbmc and do as you described.

As long as your QNAP is sharing its contents via NFS, the line to put in the Raspberry’s /etc/fstab should be the same as the one I wrote in the post, just replacing the IP, share name and mount point as needed.
These mount parameters are set by the client, so they don’t change depending on the server.

Are you able to login to your Raspberry with the user “pi” and password “raspberry”? I’m getting the permission denied error…

I managed to get into my Raspberry but now facing the next problem, it seems it can’t find my NAS. Please see this screenshot:

On my iMac and Popcorn Hour I can connect via NFS without problems… Any suggestions?

Hi John,
I can’t see the screenshot, I think you shared the wrong link to Droplr

That’s because that line has to be added to /etc/fstab. The easiest way to do so is run this command:
echo " /XBMC nfs udp,noatime,rsize=32768,wsize=32768,nolock 0 0" >> /etc/fstab
and then reboot your Raspberry.

Thanks, I made some progress. But now it seems my SD-card is read-only (the hardware switch is not). I’m getting this error:
-sh: can’t create /etc/fstab: Read-only file system
Any suggestion on this one? πŸ™‚

Looks like OpenELEC relies on a read-only file system, so you can’t (easily) make the required edit to /etc/fstab.
I’ve never used OpenELEC myself, so I don’t know what would be the best way to proceed. I’d suggest you to write in their forums, maybe mentioning this article so they can understand what you’re trying to do.

With OpenElec you can use in /storage/.config/ to setup the mounts on boot.

Example :

sleep 25; \
mount -t nfs /storage/Movies -o nolock; \
mount -t nfs /storage/TV -o nolock; \

I tried something else, overclocking. Almost every stutter is now gone, but I’m still testing… πŸ™‚

had problems with 1080p stuttering (but not with 720p) and reading your blog post helped! Tried a movie on an USB thumbdrive and it worked. πŸ™‚ thanks!

Hi I am using NFS manager tu share my movie folder, so i can access it from my xbmc on raspberry Pi. I also have a problem with 1080p viedo stuttering, when i am connected with ethernet cable everything works perfect, the video only stutters when I connect with WiFi. Any suggestion ?

Hi Pawel,
I’m afraid wifi is too slow to reliably stream 1080p videos.

Yeah, but what about that “magic line” you’ve posted ? I don’t quite understand what you did there but maybe it could help me ?

Basically that line helps the Pi to fully utilize the bandwidth of the ethernet port while getting files from an NFS server. It might be able to improve things also when using wifi, but I wouldn’t bet on it.

Hi, How can I configure NFS manager to solve the problem with 1080p files.

Hi, I’am trying to modify my fstab file with the specified line, however if i’d like to mount, it gives the following error: “mount.nfs: an incorrect mount option was specified”. Does someone have a clue what could be the problem?

I had a similar issue after upgrading to a newer release of RaspBMC, try to add this option: nfsvers=3 to the line I posted, which becomes: /thor nfs udp,noatime,rsize=32768,wsize=32768,nolock,nfsvers=3 0 0

thanks for your quick reply. The next error is “mount.nfs access denied by server while mounting” which is correct, because it has a password. However what parameters do I have to add to give access?

As far as I know NFS doesn’t support password authentication…
Try a different solution, remove the udp and nfsvers options, performance degrades a little bit (11 to ~8 MB/s) but it should work.

Thanks Luca.

I can confirm adding the nfsvers=3 command to the line of code has resolved the issue (for me at least).

Hi All, i have OpenELEC 4.0.7 installed on my MediaPC, with my movies stored on the HDD, however my 1080p movies always stutter. 720 movies play just fine. can anybody help with the right configurations.

Hi have OPENELEC and have problem with 1080p movie.

I have a PC NAS with NFS (chakra Linux IP ) and an HD 2 TB usb ext.
The mount point is /mnt/WD2TB but in exports is /srv/nfs4/wd2tb.

So what is the right line to add ?


It would be something like /mnt nfs udp,noatime,rsize=32768,wsize=32768,nolock,nfsvers=3 0 0

I guess

Thanks now works, but i have again some problem with 1080p!!
Maybe can i adjust with TCP instead of UDP?
Or maybe i need an SD card large than 1GB ??

TCP is worse in terms of available bandwidth in a reliable ethernet environment: my raspberry was never able to download faster than 6-7 mbyte/s over TCP, while it can easily go over 10 mbyte/s over UDP.
The size of your SD card should not make any difference, as far as I know.

Hello again, i ‘ve a doubt.
If i use the advancedsettings.xml solution for stream local files like stream from internet your solution is ok also in that case?


Thanks for the post. I found it when searching for issues with Bluray quality files freezing when NFS mounting on a raspberry pi. I use OpenElec and their latest version supports systemd type service/mount files. It doesn’t appear to be well documented anywhere, but in the filesystem, I found a README, thought I’d contribute back to this thread since I found it helpful.

systemd directory: /storage/.config/system.d/

With systemd, to declare a mountpoint on boot, the naming scheme of the file is very important. It needs to be “the-path.mount” where /’s are replaced with -‘s.

My example is:

Which mounts an NFS share to /storage/videos/torrents/

There’s a sample NFS file at: /storage/.config/system.d/nfs.mount.sample

I’ve edited it to the following:
Description=torrent nfs mount





Hope this helps anyone running newer (not sure when it was implemented) versions of OpenELEC. The only downside to this configuration that I’ve found is that it does not exit in a timely manner. Which means if you try to request a reboot (via the reboot command or init0), it will take a very long time.

I’m open to any suggestions or improvements.
Thanks again for your post,

That’so great, thank you very much for sharing!
I also updated my post to point to your comment.


Thank you so much for this contribution! You have save my sanity and my marriage!! I have been struggling with 1080p stutter on my Raspberry Pi/OpenELEC for months. The NFS mount options you suggest were spot on in solving my problem. All of the blu-ray rips I’ve tested since have played perfectly with zero stuttering or pausing.

Thanks again!

After you make the file, make sure to run

systemctl enable storage-mountpoint.mount

and NOT

servicectl enable etc

as it says in the example file to enable the systemd mounting

Hi Luca, thanks for the post. Does your solution allow the NFS to be automounted on startup or is there some other way you are doing that? I am running the latest Rasbmc and cannot get it to automount. I have read that adding `auto` to the comma-separated list would tell the Pi to mount on boot..


BTW, this is what I have in my fstab file: /nas nfs udp,auto,noatime,rsize=32768,wsize=32768,nolock,nfsvers=3 0 0

Hi, that line on your fstab should automatically mount the NFS share.

I have pretty much the same line, I just don’t have the “auto” option, which should not be necessary.

Does dmesg show any useful information?

Thanks! I had followed the instructions on openelec site but they did not mention “Options”. It worked only when I added “nolock,nfsvers=3”

I think i finally was able to get mine working but it’s taking an extremely long time on the first startup after the file was made. It ‘started’, ‘mounted’, and ‘reached’ script but it is stuck on Starting Xorg Server. I have a lot of files at the location so I’m think it may be importing them…hopefully. Thanks.

Please help me, I’m driving crazy :unsure:

I have a Synology DS215j NAS attached to a TP-Link TL-WDR4300 router. In Openelec I create a script file in /storage/.config/system.d/ called ‘storage-movies2.mount’ in order to mount NFS shares from my Synology:

Description=movies2 mount




Openelec mounts OK, but I’m unable to access that media. For example if I try to watch a movie, it gets stuck on ‘loading’. In the script if I delete the ‘udp’ option, I can watch the movie fine, so I think it’s an issue related to udp option.

I need to use the udp protocol because otherwise I’m unable to see high bitrate blurays. What can I do?

I’ve had issues with UDP myself lately.
Try with noatime,nolock,vers=4 as your options. On my Pi it averages at around 7.5 Mbyte/s, which should be enough.

I usually use dd like this:

dd if=/path/to/some/big/file/on/your.share of=/dev/null

Let it run for at least 10 or 20 seconds, then hit ctrl+c to stop the transfer. It will tell you the average transfer speed.

This help me !!!!
Multiple mounth that i have this problem.
And now its resoleved.

For Openelec :
1. Enable SSH with interface.
2. Connecte so ssh. Root and pass openelec
3. mkdir /storage/videos/torrents
4. vi /storage/.config/system.d/storage-videos-torrents.mount
5. add :
Description=torrent nfs mount
6. systemctl enable storage-videos-torrents.mount
7. Reboot you raspberry
8. Connect SSH abd verify : ls /storage/videos/torrents
9. Disables SSH from interface.
10. From interface go to videos and add torrent directory (add videos sources -> local storage > videos > torrents).

You can watch all films without problem πŸ˜‰


Thank you so much, your solution works for me I even use the one on xbian website it didn’t work for me until I use yours, thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.