[FFmpeg-user] Infinite loop randomized stream to rtmp server

Manuel Celli 88lloyd88 at gmail.com
Sat May 26 21:42:43 EEST 2018


Dear All,

As the subject implies, i have troubles to make a running ffmpeg command
that can do the following:

-Infinite "loop" (must stream undefinetly without breaks between videos)
-Randomized (must reproduce videos in a random order)

After much searching in the web, i came to this:

ffmpeg -y -re -stream_loop -1 -i item1.mp4 -async 1 -vsync 1 -c:a aac
-filter:a loudnorm=I=-23:LRA=1:dual_mono=true:tp=-1 -f flv -ar 44100 -c:v
copy -preset fast -keyint_min 25 "rtmp://live.my.stream"

that correctly streams the video but it breaks on repetition, so it's a no
go.

I tried to remove -stream_loop -1 and implement concat that uses File1.txt
and File2.txt which contain:

File1.txt

file 'item1.mp4'
file 'File2.txt'

and then File2.txt

File2.txt

file 'item2.mp4'
file 'File1.txt'

to simulate an infinite loop and use linux symbolic links to make item1 and
item2 point to different files, with the following command:

ffmpeg -y -re -f concat -i File1.txt -async 1 -vsync 1 -c:a aac -filter:a
loudnorm=I=-23:LRA=1:dual_mono=true:tp=-1 -f flv -ar 44100 -c:v copy
-preset fast -keyint_min 25 "rtmp://live.my.stream"

it correctly streams the first file but it breaks when it tries to open the
second file (link to the file File2.txt) with the following output:

[concat @ 0x55be73c15aa0] DTS 2248 < 8085000 out of order
[flv @ 0x55be73cf4300] Non-monotonous DTS in output stream 0:0; previous:
89833, current: 25; changing to 89833. This may result in incorrect
timestamps in the output file.
Error while filtering: Illegal seek
[flv @ 0x55be73cf4300] Failed to update header with correct duration.
[flv @ 0x55be73cf4300] Failed to update header with correct filesize.

So i'm actually out of options to do infinite stream of random mp4 files, i
really need a hand since i'm new to ffmpeg but i really like it!

Regards


More information about the ffmpeg-user mailing list