DEV Community

Cover image for Streaming to RMTP/Facebook live using FFmpeg on Docker
Youssef Gamil
Youssef Gamil

Posted on • Edited on

2

Streaming to RMTP/Facebook live using FFmpeg on Docker

Motivation

I was thinking about stream couple of video files to Facebook. After some googling, I came across this tutorial to compile FFmpeg in a way that facebook's RTMP will accept.

The bad news was, some ubuntu-based dependencies are among the tutorial requirements and this is where Docker came into play!

Stream

  • If you're a fan of having a single configuration file to launch the whole experiment, your docker-compose.yml file would look like this:
version: '3.7'
services:
  ffmpeg2rtmp:
    image: docker.pkg.github.com/yoga1290/ffmpeg2rtmp/ffmpeg2rtmp:20.06.0
    environment: 
      - URL_RTMPS=rtmps://live-api-s.facebook.com:443/rtmp/....
    volumes:
      - ./LOCAL_VIDEO_FILE.mp4:/usr/app/input.mp4
    #command: # otherwise, override the runtime command for your own needs
  • Otherwise, if it's one time run, your implicit command would be:
docker run \
    --rm \
    -e URL_RTMPS=$FACEBOOK_URL_RTMPS \
    -v $PATH_TO_VIDEO_FILE:/usr/app/input.mp4 \
docker.pkg.github.com/yoga1290/ffmpeg2rtmp/ffmpeg2rtmp:20.06.0
    #[COMMAND] [ARG...]

[github]

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay