diff --git a/scripts/gstreamer/gstreamer.service b/scripts/gstreamer/gstreamer.service index b3e6bbb..3b3c022 100644 --- a/scripts/gstreamer/gstreamer.service +++ b/scripts/gstreamer/gstreamer.service @@ -1,6 +1,6 @@ [Unit] Description=GStreamer Service -After=network.target +After=network.target parallel.service [Service] WorkingDirectory=/home/ubuntu/Selk-Companion-Computer diff --git a/scripts/gstreamer/install_parallel.sh b/scripts/gstreamer/install_parallel.sh new file mode 100644 index 0000000..a1226e2 --- /dev/null +++ b/scripts/gstreamer/install_parallel.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash + +sudo apt install parallel + +#unit file +sudo cp parallel.service /etc/systemd/system/ + +sudo systemctl daemon-reload +sudo systemctl enable parallel +sudo systemctl start parallel \ No newline at end of file diff --git a/scripts/gstreamer/parallel.service b/scripts/gstreamer/parallel.service new file mode 100644 index 0000000..2c5c3cf --- /dev/null +++ b/scripts/gstreamer/parallel.service @@ -0,0 +1,12 @@ +[Unit] +Description=GStreamer Service +After=network.target + +[Service] +WorkingDirectory=/home/ubuntu/Selk-Companion-Computer +Restart=on-failure +ExecStart=/bin/true +User=pi + +[Install] +WantedBy=multi-user.target diff --git a/scripts/gstreamer/start_gstreamer.sh b/scripts/gstreamer/start_gstreamer.sh index b8e133e..5ca6e2e 100644 --- a/scripts/gstreamer/start_gstreamer.sh +++ b/scripts/gstreamer/start_gstreamer.sh @@ -1,5 +1,10 @@ #!/usr/bin/bash -gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-h264, width=1920,height=1080! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.255 port=5600 sync=false -gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-h264, width=1920,height=1080! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.255 port=5601 sync=false -gst-launch-1.0 -v v4l2src device=/dev/video2 ! video/x-h264, width=1920,height=1080! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.255 port=5602 sync=false +commands=( + "gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-h264, width=1920, height=1080 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.255 port=5601 sync=false" + "gst-launch-1.0 -v v4l2src device=/dev/video2 ! video/x-h264, width=1920, height=1080 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.255 port=5602 sync=false" + "gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-h264, width=1920, height=1080 ! h264parse ! queue ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.255 port=5600 sync=false" +) + +#will print output in terminal +parallel -j3 --line-buffer --tag ::: "${commands[@]}"