Support

Stream on DaCast under Linux with ffmpeg

This guide will explain you how to stream on DaCast with ffmpeg under Linux.

It will cover the following Linux distributions :

  • Ubuntu 14.04
  • Arch Linux

Requirements

You will need to compile ffmpeg yourself in order to have RTMP support with the librtmp library.

Development tools

First, ensure that the necessary tools are installed, in order to compile ffmpeg, librtmp and their dependencies successfully.

  • Ubuntu 14.04
    $ sudo apt-get update
    $ sudo apt-get install build-essential git libssl-dev
  • Arch Linux
    # pacman -Sy base-devel git

Installation

librtmp

  1. Retrieve the librtmp source code on their official git repository :
    $ git clone git://git.ffmpeg.org/rtmpdump
  2. Browse to the local repository's folder, then run the compilation process :
    $ cd rtmpdump
    $ cd librtmp
    $ make
  3. Install the library in your system's root directory :
    # DESTDIR=/usr make install

ffmpeg

Dependencies

You will need to retrieve some additional libraries, such as audio and video codecs required to broadcast your media content.

Ubuntu 14.04

Manual compilation of libaacplus is necessary :

$ sudo apt-get install libfftw3-dev pkg-config autoconf automake libtool unzip
$ wget http://tipok.org.ua/downloads/media/aacplus/libaacplus/libaacplus-2.0.2.tar.gz
$ tar -xzf libaacplus-2.0.2.tar.gz
$ cd libaacplus-2.0.2
$ ./autogen.sh --enable-shared --enable-static
$ make
$ sudo make install
$ sudo ldconfig
# apt-get install yasm libfaac-dev libfdk-aac-dev libfreetype6-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libopenjpeg-dev libopus-dev libschroedinger-dev libspeex-dev libtheora-dev libvo-aacenc-dev libvorbis-dev libvpx-dev libx264-dev libxvidcore-dev
Arch Linux

Some dependencies are located on the ArchLinux User Repository, it is necessary to retrieve their source code then compile these manually.
You have the possibility to automate this process by installing an useful tool called yaourt.
An installation guide is located at this address : http://archlinux.fr/yaourt-en

The required dependencies can be retrieved with the following commands :

# pacman -Sy yasm freetype2 lame opencore-amr openjpeg opus schroedinger speex libtheora libvorbis libvpx x264 xvidcore faac libfdk-aac
$ yaourt libaacplus
$ yaourt vo-aacenc

Compilation

  1. Retrieve the ffmpeg source code on their official git repository :
    $ git clone https://github.com/FFmpeg/FFmpeg.git
  2. Browse to the local repository's folder, then run the compilation process :
    $ cd FFmpeg
    $ ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libaacplus --enable-libfaac --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-openssl --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --prefix=/usr/local --enable-librtmp
    $ make
  3. Install ffmpeg in your system's root directory :
    # make install

Usage

Open your Web Browser, navigate to the DaCast website, then access to your live channel's settings. Browse to the Encoder Setup section.

 

Select Other RTMP Encoder.

The following section should be displayed that way on your screen.

You will need the following data :

Login 123456
Password 789123
Stream URL rtmp://p.ep246802.i.akamaientrypoint.net/EntryPoint
Stream Name   dclive_1_1@246802
   
   
   
   

Run this command :

$ ffmpeg -re -f lavfi -i testsrc -c:v libx264 -b:v 500k -an -s 1920x1080 -x264opts keyint=50 -g 25 -pix_fmt yuv420p -f flv "rtmp://p.ep246802.i.akamaientrypoint.net/EntryPoint flashver=FMLE/3.0\20(compatible;\20FMSc/1.0) live=true pubUser=123456 pubPasswd=789123 playpath=dclive_1_1@246802"

Your live stream should look like this :

Comments

  • Avatar
    danyasselin

    ffmpeg -re should not be used with live camera streams

  • Avatar
    adamroderick

    libaac link is out of date. Here is a link for instructions from ffmpeg's site: https://trac.ffmpeg.org/wiki/How%20to%20quickly%20compile%20libaacplus

  • Avatar
    adamroderick

    Thanks for this write up. Here is a gist to run it as a script on Ubuntu 14.04:

    https://gist.github.com/aroder/d1f419da23cb5b6640b2

  • Avatar
  • Avatar
    lukemiller_1

    I'm a newbie to DaCast and Akamai, so this is probably obvious to most folks. But I have found that in my case it does not work to stream to the playpath that contains a "%i" such as dclive_1_%i using FFMPEG. For me it does work to change the %i to any alphanumeric string and stream to dclive_1_1, dclive_1_2, dclive_1_3, or to dclive_1_320, dclive_1_480, dclive_1_720, or dclive_1_one, dclive_1_two, dclive_1_three, etc.

    Using the %i in the playpath did work using Wirecast 5 which threw me off on figuring this out. But presumably when using Wirecast the %i gets replaced with another string somewhere along the line.

    The page below and scrolling down to the "ADDING MULTI-BITRATES" section on this Wirecast setup page here...

    http://help.dacast.com/hc/en-us/articles/200632824-Wirecast-Multi-bitrates-Documentation-Version-5-6-

    has some explanation of how this is tied to the bitrate. And the pages here...

    http://help.dacast.com/hc/en-us/articles/200396644--Do-you-support-MultiBit-rate-streaming-LIVE-

    and here...

    http://help.dacast.com/hc/en-us/articles/200384755-Has-the-bitrate-option-in-encoder-settings-on-dacast-portal-any-real-impact-on-my-stream-

    Gave me a better picture of how this works with multi-bitrate on DaCast / Akamai.

    Hope this helps another newbie.

  • Avatar
    lukemiller_1

    All of the italic numeral 1s in my previous post should be read as "" + "1" + "". Apparently, underscores are the italic formatting code on Zendesk. Doh!

  • Avatar
    lukemiller_1

    And you can't use the underscore character at all! :) It should be read as a literal underscore character followed by a numeral one followed by another underscore character. No spaces.

  • Avatar
    john_58

    I got DaCast to work on a Rasberri Pi 2 from an H264 RTSP IP camera source without encoding. This method barely uses any CPU. If you have to reencode H264 the Pi 2's CPU is not even fast enough to keep up with low framerates or resolutions.

    ffmpeg \
    -i "rtsp://user:password@ipcamera:7070/track1" \
    -map 0:0 \
    -codec copy \
    -f flv \
    "rtmp://p.epxxxxxxx.i.akamaientrypoint.net/EntryPoint/dclive_x_xxx@xxxxx flashver=FMLE/3.0\20(compatible;\20FMSc/1.0) live=true pubUser=xxxxxx pubPasswd=xxxxxx playpath=dclive_x_xxx@xxxxx"

  • Avatar
    rodrigogasparin

    @ Linux 4.8.0-32-generic #34-Ubuntu SMP Tue Dec 13 14:30:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

    In the libaacplus part, I've had to install also "libtool-bin" before "./autogen.sh --enable-shared --enable-static".

    Problem also configuring ffmpeg:
    Unknown option "--enable-libaacplus".
    Unknown option "--enable-libaacplus".
    Unknown option "--enable-libfaac".
    Unknown option "--enable-libvo-aacenc".

  • Avatar
    rodrigogasparin

    john_58, nice method!

    Some people(like myself) might have timeout problem using UDP, "$ ffmpeg -rtsp_transport tcp -i ..." should solve it.

  • Avatar
    stephenbuchanan

    I am getting an error

    PublisherAuth, Authentication failed: unknown auth mode: [ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=cannot_load_password_file
    rtmp server requested close

    I am pretty sure I have the correct authentication details...