gpt4 book ai didi

linux - 树莓派 : Playing multiple video files in mkfifo pipe

转载 作者:太空宇宙 更新时间:2023-11-04 12:36:09 30 4
gpt4 key购买 nike

我有 2 个文件,test.mp4 和 test2.mp4,我想同时播放,中间没有明显的中断。目前我正在使用

mkfifo test
cat test.mp4 > test &
cat test2.mp4 > test &
omxplayer test

但是,当我这样做时,omxplayer 只返回数据而不播放文件。但是,如果我只是将一个文件放入管道,omxplayer 会正常显示它。我也试过在 ffmpeg 中使用复制命令,它也只返回数据,不播放文件。

我知道我可以将 2 个文件连接在一起,但这对我的目的不起作用,因为我需要能够在 omxplayer 运行时将文件馈送到管道

最佳答案

你在后台运行两只猫,这意味着数据将以随机方式交错,omxplayer 不太可能理解它。

你的脚本应该是:

mkfifo test
cat test.mp4 test2.mp4 > test &
omxplayer test

但是,即使这样也不能满足您的需求,因为一旦 cat 完成,omxplayer 就会认为输入结束并停止。

你需要这样的东西:

sendvideo() {
#
# Code to select file to send
#
cat test.mp4
#
# Code to select file to send
#
cat test2.mp4
#
# Loop to select files
#
while [ some condition ]; do
cat somefile
done
}
# Starts here
mkfifo test
sendvideo > test &
omxplayer test

关于linux - 树莓派 : Playing multiple video files in mkfifo pipe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41732673/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com