我正在Google Coral开发板上使用gstreamer,并在其上执行视频分析。该平台的详细信息是:
Linux无聊的马4.9.51-imx#1 SMP PREEMPT周二5月14日20:34:37 UTC 2019 aarch64 GNU / Linux
我具有以下形式的管道:
GST_DEBUG=*gl*:5 gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,framerate=15/1 ! queue max-size-buffers=1 leaky=downstream ! glupload ! queue max-size-buffers=1 leaky=downstream ! glfilterbin filter=glcolorscale ! video/x-raw,format=RGBA,width=320,height=180 ! videoconvert ! video/x-raw,format=RGB,width=320,height=180 ! appsink name=appsink sync=false emit-signals=true max-buffers=1 drop=true
从终端运行时效果很好。但是,当我将管道作为后台service执行时,它失败了,因为后台服务无权访问显示。无论如何,我都不想显示窗口,我只想将数据连接到appsink,以便可以对其执行视频分析。
所以任何人都知道如何强制其不使用显示,而只是将数据转发到appsink。请帮助
我相信您已经就相同的查询与我们联系,并且已经答复,但是这里是服务文件,其他人可以参考:
[Unit]
Description=Back service
After=weston.target
[Service]
ExecStart=/home/mendel/service_script.sh
Environment=XDG_RUNTIME_DIR=/run/user/1000
[Install]
WantedBy=multi-user.target
问题,我相信您需要设置XDG_RUNTIME_DIR
env变量。
这对我有用:
mendel@bored-quill:~$ sudo systemctl status back
● back.service - Back service
Loaded: loaded (/lib/systemd/system/back.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2020-03-05 14:48:57 UTC; 6h ago
Main PID: 13522 (service_script.)
Tasks: 10 (limit: 797)
Memory: 19.2M
CGroup: /system.slice/back.service
├─13522 /bin/bash /home/mendel/service_script.sh
└─13523 gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,framerate=15/1 ! queue max-size-buffers=1 leaky=downstream ! glupload ! queue max-size-buffers=1 leaky=downstream ! glfilterbin f
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.284750061 13523 0xaaaad4400a30 DEBUG gleglimage gsteglimage.c:431:_drm_direct_fourcc_from_info: Getting DRM fourcc for RGBA
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.284849062 13523 0xaaaad4400a30 DEBUG gleglimage gsteglimage.c:661:gst_egl_image_from_dmabuf_singleplaner: fourcc AB24 (875708993) n_plane
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.285265825 13523 0xffff900040f0 DEBUG glbasememory gstglbasememory.c:178:gst_gl_base_memory_init: new GL buffer memory:0xffff8035dcc0 size:1
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.285372385 13523 0xffff900040f0 DEBUG glbasetexture gstglmemory.c:340:gst_gl_memory_init: new GL texture context:<glcontextegl0> memory:0xfff
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.285269905 13523 0xaaaad442b630 DEBUG gldownloadelement gstgldownloadelement.c:419:gst_gl_download_element_prepare_output_buffer:<gldownloadeleme
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.286813716 13523 0xffff900040f0 DEBUG gldebug gstgldebug.c:320:_gst_gl_debug_callback:<glcontextegl0> low: GL debug marker from third p
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.286898196 13523 0xffff900040f0 DEBUG glfilter gstglfilter.c:981:gst_gl_filter_filter_texture: calling filter_texture with textures in:2
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.287709642 13523 0xaaaad4400a30 DEBUG gleglimage gsteglimage.c:431:_drm_direct_fourcc_from_info: Getting DRM fourcc for RGBA
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.287806243 13523 0xaaaad4400a30 DEBUG gleglimage gsteglimage.c:661:gst_egl_image_from_dmabuf_singleplaner: fourcc AB24 (875708993) n_plane
Mar 05 21:43:02 bored-quill service_script.sh[13522]: 6:54:05.288226006 13523 0xffff900040f0 DEBUG glbasememory gstglbasememory.c:178:gst_gl_base_memory_init: new GL buffer memory:0xffff8035dcc0 size:1