Gstreamer 错误:环境中未设置 XDG_RUNTIME_DIR

Gstreamer 错误:环境中未设置 XDG_RUNTIME_DIR

我在 Windows 10 PC 上使用 Ubuntu 18.04 LTS,并启用了 Windows Subsystem for Linux,以便可以在 PC 上运行 Linux。然后我尝试使用 Gstreamer-1.0。

运行该线路时:

gst-launch-1.0  videotestsrc ! autovideoconvert ! autovideosink 

我收到错误:

error: XDG_RUNTIME_DIR not set in the environment.

然后它就什么都不做了。我该怎么做才能解决这个问题?

有关更多信息,这里是完整的“代码”:

gst-launch-1.0  videotestsrc ! autovideoconvert ! autovideosink
Setting pipeline to PAUSED ...
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstXvImageSink:autovideosink0-actual-sink-xvimage:
Could not open display (null)
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:05.400472100
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

答案1

解决方案来自这个答案为我工作

为了简单起见 - 更多地解释我的系统的新启动。

经过所有的解释后,我得到了结果 - 并且终端中的“env”已经表明这对于这些会话来说是正确的:

这两行使用环境变量:

对于我选择的 tmp 行为:

mkdir -pv ~/.cache/xdgr

设置环境变量:

export XDG_RUNTIME_DIR=$PATH:~/.cache/xdgr

关闭终端并重新打开环境后,它们会告诉:

XDG_RUNTIME_DIR=/run/user/1001

相关内容