AnswerBun.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!

Related Questions

Cifs mounting subdirectories from linux

1  Asked on December 24, 2021 by s-olesen

     

System bootorder not found

1  Asked on December 24, 2021 by ronin-zeroo

         

Yocto recipe for systemd USER service

2  Asked on December 24, 2021 by nellorocca

   

source .pam_environment file

0  Asked on December 24, 2021 by subbeh

   

No such file or directory /etc/init.d/functions

6  Asked on December 22, 2021 by tecman

 

dd script with timings

1  Asked on December 22, 2021 by lmind

       

Qt: XKEYBOARD extension not present on the X Server

1  Asked on December 22, 2021 by pitosalas

   

Execute zsh alias when name contains a hyphen

2  Asked on December 22, 2021

   

Kali Error while installing any package

3  Asked on December 22, 2021 by parampreet-rai

       

Is there a awk command for searching if a user is logged on?

2  Asked on December 22, 2021 by darunia

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir