Project

General

Profile

The backend server

The server has two major goals:
  1. offer a medialist (in different formats)
  2. stream any media from the list (without any recoding)
The server supports these commandline parameters:
  • appDir - the applications configuration directory. Should be writable, if remote administration shall be enabled
  • realm - the absolute path of the credentials file. Should be writable, if remote administration shall be enabled

The server is multithreaded, which means, it can stream a pretty long movie and is stil resposive to medialist-requests.
On start, the given mediaRoot is scanned for media (lots of audio, video and picture formats are recognized). This list can be requested from client via HTTP-Interface. To support big storage systems, the media list is returned in page chunks (default: 40 entries per page).

The Server is pretty modular, so the supported media can be extended as well as the number of supported formats of the medialist.
Currently HTML and JSon is supported, with HTML being the default.

Server Configuration

in the application directory a file srserver.conf will be used to hold server setup. That file is plain text, with any line started with '#' being treaten as comment.
Each config line has the format: 'name' = 'value'
These are the supported entries:
  • media-root - contains the absolute path of the directory where scanning for media will start
  • favicon - the absolute path to a icon that serves to identify the server using standard webbrowsers
  • cmps-port - the backend port, where clients can connect to
  • want-auth - flag to signal, whether the server should require authorization
  • want-meta - flag to enable deeper scan for media informations. If set to false, only information from filesystem will be used. Enabling the scan for meta information will slow down the media scan.
  • mediainfo - the absolute path to mediainfo (external tool to retrieve info)
  • ffmpeg - the absolute path to ffmpeg, which will be used to retrieve media information too (on some media types).

Configuration of deep scan

all media can be investigated by mediainfo - which offers quite a bunch of informations, but significantly slows down startup of the server.
Just 2 compare the both extremes: Scanning of 10k Media takes 180ms on my test system. The same scan, with deep-scan enabled for all media takes 250.000ms. This factor way be much worse, depending on the media an the available informations. mediainfo can extract meta-informations from audio-tracks, but if the audio-files are well grouped by album and performer, those informations can already be used as filter on client without enabling deep scan for audio files.
So deep scan can be enabled/disabled for each media type.
If you don't use "want-meta", no deep scan will be performed for no media.
Using "want-meta" with true, deep scan will be enabled for all movie-types, which means, no deep scan for audio and pictures.
There exists two ways to change the default:
  • use "deep-scan" as name with mediatypes as value. This will disable deep scan for all media types that are not in the list
  • use "no-deep-scan" as name with mediatypes as value. This will enalbe deep scan and exclude the named mediatypes
Mediatypes must match the definition from cAbstractMedia which currently are:
  • Audio
  • Movie
  • DVDImage
  • LegacyVdrRecording
  • VdrRecording
  • Picture

So i.e. to enable deep scan for audio and pictures and exclude all movie types from deep scan use

deep-scan = Audio, Pictures

A sample server configuration file might look like:

#
# config for cmps - the backend of CMP
#
media-root = /media
favicon = /media/favicon.ico
cmps-port = 9000
want-auth = true
want-meta = true
mediainfo = /usr/bin/mediainfo
ffmpeg = /usr/local/bin/ffmpeg

extending Mediatypes by usage of deep scan

mediainfo is able to determine, whether a movie is interlaced or progressive. Having deep scan enabled for movie types, the mediatype will change, if mediainfo determined an interlaced movie. Each movie mediatype gets a new partner with I prefix. The client supports a player commandline for each mediatype, so now you can use a different player for interlaced media as for progressiv media - of the same original media type.
Or simply use the same mediaplayer but with different commandline arguments ...

HTTP command interface

  • / - root URI, returns one page of the medialist. The returned page can be configured by parameters:
  • start - the index of the first media item in page (default: 0)
  • limit - the number of entries per page (default: 40)
  • format - the format of the medialist (default: html) - currently "json" is the only supported alternative
  • /help - tell the usage of the server and all active plugins
  • <URI> - any other URI is supposed to be the URI of a media, so the server tries to start streaming

Special handling of certain media

Some media get special treatment by the server:
  • vdr-recordings with moviefiles named *.vdr (called Legacy VDR-recording)
  • vdr-recordings with moviefiles named *.ts (called VDR-recording)
  • DVD-images on disk with several *.iso files (called DVDImage)

These media are supposed to consist of several files per media, so the server collects them all together, and no client need to know anything about clustered media - they are streamed as a single virtual file.

Server has been tested by using ffplay from ffmpeg project as media-client, but should work the same with any other client, that supports streaming by http-protocol.

roadmap

  • Authentication via HTTP-digest is already implemented and tested via firefox.
    But the server's commandline is not able to support that configuration yet.
  • add a command-plugin to the server, so the servers configuration and list of known users can be administrated from clients.