## splitmuxsink splitmuxsink — Muxer wrapper for splitting output stream by size or time |

## Properties

gchar * | location | Read / Write
guint64 | max-size-bytes | Read / Write
guint64 | max-size-time | Read / Write
gdouble | mux-overhead | Read / Write
GstElement * | muxer | Read / Write
GstElement * | sink | Read / Write
guint | max-files | Read / Write
gboolean | send-keyframe-requests | Read / Write
gchar * | max-size-timecode | Read / Write
guint64 | alignment-threshold | Read / Write
gboolean | use-robust-muxing | Read / Write

## Signals

gchar* | format-location | Run Last
gchar* | format-location-full | Run Last
void | split-now | Run Last

## Types and Values

struct | GstSplitMuxSink

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBin
                        ╰── GstSplitMuxSink

## Implemented Interfaces

GstSplitMuxSink implements GstChildProxy.

## Description

This element wraps a muxer and a sink, and starts a new file when the mux contents are about to cross a threshold of maximum size of maximum time, splitting at video keyframe boundaries. Exactly one input video stream can be muxed, with as many accompanying audio and subtitle streams as desired.

By default, it uses mp4mux and filesink, but they can be changed via the 'muxer' and 'sink' properties.

The minimum file size is 1 GOP, however - so limits may be overrun if the distance between any 2 keyframes is larger than the limits.

If a video stream is available, the splitting process is driven by the video stream contents, and the video stream must contain closed GOPs for the output file parts to be played individually correctly. In the absence of a video stream, the first available stream is used as reference for synchronization.

### Example pipelines

    1
    gst-launch-1.0 -e v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! videoconvert ! queue ! timeoverlay ! x264enc key-int-max=10 ! h264parse ! splitmuxsink location=video%02d.mov max-size-time=10000000000 max-size-bytes=1000000

Records a video stream captured from a v4l2 device and muxes it into ISO mp4 files, splitting as needed to limit size/duration to 10 seconds and 1MB maximum size.

## Synopsis

### Element Information

plugin | multifile
author | Jan Schmidt <jan@centricular.com>
class | Generic/Bin/Muxer

### Element Pads

name | audio_%u
direction | sink
presence | request
details | ANY

name | subtitle_%u
direction | sink
presence | request
details | ANY

name | video
direction | sink
presence | request
details | ANY

## Functions

## Types and Values

### struct GstSplitMuxSink

    struct GstSplitMuxSink;

## Property Details

### The `“location”` property

      “location”                 gchar *

Format string pattern for the location of the files to write (e.g. video%05d.mp4).

Flags: Read / Write

Default value: NULL

### The `“max-size-bytes”` property

      “max-size-bytes”           guint64

Max. amount of data per file (in bytes, 0=disable).

Flags: Read / Write

Default value: 0

### The `“max-size-time”` property

      “max-size-time”            guint64

Max. amount of time per file (in ns, 0=disable).

Flags: Read / Write

Default value: 0

### The `“mux-overhead”` property

      “mux-overhead”             gdouble

Extra size overhead of muxing (0.02 = 2%).

Flags: Read / Write

Allowed values: [0,1]

Default value: 0.02

### The `“muxer”` property

      “muxer”                    GstElement *

The muxer element to use (NULL = default mp4mux).

Flags: Read / Write

### The `“sink”` property

      “sink”                     GstElement *

The sink element (or element chain) to use (NULL = default filesink).

Flags: Read / Write

### The `“max-files”` property

      “max-files”                guint

Maximum number of files to keep on disk. Once the maximum is reached,old files start to be deleted to make room for new ones.

Flags: Read / Write

Default value: 0

### The `“send-keyframe-requests”` property

      “send-keyframe-requests”   gboolean

Request a keyframe every max-size-time ns to try splitting at that point. Needs max-size-bytes to be 0 in order to be effective.

Flags: Read / Write

Default value: FALSE

### The `“max-size-timecode”` property

      “max-size-timecode”        gchar *

Maximum difference in timecode between first and last frame. Separator is assumed to be ":" everywhere (e.g. 01:00:00:00). Will only be effective if a timecode track is present.

Flags: Read / Write

Default value: NULL

### The `“alignment-threshold”` property

      “alignment-threshold”      guint64

Allow non-reference streams to be that many ns before the reference stream.

Flags: Read / Write

Default value: 0

### The `“use-robust-muxing”` property

      “use-robust-muxing”        gboolean

Check if muxers support robust muxing via the reserved-max-duration and reserved-duration-remaining properties and use them if so. (Only present on qtmux and mp4mux for now). splitmuxsink may then also create new fragments if the reserved header space is about to overflow. Note this does not set reserved-moov-update-period - apps should do that manually.

Flags: Read / Write

Default value: FALSE

## Signal Details

### The `“format-location”` signal

    gchar*
    user_function (GstSplitMuxSink *splitmux,
                   guint            fragment_id,
                   gpointer         user_data)

#### Parameters

splitmux | the GstSplitMuxSink |
fragment_id | the sequence number of the file to be created |
user_data | user data set when the signal handler was connected. |

#### Returns

the location to be used for the next output file

Flags: Run Last

### The `“format-location-full”` signal

    gchar*
    user_function (GstSplitMuxSink *splitmux,
                   guint            fragment_id,
                   GstSample       *first_sample,
                   gpointer         user_data)

#### Parameters

splitmux | the GstSplitMuxSink |
fragment_id | the sequence number of the file to be created |
first_sample | A GstSample containing the first buffer from the reference stream in the new file |
user_data | user data set when the signal handler was connected. |

#### Returns

the location to be used for the next output file

Flags: Run Last

### The `“split-now”` signal

    void
    user_function (GstSplitMuxSink *splitmux,
                   gpointer         user_data)

When called by the user, this action signal splits the video file (and begins a new one) immediately.

#### Parameters

splitmux | the GstSplitMuxSink |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.14