I use ffmpeg for rtmp streaming for instance with a command like this:

ffmpeg -i file.mp4 ... rtmp://localhost/stream

Sometime I need to replace file.mp4 with new_file.mp4. How do I do that without stutters and stopping the stream? I suppose I can't do sth like that:

mv new_file.mp4 file.mp4

without killing the ffmpeg process :)


1 Answer 1


Put your ffmpeg inside an infinite loop:

while true; do
  ffmpeg -i file.mp4 ... rtmp://localhost/stream
  • 1
    This does not work, the broadcast will restart every iteration
    – RTK
    Jul 11, 2018 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .