linux - omxplayer (raspbian) 在随机播放循环中播放视频文件夹

标签 linux random shuffle omxplayer

我找不到在 shell 脚本中使用 omxplayer 以随机“随机播放”顺序播放文件夹中视频的方法。我希望它循环播放“播放列表”,但到目前为止,我只能找到一种方法来循环播放按字母顺序排列的所有文件夹。我将下面的代码版本用于循环。

#!/bin/sh

# get rid of the curso so we don't see it when videos are running
setterm -cursor off

# set here the path to the directory containing your videos
VIDEOPATH="/home/pi/Videos"

# you can normally leave this alone
SERVICE="omxplayer"

# now for our infinite loop!
while true; do
    if ps ax | grep -v grep | grep $SERVICE > /dev/null
    then
    sleep 1;
else
    for entry in $VIDEOPATH/*
    do
        clear
        omxplayer $entry > /dev/null
    done
fi
done

最佳答案

我最终以各种顺序组合了 Wondershare 中的视频。这对存储不友好,因为我基本上有多个视频副本,但我可以从几个命令中选择一个开始播放并将其设置为循环播放,这可以实现我的大部分目标。

循环代码(比上面的代码简单多了): omxplayer -o local --loop/home/pi/video.mp4

关于linux - omxplayer (raspbian) 在随机播放循环中播放视频文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45023727/

相关文章:

MySQL shell 将结果显示为类似 "less"的内容

algorithm - 从一组 N 中随机选择 n 条记录

java - 打乱数组 (Java)

algorithm - 如何使用 O(1) 辅助空间将数组置换为给定顺序?

linux - 获取/bin/sh 的权限以在生产中启动 Go 服务器 | docker-compose

linux - 使用/proc/stat 准确计算 Linux 中的 CPU 利用率

linux - 在同一个 shell (bash) 中运行脚本

Java 线程 Random.nextLong() 返回相同的数字

C++从随机函数中删除元素