Skip to content

How to view a file?

How to view a file

The task: you have a video file, and you need to organize broadcasting of this file over a network.

Content:

Installing Flussonic Media Server

First, you should install Flussonic Media Server.

Preparing the file: Correct format

Flussonic Media Server can only play files in certain formats.
The main container format is mp4, video codec is h264, and audio codec is aac.

In order to be able to check and change the file format on the server, if necessary, you have to install ffmpeg.
It is not necessary to install it on the server itself, it can be installed on another computer with Linux, Windows or OSX operating systems.

Instructions for downloading ffmpeg are available from the official website: https://www.ffmpeg.org/download.html.

Many GNU/Linux distributions already have ffmpeg in their standard repositories. For example, in Ubuntu starting with version 15.04 Vivid Vervet, it is enough to enter "apt-get install ffmpeg" in the command line. If you don't have this package, you should search in third-party repositories, or just download static build.

To detect the format, we will use command ffprobe in the just installed ffmpeg.
In the command prompt, type ffprobe /path/to/your/video/video.mp4. The correct path to the video file should be specified.

Here is what the ffprobe output for an incorrect file should look like:


ffprobe version N-61916-g46f72ea Copyright (c) 2007-2014 the FFmpeg developers

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Duration: 00:05:00.18, start: 0.012000, bitrate: 769 kb/s
    Chapter #0.0: start 0.000000, end 300.000000
    Metadata:
      title           : Chapter 1
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1331:1000 DAR 2662:1125], 636 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(rus): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      handler_name    : SubtitleHandler

Here we can see several tracks, where Video: h264 means using proper codec h264 and Audio: aac — proper codec aac.

Here is how the ffprobe output for an incorrect file should like:


Input #0, asf, from 'video.wmv':
  Duration: 00:05:00.22, start: 0.000000, bitrate: 388 kb/s
    Chapter #0.0: start 0.000000, end 300.217000
    Metadata:
      title           : Chapter 1
    Stream #0:0: Video: msmpeg4v3 (MP43 / 0x3334504D), yuv420p, 640x360, 23.98 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, 2 channels, fltp, 128 kb/s

Here we can see that the Windows Media format (wmv) is used with the corresponding codecs. Flussonic Media Server will not play anything back.

What should be done if the format is incorrect? To convert wmv/msmpeg/wma into mp4/h264/aac, ffmpeg may be used:


ffprobe /path/to/your/original/video/video.wmv /path/to/your/modified/video/video.mp4

The monitor will display something like:


Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4 -> libx264)
  Stream #0:1 -> #0:1 (wmav2 -> libvo_aacenc)
Press [q] to stop, [?] for help
frame=  937 fps=180 q=-1.0 Lsize=    2320kB time=00:00:39.04 bitrate= 486.7kbits/s dup=1 drop=0  

This process is called transcoding, and it may be very time- and resource-consuming. The more powerful your hardware is, the faster transcoding is performed.

For the same reason, Flussonic Media Server does not transcode files automatically. It is assumed that users will do it manually on dedicated hardware. By the way, you cannot transcode live broadcasts in advance, therefore Flussonic offers a built-in transcoder for streams.

As a result of all the above we will receive a file that is completely suitable for playing back in Flussonic Media Server.

Preparing file: Picture quality

You might wish to lower the quality, or make a multi-bitrate file (which will ensure comfortable viewing by users connected to the Internet at different rates).

Learn more in file transcoding.

Configuring Flussonic Media Server

In order to make Flussonic Media Server start servicing files, add special configuration to the configuration file (/etc/flussonic/flussonic.conf):


vod vod {
  storage /movies;
  download;
}

This setting is called 'VOD location' (this word is used in the documentation and by our customer support team).

/movies is the folder on the server disk where video files are stored.

Technically this folder can be located in an NFS shared disk, but it's not a very good decision, since NFS is slow and not always good to use. One should better use a local hard disk, or an SSD.

After you add this setting, apply the changes in configuration by running the command service flussonic reload

Uploading file to server

To upload a file to the server, you can use web interface. In the main menu, select Media -> VODs -> location name -> browse. On the page that opens, you can add files to the VOD location, create nested directories to organize files, play files and get links for playing VOD files.

Flussonic VOD

Note that using the web interface is not the only way to upload a file. The file can be uploaded using SSH or FTP, or any other way of transferring files over the network. The main thing is that the file is in the directory that is specified in the configuration file. Flussonic Media Server is executed as root, meaning it has access to any files, therefore, no special access rights to this uploaded file are required.

Viewing the file

In the web interface (in Media > VOD) click on the desired file to start playing it.

The URL of the video is indicated just below it, and may be used for watching outside the web interface.
It should look something like: http://FLUSSONIC-IP/vod/elementary/s01e02.mp4/index.m3u8
The URL ends with .m3u8, which means that the HLS protocol will be used for playback.

Such an URL may be watched in any player that supports HLS well. For example, you may download and run video player VLC, select Media > Open Network Stream or Media > Open URL, or press the key combination Ctrl+N and paste the URL into the input box.

Additional actions

Read the documentation about how VOD works in Flussonic
It contains answers to a few questions that are not covered in this article.