Skip to content

Commit bfe2347

Browse files
committed
Revoke rtsp example
1 parent ec1e10d commit bfe2347

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

guides/useful_concepts/running_membrane_in_elixir_application.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In most cases, pipelines are used in one of the following scenarios:
1515
This approach is ideal when your pipeline architecture is fixed and needs to run continuously from the moment your application starts.
1616
Imagine an application that monitors a security camera feed to detect people or vehicles in real-time. Such an application could consist of two components:
1717

18-
- The Membrane Pipeline which connects to an SRT stream, decodes the video, and extracts raw frames. It sends these frames to the external process (via a Unix socket or standard input), receives the transformed video back, re-encodes it, and broadcasts the final stream using HLS.
18+
- The Membrane Pipeline which connects to an RTSP stream, decodes the video, and extracts raw frames. It sends these frames to the external process (via a Unix socket or standard input), receives the transformed video back, re-encodes it, and broadcasts the final stream using HLS.
1919

2020
- The OS Process being a Python script running a machine learning model like [RF-DETR](https://github.com/roboflow/rf-detr). It reads raw video frames and performs object segmentation, coloring the pixels that correspond to detected objects.
2121

@@ -26,7 +26,7 @@ defmodule MyProject.Pipeline do
2626
use Membrane.Pipeline
2727

2828
@impl true
29-
def handle_init(_ctx, srt_url) do
29+
def handle_init(_ctx, rtsp_url) do
3030
hls_config = %Membrane.HTTPAdaptiveStream.SinkBin{
3131
manifest_module: Membrane.HTTPAdaptiveStream.HLS,
3232
target_window_duration: Membrane.Time.seconds(120),
@@ -36,10 +36,10 @@ defmodule MyProject.Pipeline do
3636
}
3737

3838
spec = [
39-
child(:source, %Membrane.SRT.Source{
39+
child(:source, %Membrane.RTSP.Source{
4040
transport: :tcp,
4141
allowed_media_types: [:video],
42-
stream_uri: srt_url,
42+
stream_uri: rtsp_url,
4343
on_connection_closed: :send_eos
4444
})
4545
|> child(:depayloader, Membrane.H264.RTP.Depayloader)
@@ -68,10 +68,10 @@ defmodule MyProject.InfrastructureSupervisor do
6868
end
6969

7070
@impl true
71-
def init(srt_url) do
71+
def init(rtsp_url) do
7272
children = [
7373
{MuonTrap.Daemon, ["python", ["run_model.py", "rf-detr-large-2026.pth"], [log_output: :debug]], restart: :transient]}
74-
{MyProject.Pipeline, [input_url: srt_url], restart: :transient}
74+
{MyProject.Pipeline, [input_url: rtsp_url], restart: :transient}
7575
]
7676

7777
Supervisor.init(children, strategy: :one_for_all)
@@ -92,7 +92,7 @@ defmodule MyProject.Application do
9292
@impl true
9393
def start(_type, _args) do
9494
children = [
95-
{MyProject.InfrastructureSupervisor, [srt_url: "srt://127.0.0.1:9710"]}
95+
{MyProject.InfrastructureSupervisor, [rtsp_url: "rtsp://user:pass@127.0.0.1:554"]}
9696
# ... other children required by your application
9797
]
9898

@@ -105,7 +105,7 @@ end
105105
## Dynamically spawning the pipelines under the DynamicSupervisor
106106

107107
While the static approach works perfectly for fixed infrastructure, many applications require more flexibility.
108-
Consider a scenario where you need to spawn a new pipeline on demand to ingest an SRT stream from a camera provided by a user.
108+
Consider a scenario where you need to spawn a new pipeline on demand to ingest an RTSP stream from a camera provided by a user.
109109

110110
Since we have already defined the `InfrastructureSupervisor`, scaling to multiple dynamic pipelines is straightforward.
111111

@@ -137,7 +137,7 @@ def mount(params, _session, socket) do
137137
if connected?(socket) do
138138
{:ok, infrastructure_supervisor_pid} = DynamicSupervisor.start_child(
139139
MyProject.PipelineDynamicSupervisor,
140-
{MyProject.InfrastructureSupervisor, params["srt_url"]}
140+
{MyProject.InfrastructureSupervisor, params["rtsp_url"]}
141141
)
142142
{:ok, assign(socket, :infrastructure_supervisor_pid, infrastructure_supervisor_pid)}
143143
else

0 commit comments

Comments
 (0)