Dynamic Playback of MPEG-Dash stream

"How can I ensure smooth playback in DASH when starting playback from the middle of a live fragmented MP4 stream generated using fmp4mux and multifilesink?

I am creating 1-second segments named with epoch seconds and programmatically generating an MPD file using a SegmentTemplate with startNumber to specify the starting segment. Playback works fine if I start from the first segment, but when I start from the middle, the stream either plays at 2x speed or fails to load. the browser downloads the segments properly but is unable to play them.

I came across this PR on GitLab, and:

  • Do I need to generate a separate init.mp4 for each stream?
  • If so, what metadata should the init.mp4 include to ensure compatibility with DASH players like dash.js or Shaka Player?"

Edit: I guess i found this https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8168 So i am assuming we need init.mp4.
but is it possible in mpeg-dash to start streaming from middle segments in a live stream/

I have solved this issue with the help of presentationTimeOffset and startNumber. didnt had the need to create a init mp4 similar to what mux/fmp4/examples/dash_vod.rs · main · GStreamer / gst-plugins-rs · GitLab has. I have the first segment as initialization in segment template or you can also not mention any initialization but that only works in shaka player. refer Self-initializing segments · Issue #861 · Dash-Industry-Forum/dash.js · GitHub