/media/blah/
I'm trying to loop through them randomly in bash. Right now I have it choosing a random video each time one finishes:
Code: Select all
while true
do
files=(/media/blah/*.mkv)
omxplayer -o hdmi "${files[RANDOM % ${#files[@]}]}"
doneWhat I'd rather have is a list of all the videos in random order, play the whole list once, then shuffle the list again. That way there is a much smaller chance of seeing a video twice in a relatively short period of time.
Code: Select all
#play.sh
ls /media/blah/ | sort -R > /home/pi/playlist
for ((c=1; c<=172; c++))
do
read line
omxplayer -o hdmi /media/blah/"$line"
done < /home/pi/playlistI'm looping through 170 or so videos, not programming a mars rover.
Anyway, the loop works except for this:
Code: Select all
pi@raspberrypi ~ $ ./play.sh
file : /media/blah/1.mkv result 0 format matroska,webm audio streams 1 video streams 1 chapters 0 subtitle s 0 length 1302
Video codec omx-h264 width 1280 height 720 profile 100 fps 23.976025
Audio codec ac3 channels 8 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
/usr/bin/omxplayer: line 12: 2605 Segmentation fault LD_LIBRARY_PATH=$OMXPLAYER_LIBS:$LD_LIBRARY_PATH $OMXPLAYER_BIN "$@"