Knowledge Base

Stream on DaCast under Mac with ffmpeg

248 views March 15, 2018 March 15, 2018 admin 0

Are you interested in streaming on DaCast under Mac OS with ffmpeg? This guide provides a step-by-step explanation to get you started!
To stream on DaCast under Linux with ffmpeg, click here.

Requirements:

You will need to compile ffmpeg with the help of brew (https://brew.sh/) and specific librtmp parameters detailed below.

Development tools:

Before getting started, please make sure to install the brew package manager and have an updated version of Xcode Command Line Tools included for free with your Mac OS distribution.
For more information on how to install Xcode Command Line Tools, please click here.

To install brew, just copy paste in your terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then, follow the instructions.

Installation:

1. librtmp, libx264, libfdk-aac

  • First, install  librtmp with brew
$ brew install librtmp
  • Then, install  libx264 with brew
$ brew install libx264
  • Finally, install  libfdk-aac with brew
$ brew install fdk-aac

2. ffmpeg

Install ffmpeg with all the specific libraries:

brew install ffmpeg --enable-libfdk-aac --with-x264 --with-rtmpdump

Usage

Open your Web Browser, navigate to the DaCast website, and then access your live channel’s settings. Once there, please browse to the Encoder Setup section, as pictured below:

From here, make sure to select Other RTMP Encoder.

At this point, you should see the following information on your screen.

Once here, you’ll need the following data:

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

Next, please run the following command:

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

Important Notes (please read carefully)

Note 1: if your credentials are rejected
You must have followed all the steps above and the librtmp manual compilation or this is not gonna work: your credentials will be rejected by the server.

 

Note 2: common error
A recurring typo in fdk aac usage is that, during the installation process, you need to enter “–enable-fdkaac” but when you use it in the command it is: “-c:a libfdk_aac”

 

Note 3: insert your source  path
You want to replace

-f lavfi -i testsrc

with

-i /your_source_path

Otherwise you will just have the test screen (as shown below), not your live stream. If you have not replaced “-f lavfi -i testsrc” with “-i /your source path”, you will see the following test screen:

 

Note 4: increase buffer for smoother playback
If your playback is not smooth enough, you can increase the size of your buffer by replacing:

-b 900k

with

-bufsize 3000k

Your command will look like this:

$ ffmpeg -re -i /your_source_path -c:v libx264 -b:v 1600k -preset ultrafast -bufsize 3000k -c:a libfdk_aac -b:a 128k -s 1920x1080 -x264opts keyint=50 -g 25 -pix_fmt yuv420p -f flv "rtmp://p.ep246802.i.akamaientrypoint.net/EntryPoint flashver=FMLE/3.020(compatible;20FMSc/1.0) live=true pubUser=123456 pubPasswd=789123 playpath=dclive_1_1@246802"

 

Note 5: better quality for powerful system
If you want a better quality and your system is powerful enough, you may replace

-preset ultrafast

with

-preset fast

Your command will look like this:

$ ffmpeg -re -i /your_source_path -c:v libx264 -b:v 1600k -preset fast -b 900k -c:a libfdk_aac -b:a 128k -s 1920x1080 -x264opts keyint=50 -g 25 -pix_fmt yuv420p -f flv "rtmp://p.ep246802.i.akamaientrypoint.net/EntryPoint flashver=FMLE/3.020(compatible;20FMSc/1.0) live=true pubUser=123456 pubPasswd=789123 playpath=dclive_1_1@246802"

 

Note 6: lowest latency for very powerful system 
If your goal is to get the lowest latency and you have a very powerful system, you may add the following to the initial command:

-tune zerolatency

Your command will look like this:

$ ffmpeg -re -i /your_source_path -c:v libx264 -b:v 1600k -preset ultrafast -tune zerolatency -b 900k -c:a libfdk_aac -b:a 128k -s 1920x1080 -x264opts keyint=50 -g 25 -pix_fmt yuv420p -f flv "rtmp://p.ep246802.i.akamaientrypoint.net/EntryPoint flashver=FMLE/3.020(compatible;20FMSc/1.0) live=true pubUser=123456 pubPasswd=789123 playpath=dclive_1_1@246802"

 

Feel free to get in touch with DaCast directly if you need further support with this process.

Was this helpful?

Leave A Comment

*
*