# Tcpclientsrc timestamps

**URL:** <https://discourse.gstreamer.org/t/tcpclientsrc-timestamps/592>\
**Category:** Application Development\
**Created:** [November 25, 2023, 5:55pm UTC](https://discourse.gstreamer.org/t/tcpclientsrc-timestamps/592 "2023-11-25T17:55:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bomolete](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/b/6de8d8/32.png) [@bomolete](https://discourse.gstreamer.org/u/bomolete)\
**Post date:** [November 25, 2023, 5:55pm UTC](https://discourse.gstreamer.org/t/tcpclientsrc-timestamps/592/1 "2023-11-25T17:55:10Z")

</div>

I have a source streaming raw JPEG over TCP. I am trying to encode this stream as H264 and serve it as an RTSP stream. I set the do-timestamp property on the tcpclientsrc element to TRUE. However, the tcpclientsrc is not a live source and it is producing buffers in a paused state. Because there’s no clock until the pipeline gets in a playing state, buffers have no timestamp. This is causing the x264enc to complain about timestamps and not produce any output for a very long time (about 60 frames). When it eventually produces frames and the pipeline gets in a playing state only the first frame is being rendered.

For testing simplicity, I am running this pipeline, replacing the h264 rtp payloader with a decoder and renderer:

gst-launch-1.0.exe tcpclientsrc host=localhost port=10010 do-timestamp=true ! jpegparse ! jpegdec ! x264enc ! avdec\_h264 ! autovideosink

For example, this pipeline is working as expected:

gst-launch-1.0.exe videotestsrc is-live=true ! x264enc ! h264\_avdec ! autovideosink

Actually this pipeline works as expected even when is-live is not set to true because the videotestsrc always generates timestamps.

Does anyone have any suggestions on how to approach this problem? I believe that if the tcpclientsrc was a live source this would work without issues.

---

<div class="post-metadata">

**Author:** ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)\
**Post date:** [November 27, 2023, 3:20pm UTC](https://discourse.gstreamer.org/t/tcpclientsrc-timestamps/592/2 "2023-11-27T15:20:19Z")

</div>

In case you’re able to build/use the latest Rust plugins from the `main` branch, you could try the new `intersin` and `intersrc` elements.

I have not tried this for your use case, but something like this could do the trick:

Producer pipeline:

```auto
tcpclientsrc ! jpegparse ! intersink

```

RTSP server (consumer) pipeline:

```auto
intersrc ! jpegdec ! x264enc tune=zerolatency ! rtph264pay

```

You would then also need to access that `appsrc` that’s inside the `intersrc` (I believe its name will be “appsrc”, so you should be able to just look it up with `gst_bin_get_by_name(GST_BIN(intersrc), "appsrc")`.

On the `appsrc` you can then set the `do-timestamp` property to `true`.

As I said, I haven’t tried it, but should be possible to make this work.

If you set `x264enc tune=zerolatency` then it will not consume ca. 60 frames before outputting anything, but produce an output buffer right away. This might also alleviate your problem.

You can also set `async=false` on the sink element, then it will not do the whole wait-for-a-buffer-to-preroll dance, that way things might move to playing state straight away. (Not tested this for your scenario either).
