Page tree
Skip to end of metadata
Go to start of metadata

This documentation is for Release 4.x. For prior releases see v.18


Installation

Download Adobe Media Server 5.x starter

If your archive is called AMS_5.0.1.tar.gz use these commands to install the server. If it is named something else replace the filename accordingly.

unzip AdobeMediaServerStarter_5_x64_LS1_All.zip
cd linux 
tar -xvzf AdobeMediaServer_5_LS1_linux64.tar.gz
cd AMS_5_0_1_r1076/
ln -s /lib64/libcap.so.2 libcap.so.1
sudo ./installAMS

Accept the defaults and it will put your server underneath /opt/adobe/ams

To test your server and make sure it is working go to http://localhost:80. RTMP streaming will probably be broken but HTTP Live Streaming should work correctly. To fix RTMP streaming after verifying the installation is correct stop your server and relink the libcap library

cd /opt/adobe/ams
sudo ./server stop
sudo ln -s /lib64/libcap.so.2 libcap.so.1
sudo ./server start

Configuring AMS to work with HTTP Live Streaming

Follow the instructions below if you're using the built-in Apache server that ships with AMS

Add the following to the end of ams.ini. Note that if you keep your streams somewhere else, you'll have to symlink webroot/avalon to it, the built-in Apache always looks for content under webroot/avalon.

ams.ini
...
AVALON.STREAM_PATH = <amsdir>/webroot/avalon
AVALON.AUTH_URL = http://avalon.domain.edu/authorize

Download these files and put them in <amsdir>/applications/avalon/

Add the following to the end of <amsdir>/Apache2.2/conf/httpd.conf

httpd.conf
Include conf/avalon.conf

Create <amsdir>/Apache2.2/conf/avalon.conf with this content. 

avalon.conf
<IfModule mod_disk_cache.c>
    CacheEnable disk /avalon
</IfModule>
RewriteEngine on
RewriteLock /tmp/avalon_rewrite_lock
RewriteMap avalon_auth prg:/usr/local/sbin/avalon_auth
RewriteCond %{QUERY_STRING} audio-only=true
RewriteCond %{QUERY_STRING} codec=aac
RewriteCond %{QUERY_STRING} token=([^&]+)
RewriteRule ^/avalon/(.+).m3u8$ /avalon/audio-only-aac/$1.m3u8?token=%1 [R=301,L] 
RewriteCond %{QUERY_STRING} audio-only=true
RewriteCond %{QUERY_STRING} token=([^&]+)
RewriteRule ^/avalon/(.+).m3u8$ /avalon/audio-only/$1.m3u8?token=%1 [R=301,L]
RewriteCond %{QUERY_STRING} token=([^&]+)
RewriteRule ^/avalon ${avalon_auth:%{REQUEST_URI}?token=%1}
RewriteCond %{REQUEST_URI} !(.+).ts$
RewriteCond %{QUERY_STRING} !token=
RewriteRule ^/avalon - [F]
RewriteRule ^/avalon/forbidden - [F]
<Location /avalon>
  HLSHttpStreamingEnabled true
  HLSMediaFileDuration 2000
  HttpStreamingContentPath "../webroot/avalon"
  HLSFmsDirPath ".."
  HLSJITConfAllowed true
  HLSM3U8MaxAge 86400
  HLSTSSegmentMaxAge 86400
  HLSMetaMaxAge 3600
  Options -Indexes FollowSymLinks
</Location>

Create the file /usr/local/sbin/avalon_auth with the following content and replace <ams_dir> with the value from above

#!/bin/bash
if [ -z "$AUTH_URL" ]; then
  AUTH_URL=`grep AVALON.AUTH_URL <ams_dir>/conf/ams.ini | cut -d '=' -f 2 | sed 's/^ *//g'`
fi
while read uri; do
  saveIFS=$IFS
  IFS='=&'
  parm=($uri)
  IFS=$saveIFS
  curl_cmd="curl -s ${AUTH_URL}.txt?token=${parm[1]}"
  raw=`${curl_cmd}`
  result='/avalon/forbidden'
  for seg in $raw; do 
    valid=`echo ${uri} | grep /${seg}`
    if [ -n "${valid}" ] && [ -n "${seg}" ]; then
      result=$uri
      break
    fi
  done
  echo $result
done

Configuring AMS with an external Apache

Should you decide not to use the built-in Apache server that ships with AMS, you'll want to follow the instructions above and THEN carry out the steps below.

Disable built-in Apache

ams.ini
...
SERVER.HTTPD_ENABLED = false

Add the following to /etc/httpd/conf/httpd.conf

httpd.conf
...
Listen 8134
...
LoadModule hlshttp_module modules/mod_hlshttp.so
#
# Configuration for Adobe Media Server's HTTP Live Streaming
#
<IfModule hlshttp_module> 
  <Location /hls-vod> 
    HLSHttpStreamingEnabled true 
    HLSMediaFileDuration 8000 
    HttpStreamingContentPath "/var/avalon/rtmp_streams" 
    HLSFmsDirPath "/srv/adobe/ams" 
    Options -Indexes FollowSymLinks 
  </Location> 
</IfModule>

Create avalon-auth.conf in /etc/httpd/conf.d/

<IfModule mod_disk_cache.c>
    CacheEnable disk /avalon
</IfModule>
 
RewriteCond %{QUERY_STRING} audio-only=true
RewriteCond %{QUERY_STRING} codec=aac
RewriteCond %{QUERY_STRING} token=([^&]+)
RewriteRule ^/avalon/(.+).m3u8$ /avalon/audio-only-aac/$1.m3u8?token=%1 [R=301,L]
 
RewriteCond %{QUERY_STRING} audio-only=true
RewriteCond %{QUERY_STRING} token=([^&]+)
RewriteRule ^/avalon/(.+).m3u8$ /avalon/audio-only/$1.m3u8?token=%1 [R=301,L]
 
RewriteCond %{QUERY_STRING} token=([^&]+)
RewriteRule ^/avalon ${avalon_auth:%{REQUEST_URI}?token=%1}
 
RewriteCond %{REQUEST_URI} !(.+).ts$
RewriteCond %{QUERY_STRING} !token=
RewriteRule ^/avalon - [F]
RewriteRule ^/avalon/forbidden - [F]
 
<Location /avalon>
  HLSHttpStreamingEnabled true
  HLSMediaFileDuration 2000
  HttpStreamingContentPath "/srv/avalon/rtmp_streams"
  HLSFmsDirPath "/srv/adobe/ams"
  HLSJITConfAllowed true
  HLSM3U8MaxAge 86400
  HLSTSSegmentMaxAge 86400
  HLSMetaMaxAge 3600
  Options -Indexes FollowSymLinks
</Location>

Create mod_rewrite.conf in /etc/httpd/conf.d/.

RewriteEngine on
RewriteLock /tmp/avalon_rewrite_lock
RewriteMap avalon_auth prg:/usr/local/sbin/avalon_auth

If using VirtualHost, you'll want to enable RewriteEngine

<VirtualHost>
  RewriteEngine on
  RewriteOptions Inherit
  ...
</VirtualHost>

Copy avalon_auth to /usr/local/sbin/avalon_auth 

Copy these files from <amsdir>/Apache2.2/modules/ to /etc/httpd/modules/

libadbe_dme.so
libadbe_license.so
libasneu.so.1
libexpat.so.0
libhds.so
mod_hlshttp.so
  • No labels