Issue with splitmuxsink Pipeline

Hi Team,

I’m currently using the following GStreamer pipeline with splitmuxsink to split the video every 10 seconds. However, I’m facing an issue with the video fragmentation as I’ve added the fragment properties in the “muxer-properties,” but it doesn’t seem to work as expected.

Here’s the pipeline I’m using:

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! queue ! x264enc tune=zerolatency ! splitmuxsink location=video%02d.mp4 async-finalize=true max-size-time=10000000000 muxer-factory=mp4mux muxer-properties="properties,fragment-duration=2000"

The goal is to split the video every 10 seconds and ensure proper video fragmentation. However, the fragment-duration property in “muxer-properties” doesn’t seem to work as intended.

I would greatly appreciate your help in resolving this issue and providing a solution. If you have any insights or suggestions, please let me know.

Thank you for your assistance.

Best regards,

Hi @Sulthan4

I’m no expert, but I think your issue occurs because the encoder doesn’t have a GOP size defined.
In that case, the splitmux element can’t actually split the video because the new file won’t start with a key frame.
Please try to set x264enc tune=zerolatency key-int-max=30.
If that works, you can obviously replace 30 with the key frame interval you want. I just assumed you are running in 30 FPS, and a key frame once per second is fairly normal.

Let me know if that helps.


1 Like

This is a bit of a curious setup.

The splitmuxsink element’s purpose it to split a stream into file parts/fragments based on max duration or file size, in such a way that the files can be played individually. It’s mostly been written to work with muxers that don’t support splitting natively, such as MP4 or Matroska.

If you use mp4mux with the fragment-duration property set it will do the fragmenting/splitting itself. So you basically have two elements that try to do splitting here. I guess the purpose is to get a new file on each split.

In any case, if you want to create fragmented MP4 files (fMP4) like for DASH/HLS, you should use one of the new fragmented mp4 muxers here: fmp4 (cmafmux, dashfmp4mux, isofmp4mux).

See the example code here for DASH/HLS examples: mux/fmp4/examples · main · GStreamer / gst-plugins-rs · GitLab

Thanks for your response.

I am using GStreamer 1.14 and Linux 18.04 for my project. I want to know if I can use the fmp4 elements with the splitmuxsink element to split the video into segments of 10 seconds each. I also want to know how to install and use the gstremar-rs library.

Note: Each 10-second video segment should have a fragment data (moof, moov) for every 2 seconds of the segment.

fmp4mux unfortunately needs GStreamer 1.18 at least, which is almost 4 years old by now.

fmp4mux is doing the splitting itself already. Take a look at the example :slight_smile:

See the instructions in the repository.

That’s what fmp4mux does if you configure it with a fragment-duration of 10s and a chunk-duration of 2s.

1 Like