> streaming
Streaming work with ffmpeg splits into two directions: pulling live feeds down to disk (HLS .m3u8, RTMP) and pushing local files or captures out to an RTMP ingest endpoint. The core decisions are whether to remux (-c copy) or re-encode, which muxer the protocol expects (FLV for RTMP), and whether the source must be read at real-time pace (-re) so you don't flood the far end.
// streaming
3 commands$ ffmpeg -i "https://example.com/stream.m3u8" -c copy output.mp4$ ffmpeg -i "rtmp://example.com/live/stream" -c copy output.mp4$ ffmpeg -re -i input.mp4 -c:v libx264 -c:a aac -f flv "rtmp://example.com/live/stream"// faq
How do I record a live stream without re-encoding it?
Use -c copy to stream-copy the packets straight into the output container instead of decoding and re-encoding. It adds almost no CPU overhead and is lossless, but only works when the target container supports the source codecs (H.264/AAC remux cleanly into MP4, FLV, or MKV).
Why does ffmpeg keep running and never finish when recording a live stream?
Live HLS and RTMP inputs have no end-of-file, so ffmpeg records until you stop it. Press q or Ctrl+C in the terminal to finalize and cleanly close the output file.
Why do I need -re when streaming a file to an RTMP server?
-re throttles reading to the input's native rate so packets go out in real time. Without it, ffmpeg sends the whole file as fast as the disk allows, overrunning the server's buffers and breaking live playout.