WebRTC frame streaming#

DL Streamer Pipeline Server supports streaming the frames on WebRTC protocol using mediamtx media server. There is a dedicated docker compose file for demonstrating WebRTC streaming for DL Streamer Pipeline Server. It is available in DL Streamer Pipeline Server’s github repository, under the “docker” folder i.e., [WORKDIR]/docker/docker-compose-mediamtx.yml Below are the necessary configuration to be aware of (or modify accordingly based on your deployment) in [WORKDIR]/docker/.env (They will be consumed appropriately in [WORKDIR]/docker/docker-compose-mediamtx.yml):

WHIP_SERVER_IP=<HOST_IP> # It should be the IP address of the machine on which open mediamtx container is running.
WHIP_SERVER_PORT=8889 # It is the port which is configured for mediamtx server. Default port is 8889.

After setting all the above information, we can start the WebRTC streaming:

  • Start the services

        docker compose -f docker-compose-mediamtx.yml up
    
  • Open another terminal and start a pipeline in DL Streamer Pipeline Server with the below curl command.

        curl http://localhost:8080/pipelines/user_defined_pipelines/pallet_defect_detection -X POST -H 'Content-Type: application/json' -d '{
        "source": {
            "uri": "file:///home/pipeline-server/resources/videos/warehouse.avi",
            "type": "uri"
        },
        "destination": {
            "metadata": {
                "type": "file",
                "path": "/tmp/results.jsonl",
                "format": "json-lines"
            },
            "frame": {
                "type": "webrtc",
                "peer-id": "pallet-defect-detection"
            }
        },
        "parameters": {
            "detection-properties": {
                "model": "/home/pipeline-server/resources/models/geti/pallet_defect_detection/deployment/Detection/model/model.xml",
                "device": "CPU"
            }
        }
    }'
    
  • Open http://<HOST_IP>:8889/<peer-id> in your browser to view the WebRTC stream: Stream output on browser using WebRTC