Streaming linux to android

Stream video from Ubuntu server to Android device

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:

Python 2.x (no seek support)

$ python -m SimpleHTTPServer 8000 

Python 3.x (no seek support)

Twisted (Python)

First, install the twisted package if not already present with pip install -U twisted ( pip3 install -U twisted ), then:

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.

Читайте также:  Аудио конвертер для linux

Solution 2

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 

Solution 3

On your server:

On your android devide:

Solution 4

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.

Источник

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?

4 Answers 4

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:

Python 2.x (no seek support)

$ python -m SimpleHTTPServer 8000 

Python 3.x (no seek support)

Twisted (Python)

First, install the twisted package if not already present with pip install -U twisted ( pip3 install -U twisted ), then:

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.

Источник

How to stream my GNU/Linux audio output to Android devices over WI-FI?

There is a very simple solution because PulseAudio already has all the necessary tools.

  1. Get your source device name with command pactl list | grep Name
  2. Create the following script named pashare :
#!/bin/sh case "$1" in start) $0 stop pactl load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source= record=true port=8000 ;; stop) pactl unload-module `pactl list | grep tcp -B1 | grep M | sed 's/[^0-9]//g'` ;; *) echo "Usage: $0 start|stop" >&2 ;; esac 
chmod 755 pashare ./pashare start netstat -nlt | grep 8000 telnet 127.0.0.1 8000 

P.S. You can also check this Wiki page for general information on Pulseaudio network streaming, and this Wiki page about RTP streaming. Don’t expect too much from streaming raw audio over WiFi; it takes enormous gobs of bandwidth. Even with a high-end wireless router/AP with a powerful signal I haven’t been able to get more than stuttering audio out of it. Your best bet is probably to setup a proper media server (like Rygel, which works well with Pulseaudio) to transcode the raw audio to something like MP3 and stream that instead.

Solution 2

You can use VLC to serve a MP3 stream of pulseaudio’s output via HTTP.
The main advantage is that you don’t need to install any special software on your remote device, a web browser (or music player) is all you need to play the stream. The downside is that it’s audio only, a few seconds lag make it useless for videos

    Find pulseaudio’s output name with:

pactl list | grep "Monitor Source" 
cvlc -vvv pulse://XXXX --sout '#transcode:standard' 
http://your.local.ip.address:8888/pc.mp3 

Note: The stream isn’t affected by the volume set on the server, unless you totally mute it. If needed, you can keep the level just a tiny bit above 0 to only hear the remote device.

The first two steps combined into one by polynomial_donut:

cvlc -vvv pulse://$(pactl list | grep "Monitor Source" | awk '') --sout '#transcode:standard' 

Solution 3

To stream audio output over wifi to your android phone you need to install server software, that sends audio, on PC and client software on Android device. Available options are

WiFi Audio Wireless Speaker

Run WiFi Audio Android App and Press start, you will see IP address of mobile device in the bottom after that run Windows/Linux application and put mobile device’s IP address in the IP address field and then press start on PC application. Now all audio coming out from PC will be send to mobile device and you will hear audio on mobile device.
Download

SoundWire

Wirelessly transmit any music or audio from your PC to your Android phone, tablet, or other PCs
Home page Also see

Solution 4

I’ve published a native PulseAudio server for Android (also includes X11 server):

To use it, set environment variable PULSE_SERVER for your Linux application that you want to redirect the audio from:

export PULSE_SERVER=tcp:10.0.0.100:4713 vlc 

where 10.0.0.100 is the IP address of your Android device.

The downside is that you will need to launch each application from the terminal, the upside is that it should be less laggy than module-simple-protocol-tcp. You can put PULSE_SERVER to /etc/profile to set it as a system-wide env variable, then you won’t need to use terminal, but you’ll need to edit it and reboot your PC each time your Android device gets different IP address.

Источник

Оцените статью
Adblock
detector