Skip to content

Edgenesis/gstreamer-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shifu GStreamer Demo

Requirements

  1. A Linux distribution capable of installing K3s

    • View K3s' hardware and software requirements here
  2. GStreamer installed on your client

Steps

Setup K3s Cluster

Installation

On your Linux machine, install K3s using the following command:

curl -sfL https://get.k3s.io | sh -

If the cluster is running, you should see the following output after running:

sudo k3s kubectl get po -A

kubectl output

Troubleshooting

If you encounter issues with K3s not booting up on Ubuntu 21.10 to Ubuntu 23.10 running on ARM:

  1. Check the logs:

    journalctl -xe -u k3s
  2. If the error is related to VXLAN, try installing the following package:

    sudo apt install linux-modules-extra-raspi

Additional Information

For more details on installation requirements, particularly for Raspberry Pi, refer to the K3s official documentation.

Install Shifu and Shifu-related Services

Install Shifu and TelemetryService

sudo k3s kubectl apply -f https://raw.githubusercontent.com/Edgenesis/shifu/v0.53.0/pkg/k8s/crd/install/shifu_install.yml
sudo k3s kubectl apply -f https://raw.githubusercontent.com/Edgenesis/shifu/v0.53.0/pkg/telemetryservice/install/telemetryservice_install.yaml

The following services should be running as shown below: Shifu and TelemetryService

Use GStreamer to Stream Video from an IP Camera

Update TCP deviceShifu Configuration

Update the camera/camera_edgedevice.yaml file's spec.address with the correct RTSP URL (e.g., "192.168.10.20").

Deploy TCP deviceShifu

sudo k3s kubectl apply -f camera/

deviceShifu should be running as shown below: deviceShifuTCP

Port Forward the Service

To access the camera stream from outside the cluster:

sudo k3s kubectl port-forward -n deviceshifu svc/deviceshifu-camera 30080: --address=0.0.0.0

Access the Camera Stream with GStreamer

From your client, issue the following command (replace placeholders with your RTSP username, password, and server IP address):

gst-launch-1.0 rtspsrc location="rtsp://{RTSP_USERNAME}:{RTSP_PASSWORD}@{SERVER_IP_ADDRESS}:30080" \
    protocols=tcp \
    retry=5 \
    latency=2000 \
    timeout=60000000 \
    ! rtph265depay ! h265parse ! avdec_h265 \
    ! videoconvert ! autovideosink

Sample output from an IP camera stream: GStreamer Output

Siemens PLC deviceShifu

Update Siemens PLC deviceShifu Configuration

In the plc/deployment.yaml file, update:

  • spec.template.spec.containers[1].env's PLC_ADDRESS with the correct PLC IP address
  • PLC_PORT with the correct PLC port

Deploy Siemens PLC deviceShifu

sudo k3s kubectl apply -f plc/

deviceShifu should be running as shown below: deviceShifuPLC

Deploy Ingress for the Siemens PLC deviceShifu

sudo k3s kubectl apply -f ingress/ingress-plc.yaml

Control the Siemens PLC deviceShifu

Use curl to control the Siemens PLC deviceShifu. For example, to change the output of Q0.1 and Q0.2 to 1 and 0:

curl "localhost/api/sendsinglebit?rootaddress=Q&address=0&start=0&digit=1&value=1"; echo
curl "localhost/api/sendsinglebit?rootaddress=Q&address=0&start=0&digit=1&value=0"; echo
curl "localhost/api/sendsinglebit?rootaddress=Q&address=0&start=0&digit=2&value=1"; echo
curl "localhost/api/sendsinglebit?rootaddress=Q&address=0&start=0&digit=2&value=0"; echo

Push Data from the Siemens PLC to an MQTT Broker

Deploy MQTT Broker and TelemetryService for the Siemens PLC deviceShifu

sudo k3s kubectl apply -f https://raw.githubusercontent.com/Edgenesis/shifu/main/examples/mqttDeviceShifu/mqtt_broker/mosquitto.yaml
sudo k3s kubectl apply -f telemetryservice/telemetryserivce-plc.yaml

Subscribe to the MQTT Broker

To view the data:

sudo k3s kubectl exec -it -n devices deploy/mosquitto -- mosquitto_sub -t '/siemens/s7'

Sample output from the MQTT Broker: Mosquitto Output

Shifu Cloud

Deploy Camera deviceShifu from Shifu Cloud

Follow the instructions in the Shifu Cloud documentation to deploy the camera deviceShifu.

Contact

For any questions or issues, please contact the Shifu team at [email protected].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published