<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックStarting GStreamer with systemd.</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Starting-GStreamer-with-systemd/m-p/1864953#M223679</link>
    <description>&lt;P&gt;&lt;SPAN&gt;There is an issue starting GStreamer with systemd.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Entering the following command produces an error message and the video doesn't appear.&lt;/P&gt;&lt;P&gt;Help me find a solution.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT size="2"&gt;root@imx8mpevk:~# systemctl start myservice&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;root@imx8mpevk:~# systemctl status myservice&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;* myservice.service - test service&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Loaded: loaded (/etc/systemd/system/myservice.service; disabled; preset: disabled)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Active: active (running) since Tue 2024-05-14 02:12:25 UTC; 7s ago&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Main PID: 834 (myservice.sh)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Tasks: 2 (limit: 5574)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Memory: 5.1M&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;CGroup: /system.slice/myservice.service&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;|-834 /bin/bash /home/root/myservice.sh&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;`-841 sleep 10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk systemd[1]: Started test service.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[834]: gst start!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Setting pipeline to PAUSED ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Failed to set pipeline to PAUSED.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Setting pipeline to NULL ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Freeing pipeline ...&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The same shell script works fine when executed in the console, I can see the video.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;root@imx8mpevk:~# ./myservice.sh&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;gst start!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Setting pipeline to PAUSED ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Pipeline is live and does not need PREROLL ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Pipeline is PREROLLED ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Setting pipeline to PLAYING ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;New clock: GstSystemClock&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[ 1033.191967] bypass csc&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[ 1033.194381] input fmt YUV4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[ 1033.197096] output fmt YUYV&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Redistribute latency...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;0:00:00.8 / 99:99:99.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Here is my "myservice.service" and "myservice.sh" file.&lt;/P&gt;&lt;P&gt;myservice.service&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[Unit]
Description=GStreamer
After=multi-user.target

[Service]
Type=simple
User=root
ExecStart=/home/root/myservice.sh
RemainAfterExit=yes
GuessMainPID=no&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myservice.sh&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

export XDG_RUNTIME_DIR=/run/user/0/
echo gst start!!
gst-launch-1.0 v4l2src device=/dev/video2 ! waylandsink
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 05:37:33 GMT</pubDate>
    <dc:creator>Patrick-Kim</dc:creator>
    <dc:date>2024-05-14T05:37:33Z</dc:date>
    <item>
      <title>Starting GStreamer with systemd.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Starting-GStreamer-with-systemd/m-p/1864953#M223679</link>
      <description>&lt;P&gt;&lt;SPAN&gt;There is an issue starting GStreamer with systemd.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Entering the following command produces an error message and the video doesn't appear.&lt;/P&gt;&lt;P&gt;Help me find a solution.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT size="2"&gt;root@imx8mpevk:~# systemctl start myservice&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;root@imx8mpevk:~# systemctl status myservice&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;* myservice.service - test service&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Loaded: loaded (/etc/systemd/system/myservice.service; disabled; preset: disabled)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Active: active (running) since Tue 2024-05-14 02:12:25 UTC; 7s ago&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Main PID: 834 (myservice.sh)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Tasks: 2 (limit: 5574)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Memory: 5.1M&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;CGroup: /system.slice/myservice.service&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;|-834 /bin/bash /home/root/myservice.sh&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;`-841 sleep 10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk systemd[1]: Started test service.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[834]: gst start!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Setting pipeline to PAUSED ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Failed to set pipeline to PAUSED.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Setting pipeline to NULL ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;May 14 02:12:25 imx8mpevk myservice.sh[835]: Freeing pipeline ...&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The same shell script works fine when executed in the console, I can see the video.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;root@imx8mpevk:~# ./myservice.sh&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;gst start!!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Setting pipeline to PAUSED ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Pipeline is live and does not need PREROLL ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Pipeline is PREROLLED ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Setting pipeline to PLAYING ...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;New clock: GstSystemClock&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[ 1033.191967] bypass csc&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[ 1033.194381] input fmt YUV4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;[ 1033.197096] output fmt YUYV&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Redistribute latency...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;0:00:00.8 / 99:99:99.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Here is my "myservice.service" and "myservice.sh" file.&lt;/P&gt;&lt;P&gt;myservice.service&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[Unit]
Description=GStreamer
After=multi-user.target

[Service]
Type=simple
User=root
ExecStart=/home/root/myservice.sh
RemainAfterExit=yes
GuessMainPID=no&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myservice.sh&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

export XDG_RUNTIME_DIR=/run/user/0/
echo gst start!!
gst-launch-1.0 v4l2src device=/dev/video2 ! waylandsink
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 05:37:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Starting-GStreamer-with-systemd/m-p/1864953#M223679</guid>
      <dc:creator>Patrick-Kim</dc:creator>
      <dc:date>2024-05-14T05:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Starting GStreamer with systemd.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Starting-GStreamer-with-systemd/m-p/1877864#M224333</link>
      <description>&lt;P&gt;Although no one was interested, I found a solution on my own and have summarized it here.&lt;/P&gt;&lt;P&gt;myprogram.service&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;[Unit]&lt;BR /&gt;Description=My Last Service&lt;BR /&gt;After=weston.service&lt;/P&gt;&lt;P&gt;[Service]&lt;BR /&gt;User=root&lt;BR /&gt;Environment="WAYLAND_DISPLAY=/run/wayland-0"&lt;BR /&gt;Environment="XDG_RUNTIME_DIR=/run/user/$(id -u root)"&lt;BR /&gt;ExecStart=/home/root/run.sh&lt;BR /&gt;Restart=on-failure&lt;BR /&gt;StandardOutput=journal&lt;BR /&gt;StandardError=journal&lt;/P&gt;&lt;P&gt;[Install]&lt;BR /&gt;WantedBy=multi-user.target&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;run.sh&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;echo Start GST!!&lt;/P&gt;&lt;P&gt;gst-launch-1.0 v4l2src device=/dev/video2 ! waylandsink&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Register service&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;systemctl daemon-reload&lt;BR /&gt;systemctl enable myprogram.service&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This way, it works well for me. When I reboot, the camera screen comes up automatically.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 05:07:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Starting-GStreamer-with-systemd/m-p/1877864#M224333</guid>
      <dc:creator>Patrick-Kim</dc:creator>
      <dc:date>2024-05-30T05:07:47Z</dc:date>
    </item>
  </channel>
</rss>

