SM
Software Mansion•12mo ago
Al

RTP stream

I'm trying to get a simple RTP stream pipeline working but hit the following error:
16:22:57.782 [error] GenServer #PID<0.308.0> terminating
** (KeyError) key #Reference<0.1227858978.1981546498.158967> not found in: %{}
:erlang.map_get(#Reference<0.1227858978.1981546498.158967>, %{})
(membrane_rtp_plugin 0.24.1) lib/membrane/rtp/session_bin.ex:430: Membrane.RTP.SessionBin.handle_pad_added/3
16:22:57.782 [error] GenServer #PID<0.308.0> terminating
** (KeyError) key #Reference<0.1227858978.1981546498.158967> not found in: %{}
:erlang.map_get(#Reference<0.1227858978.1981546498.158967>, %{})
(membrane_rtp_plugin 0.24.1) lib/membrane/rtp/session_bin.ex:430: Membrane.RTP.SessionBin.handle_pad_added/3
This appears to be due to the ssrc_pt_mapping being empty - how does this get populated? This is my initial pipeline:
child(:video_src,
%Membrane.UDP.Source{
local_address: {127, 0, 0, 1},
local_port_no: 1234
})
|> via_in(:rtp_input)
|> child(:rtp, Membrane.RTP.SessionBin)
|> child(:out, %Membrane.File.Sink{location: "tmp.ts"})
child(:video_src,
%Membrane.UDP.Source{
local_address: {127, 0, 0, 1},
local_port_no: 1234
})
|> via_in(:rtp_input)
|> child(:rtp, Membrane.RTP.SessionBin)
|> child(:out, %Membrane.File.Sink{location: "tmp.ts"})
The one key difference from the demo is I'm streaming an mpeg ts payload so payload type is 33. All works fine with ffplay so I guess I'm missing something in the Membrane setup.
7 Replies
mat_hek
mat_hek•12mo ago
Hi @al_m1 , you need to wait for a message from the session bin and then link it to the following element via proper output pad, like in the demo: https://github.com/membraneframework/membrane_demo/blob/master/rtp/lib/membrane_demo_rtp/receive_pipeline.ex#L45 This is something we intend to fix, so that if you know in advance what streams you're going to receive, you could just link the pad right away, but it's not trivial unfortunately BTW I don't think we ever sent MPEG-TS via RTP, so let me know if you have any other problems 😉
Al
AlOP•12mo ago
Thanks @mat_hek . I can now see what I was doing wrong - adding the |> child(:out, %Membrane.File.Sink{location: "tmp.ts"}) causes the error. As you say I need to add this once the pipeline has received handle_child_notification({:new_rtp_stream, ssrc, 33, _extensions}, :rtp, _ctx, state). Am I correct in assuming I'll need to implement a deplayloader for TS packets?
mat_hek
mat_hek•12mo ago
Correct Then you can demux with https://github.com/kim-company/membrane_mpeg_ts_plugin Can you share what sends MPEG-TS within RTP? 🙂
Al
AlOP•12mo ago
Video from a UAV in STANAG 4609 format
mat_hek
mat_hek•12mo ago
Wow. Anyway, if you'd be willing to implement RTP MPEG-TS depayloader, I can help, but it seems it's quite complex https://www.rfc-editor.org/rfc/rfc2250
Al
AlOP•11mo ago
At the moment just passing the output from the RTP SessionBin to the demuxer from the membrane_mpeg_ts_plugin seems to work fine.
mat_hek
mat_hek•11mo ago
Glad to hear that! I'm wondering what is this RFC 2250 about then 😄
Want results from more Discord servers?
Add your server