# Building a gstreamer pipeline to cast directly in web browser

**URL:** https://discourse.gstreamer.org/t/building-a-gstreamer-pipeline-to-cast-directly-in-web-browser/5518
**Category:** General Discussion
**Tags:** python
**Created:** [November 14, 2025, 7:46am UTC](https://discourse.gstreamer.org/t/building-a-gstreamer-pipeline-to-cast-directly-in-web-browser/5518 "2025-11-14T07:46:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Joshua](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@Joshua](https://discourse.gstreamer.org/u/Joshua)
#### Post date: [November 14, 2025, 7:46am UTC](https://discourse.gstreamer.org/t/building-a-gstreamer-pipeline-to-cast-directly-in-web-browser/5518/1 "2025-11-14T07:46:45Z")

</div>

Hi,

I’m working on a project that requires streaming video output from a GStreamer pipeline to a web browser. I am looking into WebRTC as this seems to be the simplest solution to implement.

I want to build a GStreamer pipeline that passes the video output to the browser with WebRTC.

I’ve reviewed several GStreamer and WebRTC examples but I’m still struggling with creating a working end-to-end example or complete working chain.

If you have an example that works, configuration hints, or any other tips on how to connect GStreamer WebRTC elements to a browser client, I would appreciate the help.

Best regards

Joshua.

---

<div class="post-metadata">

### Author: ![ystreet00](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/y/3d9bf3/32.png) [@ystreet00](https://discourse.gstreamer.org/u/ystreet00)
#### Post date: [November 14, 2025, 10:55am UTC](https://discourse.gstreamer.org/t/building-a-gstreamer-pipeline-to-cast-directly-in-web-browser/5518/2 "2025-11-14T10:55:23Z")

</div>

There are many such examples in [subprojects/gst-examples/webrtc · main · GStreamer / gstreamer · GitLab](https://gitlab.freedesktop.org/gstreamer/gstreamer/-/tree/main/subprojects/gst-examples/webrtc?ref_type=heads) that can show the flow negotiating with a browser peer. Particularly the `sendrecv` examples are useful for sending and receiving a stream to and from the browser.

---

<div class="post-metadata">

### Author: ![wildiness](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/wildiness/32/1229_2.png) [@wildiness](https://discourse.gstreamer.org/u/wildiness)
#### Post date: [November 15, 2025, 10:07pm UTC](https://discourse.gstreamer.org/t/building-a-gstreamer-pipeline-to-cast-directly-in-web-browser/5518/3 "2025-11-15T22:07:45Z")

</div>

> [@Joshua](#):
>
> I’m working on a project that requires streaming video output from a GStreamer pipeline to a web browser.

Hello.

If all you want to do is stream h264 to the web browser you could use external software for the webrtc part. For example: go2rtc

> **[GitHub - AlexxIT/go2rtc: Ultimate camera streaming application with support...](https://github.com/AlexxIT/go2rtc)**
>
> Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.

It’s a standalone binary and handles all of the webrtc stuff. You can run gstreamer via go2rtc either directly or by splitting your pipeline in two and running one half in go2rtc and one separately and feeding into go2rtc via something like tcpserversink and tcpclientsrc (or the new unixfd if you’re on gst 1.26. I haven’t used this personally yet.) Running two pipelines performs better in my experience.

Example: Put this in either go2rtc.yaml or in the go2rtc webgui. Note! The -q (–quiet) flag on gst-launch-1.0 is mandatory!

```auto
streams:
  external: exec:gst-launch-1.0 -q tcpclientsrc host=0.0.0.0 port=3000 ! queue ! fdsink
  
  internal: exec:gst-launch-1.0 -q videotestsrc is-live=true pattern=ball ! video/x-raw,format=NV12,framerate=15/1 ! queue ! x264enc speed-preset=1 tune=zerolatency ! h264parse config-interval=-1 ! mpegtsmux ! queue ! fdsink

log:
  format: ""
  level: "trace"
  exec: "trace"

```

Run this in another terminal:

```auto
gst-launch-1.0 -v videotestsrc pattern=ball ! video/x-raw,format=NV12,framerate=15/1 ! queue ! x264enc speed-preset=1 tune=zerolatency ! queue ! h264parse config-interval=-1 ! mpegtsmux ! tcpserversink host=0.0.0.0 port=3000

```

go2rtc will immediately demux the mpegts into just h264 but having it in there anyway makes things work better IME.
