Regarding multifilesink

Sebastian Dröge sebastian at
Wed Apr 2 12:00:56 PDT 2014

On Mi, 2014-04-02 at 04:04 -0700, Shilpa Chandrappa wrote:
> Hi,
> I would like to create a new mp4 file with index incremented when file size
> has reached to 1GB. Based on some research found multifilesink can be used
> to perform this. But  I am not able to play the mp4 files created using
> multifilesink.
> Command used
> gst-launch-0.10 -e rtspsrc location=rtsp://XYZ name=rtsp  ! queue !
> rtph264depay ! video/x-h264, width=1920, height=1080, framerate=30/1  !
> mp4mux name=mp4 ! multifilesink location=%ds.mp4 next-file=4
> max-file-size=1073741824

All the MP4 files would be incomplete and not playable standalone if you
do it that way. A MP4 file needs to be finalised after all content is
written, especially every single frame's byte offset needs to be added
to the headers of the file.

> Is there any way I can split mp4 files based on max-file size reached ? Need
> your inputs on how to achieve this.

You'll have to use a pipeline where the MP4 muxer and filesink are
switched dynamically every 1GB, and before destroying the old MP4 muxer
and filesink you would need to send an EOS event to the muxer to
finalise the MP4 file.

To safely relink the pipeline during playback you'll have to use
blocking pad probes on the srcpad upstream of the muxer, and from the
probe callback do the relinking.

Sebastian Dröge, Centricular Ltd -
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gstreamer-devel mailing list