Stream video from Ubuntu server to Android device
I have a headless Ubuntu 12.04 server. I have a lot of video on the server. Most of it is in x264 in .mkv. I have a Samsung Nexus phone, and a Nexus 7 tablet.
What are my options when it comes to streaming from the Ubuntu server to Android? I got smb up and running. Some friends of mine were talking about DLNA, the "Playstation media server" could be a solution?
Solution 1:
On your Android Device you will have to install a DLNA client to be able to access media shares you have on your server.
On your server you will have to run a DLNA/UPnP server that makes the shares accessible. Your network settings need to allow UPnP and Multicast (check with your router).
There are several solutions for an UPnP server you can choose from. With MiniDLNA, a leightweight but powerful DLNA server we able to stream MKV, and x264 content. This application is my recommendation for running on a headless server.
We can install it from the repositories with
sudo apt-get install minidlna
For help on setting it up see: https://help.ubuntu.com/community/MiniDLNA
Solution 2:
On your server:
- Install minidlna:
sudo apt-get install minidlna
- Configure
/etc/minidlna.conf
On your android devide:
- Install bubbleupnp or any other dlna/upnp client
- Select your server
Solution 3:
Serving over plain HTTP
The simplest possible solution is HTTP in combination with an Android video player that can do HTTP streaming, such as VLC, MxPlayer, etc - just use any of the many available HTTP servers.
Here are some one liners.
Python 2.x
$ python -m SimpleHTTPServer 8000
Python 3.x
$ python -m http.server 8000
Twisted (Python)
First, install the twisted package if not already present with pip install -U twisted
(pip3 install -U twisted
), then:
$ twistd -n web -p 8000 --path .
After you start the web server, open the browser on your Android device and type the IP and port of your Ubuntu box e.g. http://192.168.1.123:8000
You can use ifconfig
on Ubuntu to see the IP address.
A more extended list of HTTP oneliner servers: https://gist.github.com/willurd/5720255
Caddyserver
My preferred choice is caddy
with the built-in file-server
plugin which can be started with:
caddy file-server --listen :2030 --browse --root /
If needed, with
caddy
you can also enable basic authentication.
Samba server-side + VLC/Kodi client-side
If you need to access your ubuntu box in a home network then you can also enable Samba on the Ubuntu server and then on your client device (Android/Linux/Mac/Windows) add an SMB share as in the SAMBA HOWTO — search for Add SMB share to Kodi Method 1|2. Kodi can also generate previews and fetch IMDB info for your movies if that's what you are after.
VLC (mobile versions) will be able to discover and browse your Samba shares without extra fiddling. Desktop OS's normally have built-in support for samba shares so you can browse them pretty much like a local file system.
Solution 4:
For media streaming using the UPnP media server specifications, I would look at:
Mediatomb - runs in the background serving media, has a web interface which you can use to build the library.
Kodi - normally used as a client, but you can enable media serving under the Network options within it.
You can find both in the Software Center.
As far as Android clients go, there are ports of both VLC and Kodi.