How to stream a pre-recorded video with FFmpeg
Stream a local video file to any RTMP destination
FFmpeg is a tool that allows you to stream a local video file from your computer to any RTMP destination (Facebook, YouTube, Twitch, Instagram, Twitter, etc.). It takes your file → encodes it with acceptable video parameters → streams the encoded video feed to your destinations.
DISCLAIMER: FFmpeg is a powerful and completely free solution that will most likely meet your need if you are a tech-savvy person. However, if you do not know what console and RTMP streaming is, you can use LiveReacting - a simple and affordable browser-based tool for streaming video you can use without tech knowledge.
Before we start, make sure you meet the following requirements.
- Since streaming will be conducted from your PC, you must have a stable internet connection. Preferably Ethernet, not WIFi. For 720p video at 30 frames per second, you’ll need at least 4Mbps upload speed.
- FFmpeg will encode your file on the fly. It consumes a lot of CPU power. It is hard to define the exact PC specs, but we recommend having at least a modern two-core CPU (like Intel i3).
- Do not run other heavy applications during the stream.
First of all, you have to install FFmpeg on your computer. Here are great tutorials on how to do it:
When you successfully installed FFmpeg, you will need to execute the following command to start streaming:
ffmpeg -re -i inputfile.mp4 -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k
-bufsize 6000k -pixfmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv
You have to replace ‘inputfile.mp4’ with the path to the file you want to stream. And ‘<RTMP_URL>’ with your RTMP destination URL
If you stream to social media services like Facebook or Youtube, you can get RTMP URL by combining your server URL with the stream key.
Here is an example how what it looks like on Facebook:
In this case, your RTMP URL is: rtmps://live-api-s.facebook.com:443/rtmp/FB-7918474228178653-0-AbyVmzbsAncsrrvW
That is it. If you are still struggling to set it up, we recommend checking the free trial at LiveReacting and starting streaming your pre-recorded video files with no effort.
Send us a message in the live chat on our website and we'll be glad to share about other interactive elements, which you can add into your live streams to generate more views.
LiveReacting is a steraming platform for Social Media Managers, Digital agencies, brands and influencers that helps to enrich any live video with interactive elements and graphics in order to get more engagement and views.
For queries and feedback, send our team a message in a Live Chat on our website or write to us at [email protected]