【问题标题】:Raspberry Pi: Playing multiple video files in mkfifo pipeRaspberry Pi:在 mkfifo 管道中播放多个视频文件
【发布时间】:2017-01-19 02:18:45
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: linux ffmpeg raspberry-pi raspbian omxplayer


    【解决方案1】:

    您在后台运行两只猫,这意味着数据将以随机方式交错,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中的第一个文件
    猜你喜欢
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-27
    • 2019-03-06
    • 1970-01-01
    相关资源
    最近更新 更多