Executing a command line argument at startup
-
Hello All, we are needing to start a video service to broadcast output from a UVC camera to QGroundcontrol. I was successful streaming with ffmpeg, would like to ultimately use the UVC streaming application to stream over rtsp, but had some trouble getting it functioning, and the deprecated streaming video application did not successfully display a stream (a client connecting would connect/disconnect repeatedly with no video output messages on the VOXL), so I have fallen back on ffmpeg for now. I am familiar with a few options for executing a command at startup like the ffmpeg command, however not for Yocto linux. I wrote a script, placed it in /etc/rc.d, changed the permissions to be executable, and executed "update rc.d myscript.sh defaults" but it doesn't appear to be running upon reboot. I have not yet tried adding an "echo" line in to give me some feedback about what is happening but is this basically the right approach to getting an ffmpeg command to stream uvc video going at startup? Is there a better way? My script is below:
#!/bin/bash -e # #Author: C. A. Simpkins Ph.D. # #Date: June 5 2022 # #Description: This script simply executes a command at startup #to start the video streaming from the camera # # # # #this is the command with its options. Change the ip address to be that of the ground station ffmpeg -i /dev/video2 -f x265 -s:v 640x480 -b 1M -f mpegts -r 15 -aspect 16:9 -muxdelay 0.01 -vf "transpose=2,transpose=2,format=yuv420p" udp://192.168.1.11:4242 #upon success exit exit 0
-
@RDPRobotics The simplest way to do this is with
systemd
service file.To see some examples on VOXL, checkout the
/etc/systemd/system
directory.You can create a new
SERVICE_NAME.service
file there and enable it to run on bootup withsystemctl enable SERVICE_NAME
Here's an example of how
voxl-modem
uses systemd: https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-modem/-/blob/master/services/voxl-modem.service -
Here are some relevant documents:
https://docs.modalai.com/voxl-uvc-server/
https://docs.modalai.com/voxl-streamer/ -
Thank you. I could not get video from the uvc device over voxl-streamer, though I could access the test video and the stereo cameras/anything plugged into the MIPI ports. I've had a problem with the newer UVC-server program. I need to check my notes it was a few weeks ago but somehow it wasn't working so I fell back on the ffmpeg due to time limits with the intent of going back to the UVC server application as it's a better solution. I will post a specific issue after looking it over again.