## multifilesink

multifilesink

## Properties

gchar * | location | Read / Write
gint | index | Read / Write
GstMultiFileSinkNext | next-file | Read / Write
gboolean | post-messages | Read / Write
guint | max-files | Read / Write
guint64 | max-file-size | Read / Write
gboolean | aggregate-gops | Read / Write
guint64 | max-file-duration | Read / Write

## Types and Values

struct | GstMultiFileSink
enum | GstMultiFileSinkNext

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseSink
                        ╰── GstMultiFileSink

## Description

Write incoming data to a series of sequentially-named files.

This element is usually used with data where each buffer is an independent unit of data in its own right (e.g. raw video buffers or encoded JPEG or PNG images) or with streamable container formats such as MPEG-TS or MPEG-PS.

It is not possible to use this element to create independently playable mp4 files, use the splitmuxsink element for that instead.

The filename property should contain a string with a %d placeholder that will be substituted with the index for each filename.

If the “post-messages” property is `TRUE`, it sends an application message named

`"GstMultiFileSink"` after writing each

buffer.

The message's structure contains these fields:

- gchar * `"filename"`: the filename where the buffer was written.

- gint `"index"`: the index of the buffer.

- GstClockTime `"timestamp"`: the timestamp of the buffer.

- GstClockTime `"stream-time"`: the stream time of the buffer.

- GstClockTime `"running-time"`: the running_time of the buffer.

- GstClockTime `"duration"`: the duration of the buffer.

- guint64 `"offset"`: the offset of the buffer that triggered the message.

- guint64 `"offset-end"`: the offset-end of the buffer that triggered the message.

### Example launch line

    1
    2

    gst-launch-1.0 audiotestsrc ! multifilesink
    gst-launch-1.0 videotestsrc ! multifilesink post-messages=true location="frame%d"

## Synopsis

### Element Information

plugin | multifile
author | David Schleef <ds@schleef.org>
class | Sink/File

### Element Pads

name | sink
direction | sink
presence | always
details | ANY

## Functions

## Types and Values

### struct GstMultiFileSink

    struct GstMultiFileSink;

### enum GstMultiFileSinkNext

File splitting modes.

#### Members

GST_MULTI_FILE_SINK_NEXT_BUFFER | New file for each buffer |
GST_MULTI_FILE_SINK_NEXT_DISCONT | New file after each discontinuity |
GST_MULTI_FILE_SINK_NEXT_KEY_FRAME | New file at each key frame (Useful for MPEG-TS segmenting) |
GST_MULTI_FILE_SINK_NEXT_KEY_UNIT_EVENT | New file after a force key unit event |
GST_MULTI_FILE_SINK_NEXT_MAX_SIZE | New file when the configured maximum file size would be exceeded with the next buffer or buffer list |
GST_MULTI_FILE_SINK_NEXT_MAX_DURATION | New file when the configured maximum duration would be exceeded with the next buffer or buffer list |

## Property Details

### The `“location”` property

      “location”                 gchar *

Location of the file to write.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: NULL

### The `“index”` property

      “index”                    gint

Index to use with location property to create file names. The index is incremented by one for each buffer written.

Owner: GstMultiFileSink

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“next-file”` property

      “next-file”                GstMultiFileSinkNext

When to start a new file.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: New file for each buffer

### The `“post-messages”` property

      “post-messages”            gboolean

Post a message on the GstBus for each file.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: FALSE

### 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.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: 0

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

      “max-file-size”            guint64

Maximum file size before starting a new file in max-size mode.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: 2147483648

### The `“aggregate-gops”` property

      “aggregate-gops”           gboolean

Whether to aggregate complete GOPs before doing any processing. Set this to TRUE to make sure each new file starts with a keyframe. This requires the upstream element to flag buffers containing key units and delta units correctly. At least the MPEG-PS and MPEG-TS muxers should be doing this.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: FALSE

Since: 1.6

### The `“max-file-duration”` property

      “max-file-duration”        guint64

Maximum file size before starting a new file in max-size mode.

Owner: GstMultiFileSink

Flags: Read / Write

Default value: 18446744073709551615

## See Also

GstFileSrc