Make ffmpeg loop video indefinitely while streaming

13,667

Try

ffmpeg -stream_loop -1 -i input {-rest of your parameters} -f flv rtmp://output
Share:
13,667

Related videos on Youtube

user419541
Author by

user419541

Updated on September 18, 2022

Comments

  • user419541
    user419541 over 1 year

    Is it possible to make ffmpeg loop an input file infinite times copying its video and audio and streaming it to a RTMP server (nginx with rtmp module).

    I am trying to create an animated video which repeats on the RTMP server for as long as the ffmpeg instance is running.

    I have found the concat demuxer, but all examples I've found is using a playlist to concat the same video over and over into a single video. While I could create a stupidly long video that no sane user would watch in its entirety, it would consume a lot of disk space and wouldn't make sense to do in the least.

    I could also add a while true bash loop to restart the process, but this may introduce delays or disconnects into the stream.

    I am simply trying to find a way to take a single video and restream it once it ends without delays/interruptions in the stream.

    Any help would be great.

    Thanks.