Skip to main content

Using FFmpeg with THEOlive

FFmpeg is a free open-source software project with command-line tools for handling video, audio, and other multimedia. It is common practice to use Ffmpeg in production workflows when broadcasting from a media file on disk.

Broadcasts are started using the ffmpeg command-line to forward a source using RTMP broadcast contribution protocol to stream content to THEOlive.

See the official ffmpeg.org documentation for installation instructions and additional support.

Common Settings

ParameterDescription
-stream_loop -1Loop the video indefinitely
-vb 4500kVideo Bitrate setting of 4.5 Mbps
-c:a copyCopy the audio codec from the input
-bf 0Disable bframes
-g 60Group of pictures (GOP) size
-f flvPackage flash video
-preset veryfastVideo encoding speed to compression ratio preset
-tune zerolatencyGood for fast encoding and low-latency streaming
-vprofile mainH264 video profile

Start the stream

Run the following command with the proper settings in order to start publishing to your channel.

MEDIA_FILE="/path/to/file.mp4"
RTMP_PUBLISH_URL="rtmps://rtmp.<region>.theo.live/live"
RTMP_STREAM_KEY="Your stream key"

ffmpeg -re -stream_loop -1 -i $VIDEO_FILE_PATH \
-vcodec libx264 \
-preset veryfast \
-bf 0 \
-g 60 \
-vb 4500k \
-vprofile main \
-tune zerolatency \
-level 3.0 \
-c:a copy \
-f flv \
-rtmp_playpath $RTMP_STREAM_KEY \
-rtmp_live live $RTMP_PUBLISH_URL
Upload bandwidth

Make sure that your encoder has a stable connection and enough upload bandwidth. This will ensure all data is correctly sent to the THEOlive channel.