Linux Raspberry Pi:在mkfifo管道中播放多个视频文件 我有2个文件,Test.MP4和Test2.MP4,我想同时播放,中间没有明显的中断。目前我正在使用 mkfifo test cat test.mp4 > test & cat test2.mp4 > test & omxplayer test

Linux Raspberry Pi:在mkfifo管道中播放多个视频文件 我有2个文件,Test.MP4和Test2.MP4,我想同时播放,中间没有明显的中断。目前我正在使用 mkfifo test cat test.mp4 > test & cat test2.mp4 > test & omxplayer test,linux,ffmpeg,raspberry-pi,raspbian,omxplayer,Linux,Ffmpeg,Raspberry Pi,Raspbian,Omxplayer,但是,当我这样做时,omxplayer只返回数据,不播放文件。但如果我只是将单个文件放入管道中,omxplayer会正常显示它。我还尝试在ffmpeg中使用copy命令,它也只返回数据,不播放文件 我知道我可以将这两个文件连接在一起,但这不符合我的目的,因为我需要能够在omxplayer运行时将文件馈送到管道中您在后台运行两个CAT,这意味着数据将以随机方式交错,omxplayer不太可能理解它 您的脚本应该是: mkfifo test cat test.mp4 test2.mp4 > t

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


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

您在后台运行两个CAT,这意味着数据将以随机方式交错,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

这样做只会播放fifo中的第一个文件