Andy
Andy

Reputation: 613

cronjob to play files in a folder with ffmpeg causes delay between songs. how to avoid?

I have a cron set up to check for a specific stream and if its not playing(usually means that file is over) it will randomly select other file.

The command: /root/bin/ffmpeg -re -i $(ls /usr/btv/btvconcerts/*.mp4 | shuf -n 1) -vcodec copy -preset superfast -acodec copy -ar 44100 -ab 32k -f flv OUTPUT

The problem I have is that the cron is running every 1 minute and so there could be a delay between the streaming files for up to 1 min + the time it launches etc

Is there a command i could use just to constantly loop through the files without crontab?

Upvotes: 0

Views: 254

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798676

In sh/bash/dash/ash/zsh/etc.:

while true
do
   ...
done

Upvotes: 2

Related Questions