Skip to content

the application to record the rtsp stream into file

Notifications You must be signed in to change notification settings

Edgenesis/RTSPApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RTSPApplication

the application to record the rtsp stream into file

Setup the cluster

Install the kind, and create a cluster:

kind create cluster

Set up the rbac:

kubectl apply -f ./example/pre

Build and load the image

make load

Deploy the RTSPApplication

kubectl apply -f ./example/deploy

Test it

Simple Unit Test

make test

e2e test

  1. create a mock rtsp server, a ffmpeg service that sends the rtsp stream forever and a curl client

    kubectl apply -f ./example/mocktest/client.yaml
    kubectl apply -f ./example/mocktest/rtsp-server.yaml 
    kubectl apply -f ./example/mocktest/ffmpeg.yaml
  2. create a secret store the username and password of the rtsp server

    kubectl create secret generic test-secret --from-literal=username=admin --from-literal=password=password -n shifu-app
  3. send request inside the curl container

    kubectl exec curl -it -n shifu-app -- /bin/bash

    For exmaple:

    curl --header "Content-Type: application/json" \
    --request POST --data '{"deviceName":"xyz", "secretName": "test-secret", "serverAddress":"rtsp-server.shifu-app.svc.cluster.local:8554/mystream", "record":true}' \
    rtsp-record.shifu-app.svc.cluster.local/register
    sleep 5s
    curl --header "Content-Type: application/json" \
    --request POST --data '{"deviceName":"xyz", "record":false}' \
    rtsp-record.shifu-app.svc.cluster.local/update
    sleep 1s
    curl --header "Content-Type: application/json" \
    --request POST --data '{"deviceName":"xyz", "record":true}' \
    rtsp-record.shifu-app.svc.cluster.local/update
    sleep 5s
    curl --header "Content-Type: application/json" \
    --request POST --data '{"deviceName":"xyz"}' \
    rtsp-record.shifu-app.svc.cluster.local/unregister

Export the videos

Video is named {device_name}_{clip_number}_{YYYY-MM-DD_hh-mm-ss}.mp4. Use kubect cp to export the video.

POD=$(kubectl get pod -l app=rtsp-record-deployment -n shifu-app -o jsonpath="{.items[0].metadata.name}")
# list all videos
kubectl exec ${POD} -n shifu-app -- ls /data/video -hl
# export the video you want
kubectl cp shifu-app/$POD:/data/video/xyz_0_2023-01-19_08-14-35.mp4 ./video_save_name.mp4

Uninstall

kubectl delete -f ./example/pre

About

the application to record the rtsp stream into file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published