从远程终端在 X11 中使用 VLC 播放视频 [英] Play a video with VLC in X11 from remote terminal

查看:47
本文介绍了从远程终端在 X11 中使用 VLC 播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,希望你能帮助我.我有一些带有 Linux 的超薄终端,每次启动时都会启动一个小脚本.此脚本有一个 cvlc 命令行,如下所示:

I've got a problem, I hope you can help me. I've got some slim terminals with Linux where a little script it's launched every time they boot. This script has a single cvlc command line which it's the following:

cvlc --quiet --fullscreen --no-osd --loop playlist.xspf

这工作正常,因为终端启动 X11 环境,然后它从自动启动启动脚本;它在 LCD 上播放和呈现的视频很好.我的问题出现在出于某种原因,我需要远程终止 cvlc 进程并重新启动它.我使用在 X11 环境中登录的同一用户 ssh 终端,启动上述代码行并播放视频,是的...但在终端中我已登录!

This works OK because the terminals start the X11 environment and then the script it's launched from autostart; the video it's played and rendered nicely y an LCD. My problem comes when for a reason or another, I need to kill the cvlc process remotely and start it again. I ssh the terminal with the same user logged in in the X11 environment, I launch the code line described above and the video plays, yes... but IN the terminal I'm logged in!

因此视频以仅字符模式播放,它在我的控制台中呈现为文本;当然在X11环境下什么都看不到.所以我的问题是:如何启动我的 cvlc 命令并在 X11 中播放视频而不是在控制台本身???

So the videos plays in only-characters mode, it's being rendered as text in my console; of course nothing can be seen in the X11 environment. So my question is: How can I launch my cvlc command AND play the video in X11 NOT in the console itself???

如果我只是尝试在没有选项的情况下播放它,我会得到以下输出:

If I just try to play it with no options, I got the following output:

$ cvlc playlist.xspf 
VLC media player 1.1.4 The Luggage (revision exported)
Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS")
Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE")
[0x9cb1114] inhibit interface error: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.

[0x9cb1114] main interface error: no suitable interface module
[0x9cb0754] main interface error: no suitable interface module
[0x9c17914] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x9caeca4] dummy interface: using the dummy interface module...
[0x9cabfa4] main playlist: stopping playback
[0x9dedb34] xcb_xv generic error: parent window not available
[0x9dedb34] xcb_x11 generic error: parent window not available
[0x9dedb34] xcb_glx generic error: parent window not available
[0x9dedb34] fb generic error: cannot get terminal mode (Invalid argument)
Blocked: call to signal(28, 0x60ae4e0)
Blocked: call to setlocale(6, "")
Blocked: call to sigaction(20, 0x46935e0, (nil))
Blocked: call to sigaction(2, 0xb730c948, (nil))
                                                                                            Blocked: call to sigaction(15, 0xb730c948, (nil))
Blocked: call to sigaction(28, 0xb730c948, (nil))
^C[0x9cae2b4] signals interface error: Caught Interrupt signal, exiting...
umboard@MB124205:~$ 

当然,问题是我无法从远程终端直接访问 X11,那么如何使用 cvlc 或 vlc 从远程控制台播放视频?

So the problem is, of course, I've got no direct access to X11 from my remote terminal, so how can I play a video from my remote console using cvlc or vlc?

请帮助我,非常感谢!!!

Please help me, THANKS A LOT!!!

推荐答案

$DISPLAY 环境变量保存可以运行图形应用程序的 X 服务器实例的值.因此需要这个值:

The $DISPLAY environmental variable holds the value of the X server instance where graphical apps can be run. Therefore this value it's needed:

echo $DISPLAY
:0

那么这个值必须与 cVLC --x11-display 选项一起使用,如下所示:

Then this value must be used with cVLC --x11-display option as in:

cvlc --x11-display :0 video.mp4

这样,即使在远程 ssh 会话中使用此命令,视频也会输出到 X 服务器会话.但是,如果会话结束,视频将停止,因此您需要将作业置于后台,因此当您注销时,视频会继续播放:

This way, the video will output to the X Server session even if this command it's used in a remote ssh session. However if the session it's finished, the video will stop, so you need to background the job, so when you logout, the video continues to play:

cvlc --x11-display :0 video.mp4 &

作为我的确切需求的参考,如果您需要在远程终端中运行视频并且需要循环播放,没有可见的 VLC 界面,全屏并且在控制台中绝对没有输出,那么您可能会发现它很有用,因为如果你像前面的例子一样运行命令,可能 VLC 输出会在同一个用户的另一个 SSH 会话中被抛出,你需要这样运行它:

As a reference of my exact needs that maybe you'll find useful, if you need to run the video in the remote terminal and you need it to loop, with no visible VLC interface, fullscreen and with absolute no output in console, because if you run the command as in the previous example, maybe VLC output will be thrown in another SSH session with the same user, you'll need to run it this way:

cvlc -q --no-osd -L -f --no-video-title-show --x11-display :1 video.mp4 2&>1 >/dev/null &

标准输出和错误不会以这种方式出现在会话中.

Standard output and error won't appear on the session this way.

这篇关于从远程终端在 X11 中使用 VLC 播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆