DEV Community

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

Posted on • Updated on

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]

Top comments (0)