Stream a video file to an RTMP server
streaming
// what it does
Reads a local file and pushes it to an RTMP server as a live stream. -re paces input reading at its native rate so it plays out in real time; -c:v libx264 and -c:a aac re-encode to the H.264/AAC combo RTMP expects, and -f flv forces the FLV muxer required by the protocol. This is the standard way to simulate a live source, e.g. feeding a file into a streaming platform's ingest.
// shell
$ ffmpeg -re -i input.mp4 -c:v libx264 -c:a aac -f flv "rtmp://example.com/live/stream"// gotcha
Drop -re and ffmpeg blasts the whole file to the server as fast as it can, breaking playout; but -re does not guarantee real-time encoding, so on high-resolution input a too-slow libx264 preset will fall behind and stutter. Many platforms also need a fixed keyframe interval (e.g. -g matching 2 seconds of frames).