# Challenges in Sequential Broadcasting of raw TS Files on UDP Port Using GStreamer with User-Specified Timestamps

**URL:** <https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938>\
**Category:** Newcomers\
**Created:** [July 13, 2024, 7:31pm UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938 "2024-07-13T19:31:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikita](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/n/a8b319/32.png) [@Nikita](https://discourse.gstreamer.org/u/Nikita)\
**Post date:** [July 13, 2024, 7:31pm UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938/1 "2024-07-13T19:31:49Z")

</div>

I’m trying to broadcast raw TS files on a UDP port based on user-specified start and end times, broadcasting each file sequentially within that time range. Trying to broadcast multiple files in sequence but didn’t work. Below is the pipeline I’m using:

Pipeline -

`pipeline = f"filesrc location={file_path} ! queue ! tsparse set-timestamps=true ! rtpmp2tpay ! .send_rtp_sink_0 rtpbin ! udpsink host={udp_address} port={udp_port}"`

Seek -

```auto
    seek_success = pipe.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, start_seconds * Gst.SECOND)

```

For postion check -  
`success, position = pipe.query_position(Gst.Format.TIME)`

Logs -

```auto
File start time in seconds: 59400
Start time in seconds: 56
End time in seconds: 94
Calculated duration: 38 seconds
File duration: 120.665312 seconds
0:00:00.074264423 11005 0x58362b7aef60 WARN default descriptions.c:747:format_info_get_desc: Unexpected MPEG-1 layer in audio/mpeg, mpegversion=(int)1
0:00:00.074331621 11005 0x58362b7aef60 WARN default gst/parse/grammar.y:540:gst_parse_no_more_pads:<tsdemux0> warning: Delayed linking failed.
0:00:00.074336841 11005 0x58362b7aef60 WARN default gst/parse/grammar.y:540:gst_parse_no_more_pads:<tsdemux0> warning: failed delayed linking some pad of GstTSDemux named tsdemux0 to some pad of GstRTPMP2TPay named rtpmp2tpay0
0:00:00.074512428 11005 0x58362b7aef00 WARN basesrc gstbasesrc.c:3127:gst_base_src_loop:<filesrc0> error: Internal data stream error.
0:00:00.074527849 11005 0x58362b7aef00 WARN basesrc gstbasesrc.c:3127:gst_base_src_loop:<filesrc0> error: streaming stopped, reason not-linked (-1)
0:00:00.074552630 11005 0x58362b7aef00 WARN queue gstqueue.c:992:gst_queue_handle_sink_event:<queue0> error: Internal data stream error.
0:00:00.074562315 11005 0x58362b7aef00 WARN queue gstqueue.c:992:gst_queue_handle_sink_event:<queue0> error: streaming stopped, reason not-linked (-1)

```

When i run the same pipeline through command line -

 ![image](https://discourse.gstreamer.org/uploads/default/original/1X/f0dc22a9e3fbc6ab5368acf50f41c690fad45e49.png)

Any suggestions or alternatives for handling multiple file broadcasting within the specified time range? Thank you!

---

<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:** [July 14, 2024, 4:10pm UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938/2 "2024-07-14T16:10:27Z")

</div>

Why does your debug log with the fatal error talk about `GstTSDemux` and `tsdemux0` even though your pipeline uses `tsparse`?

---

<div class="post-metadata">

**Author:** ![Nikita](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/n/a8b319/32.png) [@Nikita](https://discourse.gstreamer.org/u/Nikita)\
**Post date:** [July 14, 2024, 6:00pm UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938/3 "2024-07-14T18:00:35Z")

</div>

Apologies for the confusion earlier. It seems the logs were mistakenly attached from a different pipeline involving tsdemux.

---

<div class="post-metadata">

**Author:** ![Nikita](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/n/a8b319/32.png) [@Nikita](https://discourse.gstreamer.org/u/Nikita)\
**Post date:** [July 15, 2024, 10:20am UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938/4 "2024-07-15T10:20:30Z")

</div>

I have checked using ` Gst.QueryType` but it returned as False.  
Log file link - [https://drive.google.com/file/d/1LuzyRKnMUknVLrojAI4CsZjn1uU8apCR/view?usp=drive\_link](https://drive.google.com/file/d/1LuzyRKnMUknVLrojAI4CsZjn1uU8apCR/view?usp=drive_link)

Additionally, I changed the pipeline to do transcoding (decode/encode) and query/seek operation was successfully.  
Pipeline -

```auto
filesrc location={file_path} ! decodebin ! x264enc tune=zerolatency ! mpegtsmux ! rtpmp2tpay pt=33 ! udpsink host=239.202.0.1 port=3000

```

However, I want to avoid re-encoding so is there any way I can seek without transcoding the stream?

---

<div class="post-metadata">

**Author:** ![Nikita](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/n/a8b319/32.png) [@Nikita](https://discourse.gstreamer.org/u/Nikita)\
**Post date:** [August 26, 2024, 11:30am UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938/5 "2024-08-26T11:30:44Z")

</div>

Just checking on this issue. Any updates or suggestions would be greatly appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![bilboed](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/bilboed/32/251_2.png) [@bilboed](https://discourse.gstreamer.org/u/bilboed)\
**Post date:** [August 27, 2024, 7:14am UTC](https://discourse.gstreamer.org/t/challenges-in-sequential-broadcasting-of-raw-ts-files-on-udp-port-using-gstreamer-with-user-specified-timestamps/1938/6 "2024-08-27T07:14:51Z")

</div>

Hi,

The issue is that rtpmp2tpay (and more generically paylaoders, encoders and muxers) only expect continuous streams, and therefore no seeking/flushing.

The trick is to “flatten/swallow” all of those so that the input to those elements is continuous. You could try inserting `identity single-segment=True` for example, but I’m not 100% sure it will drop the flushes.
