19

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?

4 Answers 4

8

Serving over plain HTTP

The simplest possible solution is HTTP on the server in combination with an Android client with a video player that can do HTTP streaming, such as VLC, Nova Video Player, mpv for android, MxPlayer (ad-supported). There are plenty HTTP servers to choose from:

Here are some one liners.

Python 2.x (❗️no seek support)

$ python -m SimpleHTTPServer 8000

Python 3.x (❗️no seek support)

$ 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. Caddy is written in Go and unlike the python options above is production level software, works faster and can do range requests that will allow to seek videos. Start caddy with:

caddy file-server --listen :2030 --browse --root /

The line :2030 will make caddy listen on port 2030 so you you'll be able to access it at something like http://192.168.1.100:2030 (replace with the correct IP).

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.

Client-side caddy-based media browser

Given that caddy's file-server built-in plugin can also return a directory listing as JSON I created a client-side media browser that is pure js+html and only requires caddy to be running on the server with a custom Caddyfile. It's more of a proof-of-concept project and not meant for anything serious:

It works in the browser and will only play video formats that the browsers can play, so no proper MKV support.

5
  • This is epic dude
    – Trect
    Oct 22, 2018 at 19:23
  • This man deserves a medal (Or May be a bounty). The answer is epic simple
    – Trect
    Oct 22, 2018 at 19:23
  • 1
    very simple technique worked ! but not able to forward videos Mar 3, 2019 at 13:09
  • 1
    @AbhishekKamal: SimpleHTTPServer does not support range requests. If you need seek support for videos you might want to use github.com/danvk/RangeHTTPServer or other, more advanced servers.
    – ccpizza
    Mar 4, 2019 at 9:54
  • 1
    After trying python -m SimpleHTTPServer 8000 i found that i can't seek videos so i stopped python -m SimpleHTTPServer 8000 and used an another trick, The trick is.... whenever i want to stream videos from laptop to android, i use smplayer (video player, newest version 19.1.0) in laptop, it provides a barcode, then i scan that barcode from the phone and i success to seek videos. And I found that, this method is working faster than previous. Mar 11, 2019 at 11:51
5

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

1
  • 2
    Worth noting would be that not every version of Android supports all kinds media formats. While newer devices with version 4.0+ support the most common formats, older versions and processors with limited feature sets may have issues here and there. On top of that device manufacturers can still mess up the platforms default format support. Of course Android offers players that do decoding in software, but thats mostly a workaround and costs battery life. developer.android.com/guide/appendix/media-formats.html
    – LiveWireBT
    Aug 29, 2012 at 14:49
4

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
2

For media streaming using the UPnP media server specifications, I would look at:

  1. Mediatomb - runs in the background serving media, has a web interface which you can use to build the library.

  2. 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .