run gstreamer app on powerup

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

run gstreamer app on powerup

Jump to solution
2,292 Views
davidvescovi
Contributor V

I have a simple gstreamer C++ application called "preview.out" that displays a camera preview on HDMI display.

This application works just fine when I log in as root and launch it by doing ./preview.out.

I would like to launch this same app on power up (without manually logging in as root).

I have a service installed that calls "launchapp.sh" on power up and I have:

 #!/bin/bash
cd /home/root
./preview.out

This does seem to launch the app but nothing shows on the display.

I suspect it has something to do with users privileges or something.

if I do:

root@imx8mm:~# journalctl -u startup.service --no-pager

-- Logs begin at Fri 2020-01-17 21:05:48 UTC, end at Sun 2020-02-23 12:19:39 UT>
Feb 23 12:16:00 imx8mm systemd[1]: Started start preview application.
Feb 23 12:16:01 imx8mm bash[3340]: error: XDG_RUNTIME_DIR not set in the environment.
Feb 23 12:16:01 imx8mm bash[3340]: Unable to set the source pipeline to the playing state.

I changed the launchapp.sh adding:

export XDG_RUNTIME_DIR=/home/root

Which got rid of the XDG error but I still get the "...pipeline to the playing state" error.

I use V4L2 as the source in the pipeline.

How can I launch so display shows on the monitor?

0 Kudos
1 Solution
1,985 Views
karangajjar
Senior Contributor II

Hi  David Vescovi 

Please change the path for XDG_RUNTIME_DIR to export XDG_RUNTIME_DIR=/run/user/0/ and

after that add the User=root in your .service file under [Service] section.

Let us know in case of any concerns.

Regards,

Karan Gajjar

View solution in original post

2 Replies
1,986 Views
karangajjar
Senior Contributor II

Hi  David Vescovi 

Please change the path for XDG_RUNTIME_DIR to export XDG_RUNTIME_DIR=/run/user/0/ and

after that add the User=root in your .service file under [Service] section.

Let us know in case of any concerns.

Regards,

Karan Gajjar

1,985 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello David Vescovi,

One alternative would be adding a script that launches the app on the init.d file inside /etc/init.d

I hope this helps!
Regards,

0 Kudos