# Issue with appsrc Rejecting GST\_FORMAT\_TIME Segment in Live Pipeline

**URL:** https://discourse.gstreamer.org/t/issue-with-appsrc-rejecting-gst-format-time-segment-in-live-pipeline/5374
**Category:** Application Development
**Created:** [September 15, 2025, 5:48am UTC](https://discourse.gstreamer.org/t/issue-with-appsrc-rejecting-gst-format-time-segment-in-live-pipeline/5374 "2025-09-15T05:48:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![TrueDenRyu](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/7feea3/32.png) [@TrueDenRyu](https://discourse.gstreamer.org/u/TrueDenRyu)
#### Post date: [September 15, 2025, 5:48am UTC](https://discourse.gstreamer.org/t/issue-with-appsrc-rejecting-gst-format-time-segment-in-live-pipeline/5374/1 "2025-09-15T05:48:01Z")

</div>

## Environment

- **GStreamer Version** : 1.26.5

- **Binding** : `go-gst v1.4.0` (Go bindings for GStreamer)

- **OS** : Windows

- **Pipeline** : `appsrc ! bayer2rgb ! capsfilter caps=video/x-raw,format={RGB,BGR,RGBA,BGRA},framerate=30/1 ! videoconvert ! d3d12videosink sync=false`

- **Source** : Custom UDP source feeding Bayer (RGGB) video frames via `appsrc`

## Problem

When using `appsrc` as a live source with `format=GST_FORMAT_TIME`, the pipeline fails with a fatal `Internal data stream error` when sending a `time`-based segment event. The error occurs regardless of whether the segment event is sent before or after the pipeline reaches the `PLAYING` state. Debug logs show:

```auto
WARN basesrc gstbasesrc.c:4255:gst_base_src_push_segment:<source> segment format mismatched, ignore
ERROR appsrc gstappsrc.c:1633:gst_app_src_create:<source> Couldn't set new segment segment event: ..., time 99:99:99.999999999, ...
WARN appsrc gstappsrc.c:1740:gst_app_src_create:<source> error: Failed to configure the provided input segment.
ERROR: Could not configure supporting library.
WARN basesrc gstbasesrc.c:3187:gst_base_src_loop:<source> error: Internal data stream error.

```

Without the segment event, `appsrc` defaults to a `bytes` segment, causing `gst_segment_to_stream_time: assertion 'segment->format == format' failed` warnings with `d3d12videosink`, but the pipeline streams successfully. Switching to `d3d11videosink` eliminates all errors and renders correctly with valid PTS set via `SetPresentationTimestamp`.

## Observations

1. **Segment Format Mismatch** :

2. **d3d12videosink vs. d3d11videosink** :

3. **Caps Negotiation** :

## Workaround

- **Switch to `d3d11videosink`** : Eliminates all errors and renders video correctly with valid PTS.

- **Remove Segment Event** : Avoid sending `time` segment to prevent `appsrc` rejection.

- **Manual PTS** : Set PTS via `SetPresentationTimestamp` (e.g., `1757714207596254700`), which works reliably.

- **Variable Framerate** : Use `framerate=0/1` if the UDP source deviates from 30 fps.

## Suspected Bug

- `appsrc` defaults to `GST_FORMAT_BYTES` for live sources, ignoring `format=GST_FORMAT_TIME`.

- Sending a `time` segment event (even after `PLAYING`) is rejected, causing a fatal error.

- This may be a GStreamer 1.26.5 issue or a `go-gst` event handling limitation.

## Questions

- Is this a known issue with `appsrc` in GStreamer 1.26.5 for live sources?

- Are there specific configurations to enforce `GST_FORMAT_TIME` in `appsrc`?

- Any workarounds to send a `time` segment without rejection, given `go-gst`’s limited segment API?

## Code Snippet

```auto
source.SetProperty("format", gst.FormatTime)
source.SetProperty("is-live", true)
source.SetProperty("do-timestamp", true)
source.SetProperty("caps", gst.NewCapsFromString("video/x-bayer,format=rggb,width=1920,height=1200,framerate=30/1"))
// Segment event (causes error):
segment := gst.NewSegment()
segment.Init(gst.FormatTime)
source.SendEvent(gst.NewSegmentEvent(segment))

```

## Request

Can anyone confirm if this is a bug in `appsrc` or suggest a way to enforce `GST_FORMAT_TIME` without errors? Logs and full code available if needed. Thanks!

---

<div class="post-metadata">

### Author: ![RSWilli](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/rswilli/32/262_2.png) [@RSWilli](https://discourse.gstreamer.org/u/RSWilli)
#### Post date: [December 12, 2025, 12:18pm UTC](https://discourse.gstreamer.org/t/issue-with-appsrc-rejecting-gst-format-time-segment-in-live-pipeline/5374/2 "2025-12-12T12:18:37Z")

</div>

I’m not too familiar with every aspect of appsrc, but it could be a bug in the bindings.

If you can, try to switch to the newer unreleased bindings (will get merged at some point, currently very close to final).

> <https://github.com/go-gst/go-gst/pull/170>
>
> \<s\>
> this PR uses the gir generator from gotk4 to generate the gstreamer binding…s. Currently this breaks everything. We'll see what we can do about this in the future.
> 
> See also https://github.com/diamondburned/gotk4/pull/159
> \</s\>
> 
> Edit: See below, we switched to go-glib to have more control over the license

This PR implements auto generated code from the official gstreamer docs, so the chance of bugs should be lower. They aren’t 1:1 compatible with the 1.4.0 though, and the 1.x.x versions will get retracted once this is merged.

If any Methods are missing, then they might need manual implementation. Any feedback is welcome on the PR.

---

<div class="post-metadata">

### Author: ![TrueDenRyu](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/7feea3/32.png) [@TrueDenRyu](https://discourse.gstreamer.org/u/TrueDenRyu)
#### Post date: [December 23, 2025, 6:53pm UTC](https://discourse.gstreamer.org/t/issue-with-appsrc-rejecting-gst-format-time-segment-in-live-pipeline/5374/3 "2025-12-23T18:53:52Z")

</div>

Thank you for your response and possible fix. I am currently inundated with other tasks but I will work on trying this when I have time available and post an update here.

---

<div class="post-metadata">

### Author: ![TrueDenRyu](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/7feea3/32.png) [@TrueDenRyu](https://discourse.gstreamer.org/u/TrueDenRyu)
#### Post date: [March 2, 2026, 4:41pm UTC](https://discourse.gstreamer.org/t/issue-with-appsrc-rejecting-gst-format-time-segment-in-live-pipeline/5374/4 "2026-03-02T16:41:31Z")

</div>

I was able to build in Windows, using the latest commit as of this post, to the referenced go-gst bindings. I’m able to use **d3d12videosink** and **d3d11videosink** now without seeing any warnings. Many changes were made to my application and the new bindings work much differently than my previously reported configuration as I understand. It is difficult for me to identify exactly where the fix is but I think it most likely resides in the go-gst workings of my application. I’m therefore considering this resolved.
