# Saving RTSP stream to MP4 no duration and not seekable

**URL:** <https://discourse.gstreamer.org/t/saving-rtsp-stream-to-mp4-no-duration-and-not-seekable/4540>\
**Category:** Application Development\
**Created:** [April 29, 2025, 3:31am UTC](https://discourse.gstreamer.org/t/saving-rtsp-stream-to-mp4-no-duration-and-not-seekable/4540 "2025-04-29T03:31:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dartagnan](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/d/f1d935/32.png) [@Dartagnan](https://discourse.gstreamer.org/u/Dartagnan)\
**Post date:** [April 29, 2025, 3:31am UTC](https://discourse.gstreamer.org/t/saving-rtsp-stream-to-mp4-no-duration-and-not-seekable/4540/1 "2025-04-29T03:31:15Z")

</div>

Hello,

I’m trying to save an RTSP stream (at a certain key frame) to a mp4 file so I drop first few frames and key frame; the issue I’m running into is my resultant mp4 file does not have a duration and is not seekable. This seems to be because the rtsp camera somehow has caps framerate=(string)0/1 which means FPS isn’t set.

Here is my setup:  
pipeline 1: rtspsrc ! … ! h264depay ! h264parse ! appsink  
pipeline 2: appsrc ! … ! h264parse ! mp4mux ! filesink

so essentially appsink is handing over GstSamples to appsrc starting at a key frame and appsrc pipeline is saving the frames to file.

interestingly, if I run gst-launch-1.0 -e rtspsrc ! … ! h264parse ! mp4mux ! filesink then despite the caps of framerate=0/1 the resultant mp4 file has duration and is seekable. I did notice in logs a-framerate=30.0 before framerate=0/1 in caps eventually.

How can I ensure my mp4 file has duration and is seekable?

Thank you very much!

---

<div class="post-metadata">

**Author:** ![parithi](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/p/54ee81/32.png) [@parithi](https://discourse.gstreamer.org/u/parithi)\
**Post date:** [April 29, 2025, 10:54am UTC](https://discourse.gstreamer.org/t/saving-rtsp-stream-to-mp4-no-duration-and-not-seekable/4540/2 "2025-04-29T10:54:52Z")

</div>

Try sending EOS event on second pipeline and wait for EOS message in your application.

---

<div class="post-metadata">

**Author:** ![Dartagnan](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/d/f1d935/32.png) [@Dartagnan](https://discourse.gstreamer.org/u/Dartagnan)\
**Post date:** [April 29, 2025, 12:19pm UTC](https://discourse.gstreamer.org/t/saving-rtsp-stream-to-mp4-no-duration-and-not-seekable/4540/3 "2025-04-29T12:19:33Z")

</div>

Thanks, I already do that through gst\_app\_src\_end\_of\_stream(appsrc) and I see GST\_MESSAGE\_EOS on gst\_bus\_timed\_pop\_filtered(). I’m only seeing this issue with rtsp camera that has framerate=0/1 (if I try different camera that has framerate=30/1 then it all works find).
