Hello, dear habrachiteli.
I have a modest hand-made home server:
- File washer
- Torrentkachalkal
- Archive of photos and video
All this works under Ubuntu and has approximately the following config: Intel Core Quad, 4Gb of memory and RAID 5 of 4 2TB disks.
Content from this server take home computers (samba), media player (samba), televisions (DLNA). And everything did not give me the peace of mind to watch the newly released TV series, and even some films, on the phone, lying in bed to sleep, so to speak, coming. A laptop is inconvenient due to its size and the danger of dropping from a bed at the time of an unexpected sleep. I rummaged through many forums, programs, etc., but did not find a solution.
The solution came to mind is quite obvious and simple - you need to transcode the video on the server and give the stream in a format understandable to the player.
I chose the player - MX Video Pleer
Video format - flv
Transcode video will be - mencoder
Install apache
There are no problems with this:
>apt-get install apache2 php5
Install mencoder
First we add the medibuntu repository:
>sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list www.medibuntu.org/sources.list.d$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
And install the mencoder package:
>apt-get install mencoder
And some code
1st page - index.php, file browser.
At the beginning of the file we set the base path for the search. It looks like this in the browser:

')
2nd page - video converter.
Takes the path passed to the URL, runs mencoder through popen and gives the result to the player.
Conversion options are selected experimentally. I picked up for my desire.
And one more subtle point - when requesting with parameters, no player on the phone wanted to play video, so I had to use the rewrite engine from Apache.
Results
With minimal effort, I got the desired result:
- View home video on your phone
- No pre-transcoding
- View content with almost any input parameters (codecs, containers, etc.)
- Transcoded and perfectly visible all the way to BDRemux (> 20 GB)
Disadvantages:
- Lack of audio track selection - easily solved with a few lines of code and a wonderful mediainfo utility
- No rewind - easily solved with several lines of code and the substitution of the start time in the transcoding parameters
- The lack of choice of parameters in the presence of several different android devices with different screens is solved by several lines of code
I do not pretend to be genius and, which is quite likely, looking at the code you say that I am an idiot. But someone this experience may be useful.
Sources for review are available
here .