# hlssink2

HTTP Live Streaming sink/server. Unlike the old hlssink which took a muxed MPEG-TS stream as input, this element takes elementary audio and video streams as input and handles the muxing internally. This allows hlssink2 to make better decisions as to when to start a new fragment and also works better with input streams where there isn't an encoder element upstream that can generate keyframes on demand as needed.

This element only writes fragments and a playlist file into a specified directory, it does not contain an actual HTTP server to serve these files. Just point an external webserver to the directory with the playlist and fragment files.

## Example launch line

     gst-launch-1.0 videotestsrc is-live=true ! x264enc ! h264parse ! hlssink2 max-files=5

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBin
                        ╰──hlssink2

## Implemented interfaces

    GstChildProxy

## Factory details

Authors: – Alessandro Decina <alessandro.d@gmail.com>, Sebastian Dröge <sebastian@centricular.com></sebastian@centricular.com></alessandro.d@gmail.com>

Classification: – `Sink/Muxer`

Rank – none

Plugin – hls

Package – GStreamer Bad Plug-ins

## Pad Templates

### `audio`

    ANY

Presence – request

Direction – sink

Object type – GstPad

### `video`

    ANY

Presence – request

Direction – sink

Object type – GstPad

## Signals

### delete-fragment

    delete_fragment_callback (GstElement * sink,
                              gchararray location,
                              gpointer udata)

    def delete_fragment_callback (sink, location, udata):
        #python callback for the 'delete-fragment' signal

    function delete_fragment_callback(sink: GstElement * sink, location: gchararray location, udata: gpointer udata): {
        // javascript callback for the 'delete-fragment' signal
    }

Requests deletion of an old fragment file that is not needed anymore.

Parameters:

`sink` –

the hlssink2

`location` –

Location for the fragment file to delete

`udata` –
No description available

Flags: Run Last

Since : 1.18

### get-fragment-stream

    GOutputStream *
    get_fragment_stream_callback (GstElement * sink,
                                  gchararray location,
                                  gpointer udata)

    def get_fragment_stream_callback (sink, location, udata):
        #python callback for the 'get-fragment-stream' signal

    function get_fragment_stream_callback(sink: GstElement * sink, location: gchararray location, udata: gpointer udata): {
        // javascript callback for the 'get-fragment-stream' signal
    }

Parameters:

`sink` –

the hlssink2

`location` –

Location for the fragment file

`udata` –
No description available
Returns (GOutputStream *) –

GOutputStream for writing the fragment file.

Flags: Run Last

Since : 1.18

### get-playlist-stream

    GOutputStream *
    get_playlist_stream_callback (GstElement * sink,
                                  gchararray location,
                                  gpointer udata)

    def get_playlist_stream_callback (sink, location, udata):
        #python callback for the 'get-playlist-stream' signal

    function get_playlist_stream_callback(sink: GstElement * sink, location: gchararray location, udata: gpointer udata): {
        // javascript callback for the 'get-playlist-stream' signal
    }

Parameters:

`sink` –

the hlssink2

`location` –

Location for the playlist file

`udata` –
No description available
Returns (GOutputStream *) –

GOutputStream for writing the playlist file.

Flags: Run Last

Since : 1.18

## Properties

### location

    “location” gchararray

Location of the file to write

Flags : Read / Write

Default value : segment%%05d.ts

### max-files

    “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 : 10

### playlist-length

    “playlist-length” guint

Length of HLS playlist. To allow players to conform to section 6.3.3 of the HLS specification, this should be at least 3. If set to 0, the playlist will be infinite.

Flags : Read / Write

Default value : 5

### playlist-location

    “playlist-location” gchararray

Location of the playlist to write

Flags : Read / Write

Default value : playlist.m3u8

### playlist-root

    “playlist-root” gchararray

Location of the playlist to write

Flags : Read / Write

Default value : NULL

### send-keyframe-requests

    “send-keyframe-requests” gboolean

Send keyframe requests to ensure correct fragmentation. If this is disabled then the input must have keyframes in regular intervals

Flags : Read / Write

Default value : true

### target-duration

    “target-duration” guint

The target duration in seconds of a segment/file. (0 - disabled, useful for management of segment duration by the streaming server)

Flags : Read / Write

Default value : 15

The results of the search are