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

DopeLabs dopelabs at dubstep.fm
Sun May 27 08:52:00 EEST 2018


unfortunately, i still dont think there is way to 'loop' a video... or a playlist of videos. it will work with images using -loop 1.

you were pretty close using contcat.

you may wish to try something along the lines of:

> File1.txt
> 
> file 'item1.mp4'

> file 'item2.mp4'
> file 'item3.mp4'
> file 'item4.mp4'
> file 'item5.mp4'
> file 'item6.mp4'
> file 'item7.mp4'
> file 'item8.mp4'
> file 'item9.mp4'
> file 'item10.mp4'


then if youd like to make it random you can

$ cat File1.txt | shuf > RandFiles.txt

also be aware that its generally a good idea to make sure when using concat to have all the input files be encoded/formatted using the same codec/rates/frame sizes/etc.


i am using wowza and found a nifty little add-on called 'loop until live' which when used in combo with a small script i wrote to run ffmpeg in a while loop, grabbing a new random file each iteration, allows for uninterrupted playback.

you can msg me directly if you would like further info about this as its beyond the scope of this mailing list.

cheers


> On May 26, 2018, at 11:42 43AM, Manuel Celli <88lloyd88 at gmail.com> wrote:
> 
> 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
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list