How I Watch Movies From Any Device At Home Using NFS Server
RD
Posted on February 15, 2022
I'm a lazy fellow by design. Every time I downloaded movies or TV series on my phone or laptop, I would have to manually copy these files to a physical hard-disk-drive (HDD) via laptop and then connect the HDD to the back of my TV so I could watch them.
The Problem
I wanted a way to download movies on phone and then somehow transfer it to my HDD directly (which would always be connected to my TV) so I could watch shows anytime I want. All this, without having to physically move my HDD back and forth to copy files.
The Solution
The most do-able solution I could come up with was
- To connect and mount a pen drive (can replace it with a SSD in future) on a Raspberry Pi.
- Install NFS server on that Raspberry Pi.
- Download movies on phone (or laptop, even).
- Transfer movies to your NFS server (on Pi) on mounted path (we can use Termux to SSH to Pi from Android phone).
- Install a media player app that allows you to stream media on your local network on your Android TV (no Android TV? See in Troubleshoots below). I personally use VLC media player to do this. Configure VLC to setup streaming.
- You can also config this on other devices (Android phones, laptop) as well. This way you can move all your movies/ shows to NFS server and free up space on your devices.
- Mount USB devices to a Raspberry Pi and setup a NFS server on that Pi.
- Download your movies/ shows from a non-legal, non-piracy website (see what I did there?) on your phone or laptop.
- Copy your downloaded content from your non-legal, non-piracy website (I did it again) to the mounted path on your Pi.
- Install VLC on your device you want to watch content on and configure it to allow stream from your NFS server.
The Brainstorming
Things I needed to figure out were
- Can I connect my HDD to Wifi/ Ethernet so I can transfer movies to it via my home network?
- What if I mount my HDD to Pi as storage? Can I then have that Pi + HDD connect to my TV via home network?
- How do I connect Pi to my TV? Can I connect TV and Pi via LAN; would be best config for zero-latency. Wifi would be convenient though; and no wires.
- What if I want to watch movies from Pi + HDD on other devices on my network - iPad, other phone, etc.
- Since HDD is outdated, can I use SSD instead for performance? Let's use a pen drive as SSD drive for now.
- Lets create NFS server on Pi, and try to stream media content from this server across all devices on home network.
The Implementation
- Get a Raspberry Pi (any old one will also do. I used an old Raspberry Pi 3 Model B+ I had lying around the house) and do initial setup - install Pi OS, setup username, password and SSH. Note down IP address of Pi or hostname (
hostname -I
) once it's connected to your network. I recommend to setup a static IP address for your Pi. - Get a pen drive, at least a 128 GB. I recommend getting one of those USB 3.0 or 3.1 ones for faster read-write speeds.
- Connect and mount this pendrive (say to
/mnt/movies
path) and setup USB automount in/etc/fstab
. - Install NFS server on Pi. If you're using a brand new USB, you might have to install an exFAT server instead. The steps are pretty much the same, except that you need to install and configure additional utilities to work with exFAT.
- Check that your NFS/ exFAT server is setup on Pi and that you can SSH into it and copy files as well. You can do this from your phone as well. You'll need to install a terminal call Termux. It's pretty cool. Do check it out.
- Download movie on your phone or laptop. Copy content from your laptop (or phone) using
scp
to your mounted/mnt/movies
path on your Pi. If you're copying from your phone, see Troubleshoots below on how to allow Termux to access your "Downloads" folder. It is disabled be default due to security reasons. - Copy your files from phone/ laptop to the mounted path on Pi
/mnt/movies
. The command isscp -r <source-folder> pi@your-local-pi-ip-address:/mnt/movies
. You might be prompted for your Pi credentials to continue. Pro tip - since you'll be copying files regularly, consider creating a small copy-files-script to save some time. - Install and setup VLC media player for free on your TV or android device. Setup and configure VLC to stream media over your local network.
- If you have configured VLC to stream over local network properly, a new folder gets added on the VLC home menu with the folder-name that you gave in previous step. Open that folder and you should see the movies you had copied over to your Pi.
Troubleshoots
- This solution works best on an Android TV. If you do not have an Android TV, and are still interested, you can consider converting your old TV (as long it has a USB + HDMI port) by one of the available options in the market - See Xiaomi Box 4, Google Chromecast 3 or similar).
- Termux does not have access to your Android phone device storage by default. You need to give it permission explicitly by running the command
termux-setup-storage
. It creates a~/storage
symlink. You can navigate to your Downloads folder on phone from here. For examplecd ~/storage/Downloads
- AFAIK, with NFS, you cannot stream shows to your iPad as it uses a different filesystem maybe. At least I wasn't able to setup streaming content on VLC on my iPad and the NFS option was not available.
- If you have an older pen-drive, NFS server should work for you. But for newer USB pen drives, you'll probably need to work with exFAT.
- If unable to connect to NFS server, make sure Pi has power and is turned ON. SSH into it and see if you can see the files in mounted path with expected size -
ls -alh
. Was data corrupted while copying? - If you're still unable to scan, copy to or play media files from your NFS server, review your file permissions carefully.
💖 💪 🙅 🚩
RD
Posted on February 15, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.