Record an RTMP stream to file
streaming
// what it does
Connects to an RTMP endpoint and records the incoming stream to disk. RTMP carries an FLV-wrapped H.264/AAC feed, and -c copy remuxes those packets straight into MP4 with no re-encode. Useful for capturing a live broadcast or ingest feed that a server is publishing.
// shell
$ ffmpeg -i "rtmp://example.com/live/stream" -c copy output.mp4// gotcha
MP4 writes its moov atom (the index) only on clean shutdown, so if the process is killed or the stream drops mid-record the file is often unplayable. Record to .ts or .flv, or add -movflags frag_keyframe+empty_moov, to survive an interrupted capture.