Streaming RTSP with webrtcsink

Hi, I am having issues with streaming RTSP to web browser

  • This pipeline is working: gst-launch-1.0 rtspsrc location=“rtspt://…” latency=0 is-live=true ! rtph264depay ! h264parse ! avdec_h264 ! videoscale ! video/x-raw,width=1280,height=720 ! x264enc ! h264parse ! webrtcsink video-caps=“video/x-h264” run-signalling-server=true
  • But I don’t want to decode and re-encode the stream, so I tried this pipeline: gst-launch-1.0 rtspsrc location=“rtspt://” latency=0 is-live=true ! rtph264depay ! h264parse ! capsfilter caps=“video/x-h264, profile=high, width=1280, height=720, framerate=15/1” ! webrtcsink video-caps=“video/x-h264” run-signalling-server=true but it’s not working,

webrtcsink show errors: ERROR webrtcsink net/webrtc/src/webrtcsink/imp.rs:3640:gstrswebrtc::webrtcsink::imp::BaseWebRTCSink::on_remote_description_set: Failed to connect input stream video_0 for session e0578768-1655-4c4c-9777-1b85cde6f22e: Failed to link elements ‘capsfilter5’ and ‘capsfilter3’

Hi Giangluu

The issue you’re encountering with the GStreamer pipeline may be related to how the capabilities (capsfilter) are being applied to the stream, causing the elements to fail linking properly. First, try simplifying your pipeline by removing the capsfilter entirely to see if it resolves the issue: gst-launch-1.0 rtspsrc location="rtspt://..." latency=0 is-live=true ! rtph264depay ! h264parse ! webrtcsink run-signalling-server=true. If this works, it indicates that the problem lies with the capsfilter. You can also check if the RTSP stream is correctly H264-encoded and matches the expected resolution and framerate using gst-discoverer-1.0. Additionally, ensure that your GStreamer version is up-to-date, as bugs can sometimes cause issues with linking. If you need to enforce specific capabilities, try a more general capsfilter like video/x-h264, width=1280, height=720, as strict caps can cause mismatches

I already tried pipeline:

GST_DEBUG=3 gst-launch-1.0 rtspsrc location=“rtspt://” latency=0 is-live=true ! rtph264depay ! h264parse ! webrtcsink run-signalling-server=true

It still not working INFO ThreadId(01) gst_plugin_webrtc_signalling::server: Received message Ok(Text(Utf8Bytes(b"{"type":"peer","sessionId":"c1074c64-6d88-476e-a3fd-b86ed94a6725","sdp":{"type":"answer","sdp":"v=0\r\no=- 817762349288412996 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE\r\na=msid-semantic: WMS\r\nm=video 0 UDP/TLS/RTP/SAVPF 96 98 100\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:D099\r\na=ice-pwd:N9cz/BpvaA3T+fYsnyu9QnFo\r\na=ice-options:trickle\r\na=fingerprint:sha-256 63:F5:43:C0:55:B7:04:B4:69:81:B8:DC:FE:12:1E:A4:0B:A1:F1:D9:CE:E8:85:C5:03:0F:AF:30:03:A7:88:63\r\na=setup:active\r\na=mid:video0\r\na=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\\r\\na=recvonly\\r\\na=rtcp-mux\\r\\na=rtcp-rsize\\r\\na=rtpmap:96 red/90000\r\na=rtpmap:98 ulpfec/90000\r\na=rtpmap:100 rtx/90000\r\na=fmtp:100 apt=96\r\n"}}")))
0:00:10.642377193 1177718 0x78e880013440 WARN webrtctransportsendbin transportsendbin.c:457:gst_transport_send_bin_element_query: did not really configure latency of 0:00:00.000000000
0:00:10.642735967 1177718 0x5fc1575eb020 ERROR webrtcsink net/webrtc/src/webrtcsink/imp.rs:3640:gstrswebrtc::webrtcsink::imp::BaseWebRTCSink::on_remote_description_set: Failed to connect input stream video_0 for session c1074c64-6d88-476e-a3fd-b86ed94a6725: Failed to link elements ‘capsfilter5’ and ‘capsfilter3’

Here info of my stream from gst-discoverer: gst-discoverer-1.0 “rtspt://…”
Analyzing rtspt://…
Done discovering rtspt://…
Analyzing URI timed out
Properties:
Duration: 99:99:99.999999999
Seekable: no
Live: yes
container #0: application/rtspt
unknown #2: application/x-rtp
video #1: H.264 (High Profile)
Stream ID: ef58727b04888aad5de56b4ae4b09c005d9ee359632fa777ea9f800c54dcfca3/video:0:0:RTP:AVP:96
Width: 4096
Height: 2336
Depth: 24
Frame rate: 25/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 8135240
Max bitrate: 8605200
But it’s still not working with pipeline
GST_DEBUG=3 gst-launch-1.0 rtspsrc location=“rtspt://…” latency=0 is-live=true ! rtph264depay ! h264parse ! capsfilter caps=“video/x-h264, width=4096, height=2336” ! webrtcsink run-signalling-server=true

0:00:11.158129341 1182651 0x72cf9c0125d0 WARN webrtctransportsendbin transportsendbin.c:457:gst_transport_send_bin_element_query: did not really configure latency of 0:00:00.000000000
0:00:11.158610068 1182651 0x63737700c0c0 ERROR webrtcsink net/webrtc/src/webrtcsink/imp.rs:3640:gstrswebrtc::webrtcsink::imp::BaseWebRTCSink::on_remote_description_set: Failed to connect input stream video_0 for session e36ac470-7c10-4a8c-a21d-cfbc2c467b10: Failed to link elements ‘capsfilter6’ and ‘capsfilter4’