TransWikia.com

RTMP + FFMPEG streaming: how do I change a file on the fly?

Unix & Linux Asked by JavaRunner on October 9, 2020

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 🙂

One Answer

Put your ffmpeg inside an infinite loop:

#!/bin/bash
while true; do
  ffmpeg -i file.mp4 ... rtmp://localhost/stream
done

Answered by Renato Romano on October 9, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP