1. Walter Ebert
  2. ffmpeg-hls

Overview

HTTPS SSH

FFmpeg HLS

This is a demonstration on how to create an Apple HTTP Live Stream (HLS) using FFmpeg.

HLS is supported on:

  • iOS
  • Mac (Safari browser)
  • Windows 10 (Edge browser)
  • Android 3 or later
  • Flash (with a HLS plugin)

To create a HLS video stream you need to install FFmpeg. If you are running Linux, a package will probably be available from the distribution repositories. Otherwise you have to compile from source. You should use a recent version of FFmpeg (version 1.2 or later).

Ubuntu / Debian:

sudo apt-get install ffmpeg

Fedora / CentOS:

yum install ffmpeg

openSUSE (first install the Packman community repository):

sudo zypper install ffmpeg

For Windows download binaries from:
http://ffmpeg.zeranoe.com/builds/

For Mac download binaries from:
http://www.evermeet.cx/ffmpeg/

Get the sources from the Sintel Open Movie Trailer:
http://media.xiph.org/sintel/
sintel_trailer-720-png.tar.gz (images)
sintel_trailer-audio.flac (sound)

Unpack the images:

tar -xvf sintel_trailer-720-png.tar.gz

To create the HLS stream run:

./build.sh

On Windows you can install Cygwin or cmder to run shell scripts.

If all runs smoothly, you can view the movie in your browser (if it supports HLS) by opening:

sintel-trailer.html

To serve HLS from Apache add the correct MIME type to your configuration:

AddType application/x-mpegurl .m3u8
AddType video/mp2t .ts

Using MIME type application/vnd.apple.mpegURL will not work on most Android devices. HLS support is available on Android 3.0 or later, but seems to be quite picky about the HLS formatting and web server configuration.

References

Author

Walter Ebert