To stream your MP4 video file to Owncast using FFmpeg

Bastaki Blog Posts February 17, 2025 By Administrator

To stream your MP4 video file to Owncast using FFmpeg, follow these steps:

1. Locate Your Owncast RTMP Credentials

  • In your Owncast admin dashboard (http://your-server:8080/admin), go to ConfigurationStream Keys.
  • Copy the Stream URL (e.g., rtmp://your-server/live) and Stream Key (e.g., abc123-secret-key).

2. Basic FFmpeg Command

fffmpeg -re -stream_loop -1 -i video.mp4 \
       -map 0:v -map 0:a \
       -c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k -g 60 -pix_fmt yuv420p \
       -c:a aac -b:a 128k -ar 44100 \
       -f flv 'rtmp://localhost:1935/live/key'

Explanation of Flags:

  • -re: Read input at native frame rate (avoids streaming too fast).
  • -stream_loop -1: Loop the video infinitely (remove this to stream once).
  • -c:v libx264: Use H.264 video codec.
  • -preset veryfast: Balances speed and compression efficiency.
  • -b:v 2500k: Video bitrate

...

To stream your MP4 video file to Owncast using FFmpeg, follow these steps:

1. Locate Your Owncast RTMP Credentials

  • In your Owncast admin dashboard (http://your-server:8080/admin), go to ConfigurationStream Keys.
  • Copy the Stream URL (e.g., rtmp://your-server/live) and Stream Key (e.g., abc123-secret-key).

2. Basic FFmpeg Command

fffmpeg -re -stream_loop -1 -i video.mp4 \
       -map 0:v -map 0:a \
       -c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k -g 60 -pix_fmt yuv420p \
       -c:a aac -b:a 128k -ar 44100 \
       -f flv 'rtmp://localhost:1935/live/key'

Explanation of Flags:

  • -re: Read input at native frame rate (avoids streaming too fast).
  • -stream_loop -1: Loop the video infinitely (remove this to stream once).
  • -c:v libx264: Use H.264 video codec.
  • -preset veryfast: Balances speed and compression efficiency.
  • -b:v 2500k: Video bitrate

...

Comments 0

Log in to post a comment.

No comments yet. Be the first to comment!

Source Information
Bastaki Blog Posts
Web Publication

Published on February 17, 2025 by Administrator

RSS Feed:
Bastaki Blogs
Visit Original Article
Advertise with Us

Reach our audience with your ads