LINUX屏幕命令 - 同一屏幕中的两个视频

时间:2014-02-12 16:18:37

标签: unix raspberry-pi gnu-screen

我遇到过同样的问题:我需要在同一个屏幕上显示2个视频(来自unix中的命令行)。

在网上找到一个教程(http://t3chadd1ct.wordpress.com/2013/04/19/omxplayer/),解决了我的问题...使用“screen命令”

  

[...]这可以通过使用屏幕功能轻松解决。该   下面的示例说明了如何创建2×2矩阵[...]

screen
> -dmS camera1 sh -c 'omxplayer --win "0 0 960 540" rtsp://ip_address/live; exec bash' screen -dmS camera2 sh -c
> 'omxplayer --win "960 0 1920 540" rtsp://ip_address/live; exec bash'
> screen -dmS camera3 sh -c 'omxplayer --win "0 540 960 1080"
> rtsp://ip_address/live; exec bash' screen -dmS camera4 sh -c
> 'omxplayer --win "960 540 1920 1080" rtsp://ip_address/live; exec
> bash'

我已按照本教程操作,但无法正常工作:我的脚本只执行一个视频(第一个是“camera2”):

more tmp01.sh 
#!/bin/sh

#1)this work:
#nohup omxplayer --win "0 0 1440 800" ../Shared/NO_LOGO_1/01.avi &
#nohup omxplayer --win "0 801 1440 900" ../Shared/NO_LOGO_1/02.avi &

#2)doesn't work
screen -dmS camera2 sh -c `omxplayer --win "0 0 200 200" /home/pi/Shared/NO_LOGO
_1/02_a.avi; exec bash`

screen -dmS camera1 sh -c `omxplayer --win "200 200 600 600" /home/pi/Shared/NO_
LOGO_1/01_a.avi; exec bash`

我哪里错了? 非常感谢你!

1 个答案:

答案 0 :(得分:1)

您使用了错误的报价。使用'代替反引号(`)。您使用它的方式,screen命令不会终止,直到omxplayer的输出完成(即直到该终止。

screen -dmS camera2 sh -c 'omxplayer --win "0 0 200 200" /home/pi/Shared/NO_LOGO_1/02_a.avi; exec bash'

而不是

screen -dmS camera2 sh -c `omxplayer --win "0 0 200 200" /home/pi/Shared/NO_LOGO_1/02_a.avi; exec bash`

看到区别?