# gssink

Write incoming data to a series of sequentially-named remote files on a Google Cloud Storage bucket.

The object-name 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 `GstGsSink` after writing each buffer.

The message's structure contains these fields:

- gchararray `filename`: the filename where the buffer was written.
- gchararray `date`: the date of the current buffer, NULL if no start date is provided.
- gint `index`: 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

    gst-launch-1.0 videotestsrc num-buffers=15 ! pngenc ! gssink
    object-name="mypath/myframes/frame%05d.png" bucket-name="mybucket"
    next-file=buffer post-messages=true

### Upload 15 png images into gs://mybucket/mypath/myframes/ where the file

names are frame00000.png, frame00001.png, ..., frame00014.png

    gst-launch-1.0 videotestsrc num-buffers=6 ! video/x-raw, framerate=2/1 !
    pngenc ! gssink start-date="2020-04-16T08:55:03Z"
    object-name="mypath/myframes/im_%s_%03d.png" bucket-name="mybucket"
    next-file=buffer post-messages=true

### Upload png 6 images into gs://mybucket/mypath/myframes/ where the file

names are im_2020-04-16T08:55:03Z_000.png, im_2020-04-16T08:55:03Z_001.png, im_2020-04-16T08:55:04Z_002.png, im_2020-04-16T08:55:04Z_003.png, im_2020-04-16T08:55:05Z_004.png, im_2020-04-16T08:55:05Z_005.png.

    gst-launch-1.0 filesrc location=some_video.mp4 ! gssink
    object-name="mypath/myvideos/video.mp4" bucket-name="mybucket" next-file=none

### Upload any stream as a single file into Google Cloud Storage. Similar as

filesink in this case. The file is then accessible from: gs://mybucket/mypath/myvideos/video.mp4

See also: gssrc

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseSink
                        ╰──gssink

## Factory details

Authors: – Julien Isorce <jisorce></jisorce>

Classification: – `Sink/File`

Rank – none

Plugin – gs

Package – GStreamer Bad Plug-ins

## Pad Templates

### `sink`

    ANY

Presence – always

Direction – sink

Object type – GstPad

## Properties

### bucket-name

    “bucket-name” gchararray

Name of the Google Cloud Storage bucket.

Flags : Read / Write

Default value : NULL

Since : 1.20

### index

    “index” gint

Index to use with location property to create file names.

Flags : Read / Write

Default value : 0

Since : 1.20

### next-file

    “next-file” Gs-sink-next *

A Gs-sink-next that specifies when to start a new file.

Flags : Read / Write

Default value : buffer (0)

Since : 1.20

### object-name

    “object-name” gchararray

Full path name of the remote file.

Flags : Read / Write

Default value : %%s_%%05d

Since : 1.20

### post-messages

    “post-messages” gboolean

Post a message on the GstBus for each file.

Flags : Read / Write

Default value : false

Since : 1.20

### service-account-email

    “service-account-email” gchararray

Service Account Email to use for credentials.

Flags : Read / Write

Default value : NULL

Since : 1.20

### start-date

    “start-date” gchararray

Start date in iso8601 format.

Flags : Read / Write

Default value : NULL

Since : 1.20

## Named constants

### Gs-sink-next

File splitting modes.

#### Members

`buffer` (0) – New file for each buffer
`Only one file, no next file` (1) – New file for each buffer

Since : 1.20

The results of the search are