Use FFMPEG As Encoder for Video Streaming Tutorial
This tutorial is for using ffmpeg to stream using our services. All settings are done in command line. All characters in purple must be replaced with the correct details from your account
Example command for ffmpeg:
#: ffmpeg -i 'FILE or LINK' -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2
-b:a 96k -vcodec libx264 -r 25 -b:v 300k -f flv
'rtmp://Username:Password@test.
primcast.com:1935
/ApllicationName/livestream'
-i 'FILE or LINK'
tells ffmpeg where to pull the input stream from. It can either be a file, a
device or another stream.
Example for capturing from Devices: -i video="screen-capture-recorder":audio="Stereo Mix (IDT High
Definition)"
Example for File: -i '/home/user/sample.mp4'
Example for Link: -i 'udp://127.0.0.0:1000/'
-crf 30
sets the Content Rate Factor.
That's an x264 argument that tries to keep reasonably consistent video quality, while varying bitrate during
more 'complicated' scenes, etc.
A value of 30 allows somewhat lower quality and bit rate.
-preset
ultrafast as the name implies provides for the fastest possible encoding.
-acodec
aac sets the audio codec (internal AAC encoder)
-strict
experimental allows use of some experimental codecs (the internal AAC encoder is
experimental)
-ar 44100
set the audio sample rate
-ac 2
specifies two channels of audio(Stereo)
-b:a 96k
sets the audio bit rate
-vcodec libx264
sets the video codec
-r 25
set the frame rate
-b:v 300k
set the video bit rate
-f flv
says to deliver the output stream in an flv wrapper
'rtmp://Username:Password@test.
is where the video stream
gets pushed to our server. Replace the Username and Password with
the ones on your account.
primcast.com:1935/live/livestream'
Replace the test.primcast.com with the Streaming Address from your
account.
Replace ApplicationName with the one on your dashboard.
Once configured and streaming, you can view the stream from the HLS link in a program like VLC or you can
embed the player from the Generate Player link