transcoder

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupOldContent

func CleanupOldContent(baseDirectory string)

CleanupOldContent will delete old files from the private dir that are no longer being referenced in the stream.

func GetCodecs

func GetCodecs(ffmpegPath string) []string

GetCodecs will return the supported codecs available on the system.

func StartThumbnailGenerator

func StartThumbnailGenerator(chunkPath string, variantIndex int)

StartThumbnailGenerator starts generating thumbnails.

func StopThumbnailGenerator

func StopThumbnailGenerator()

StopThumbnailGenerator will stop the periodic generating of a thumbnail from video.

Types

type Codec

type Codec interface {
	Name() string
	DisplayName() string
	GlobalFlags() string
	PixelFormat() string
	ExtraArguments() string
	ExtraFilters() string
	VariantFlags(v *HLSVariant) string
	GetPresetForLevel(l int) string
}

Codec represents a supported codec on the system.

type FileWriterReceiverService

type FileWriterReceiverService struct {
	// contains filtered or unexported fields
}

FileWriterReceiverService accepts transcoder responses via HTTP and fires the callbacks.

func (*FileWriterReceiverService) SetupFileWriterReceiverService

func (s *FileWriterReceiverService) SetupFileWriterReceiverService(callbacks FileWriterReceiverServiceCallback)

SetupFileWriterReceiverService will start listening for transcoder responses.

type FileWriterReceiverServiceCallback

type FileWriterReceiverServiceCallback interface {
	SegmentWritten(localFilePath string)
	VariantPlaylistWritten(localFilePath string)
	MasterPlaylistWritten(localFilePath string)
}

FileWriterReceiverServiceCallback are to be fired when transcoder responses are written to disk.

type HLSHandler

type HLSHandler struct {
	Storage models.StorageProvider
}

HLSHandler gets told about available HLS playlists and segments.

func (*HLSHandler) MasterPlaylistWritten

func (h *HLSHandler) MasterPlaylistWritten(localFilePath string)

MasterPlaylistWritten is fired when a HLS master playlist is written to disk.

func (*HLSHandler) SegmentWritten

func (h *HLSHandler) SegmentWritten(localFilePath string)

SegmentWritten is fired when a HLS segment is written to disk.

func (*HLSHandler) VariantPlaylistWritten

func (h *HLSHandler) VariantPlaylistWritten(localFilePath string)

VariantPlaylistWritten is fired when a HLS variant playlist is written to disk.

type HLSVariant

type HLSVariant struct {
	// contains filtered or unexported fields
}

HLSVariant is a combination of settings that results in a single HLS stream.

func (*HLSVariant) SetAudioBitrate

func (v *HLSVariant) SetAudioBitrate(bitrate string)

SetAudioBitrate will set the output framerate of this variant's audio.

func (*HLSVariant) SetCPUUsageLevel

func (v *HLSVariant) SetCPUUsageLevel(level int)

SetCPUUsageLevel will set the hardware usage of this variant.

func (*HLSVariant) SetVideoBitrate

func (v *HLSVariant) SetVideoBitrate(bitrate int)

SetVideoBitrate will set the output bitrate of this variant's video.

func (*HLSVariant) SetVideoFramerate

func (v *HLSVariant) SetVideoFramerate(framerate int)

SetVideoFramerate will set the output framerate of this variant's video.

func (*HLSVariant) SetVideoScalingHeight

func (v *HLSVariant) SetVideoScalingHeight(height int)

SetVideoScalingHeight will set the scaled video height of this variant.

func (*HLSVariant) SetVideoScalingWidth

func (v *HLSVariant) SetVideoScalingWidth(width int)

SetVideoScalingWidth will set the scaled video width of this variant.

type Libx264Codec

type Libx264Codec struct {
}

Libx264Codec represents an instance of the Libx264 Codec.

func (*Libx264Codec) DisplayName

func (c *Libx264Codec) DisplayName() string

DisplayName returns the human readable name of the codec.

func (*Libx264Codec) ExtraArguments

func (c *Libx264Codec) ExtraArguments() string

ExtraArguments are the extra arguments used with this codec in the transcoder.

func (*Libx264Codec) ExtraFilters

func (c *Libx264Codec) ExtraFilters() string

ExtraFilters are the extra filters required for this codec in the transcoder.

func (*Libx264Codec) GetPresetForLevel

func (c *Libx264Codec) GetPresetForLevel(l int) string

GetPresetForLevel returns the string preset for this codec given an integer level.

func (*Libx264Codec) GlobalFlags

func (c *Libx264Codec) GlobalFlags() string

GlobalFlags are the global flags used with this codec in the transcoder.

func (*Libx264Codec) Name

func (c *Libx264Codec) Name() string

Name returns the codec name.

func (*Libx264Codec) PixelFormat

func (c *Libx264Codec) PixelFormat() string

PixelFormat is the pixel format required for this codec.

func (*Libx264Codec) VariantFlags

func (c *Libx264Codec) VariantFlags(v *HLSVariant) string

VariantFlags returns a string representing a single variant processed by this codec.

type NvencCodec

type NvencCodec struct {
}

NvencCodec represents an instance of the Nvenc Codec.

func (*NvencCodec) DisplayName

func (c *NvencCodec) DisplayName() string

DisplayName returns the human readable name of the codec.

func (*NvencCodec) ExtraArguments

func (c *NvencCodec) ExtraArguments() string

ExtraArguments are the extra arguments used with this codec in the transcoder.

func (*NvencCodec) ExtraFilters

func (c *NvencCodec) ExtraFilters() string

ExtraFilters are the extra filters required for this codec in the transcoder.

func (*NvencCodec) GetPresetForLevel

func (c *NvencCodec) GetPresetForLevel(l int) string

GetPresetForLevel returns the string preset for this codec given an integer level.

func (*NvencCodec) GlobalFlags

func (c *NvencCodec) GlobalFlags() string

GlobalFlags are the global flags used with this codec in the transcoder.

func (*NvencCodec) Name

func (c *NvencCodec) Name() string

Name returns the codec name.

func (*NvencCodec) PixelFormat

func (c *NvencCodec) PixelFormat() string

PixelFormat is the pixel format required for this codec.

func (*NvencCodec) VariantFlags

func (c *NvencCodec) VariantFlags(v *HLSVariant) string

VariantFlags returns a string representing a single variant processed by this codec.

type OmxCodec

type OmxCodec struct {
}

OmxCodec represents an instance of the Omx codec.

func (*OmxCodec) DisplayName

func (c *OmxCodec) DisplayName() string

DisplayName returns the human readable name of the codec.

func (*OmxCodec) ExtraArguments

func (c *OmxCodec) ExtraArguments() string

ExtraArguments are the extra arguments used with this codec in the transcoder.

func (*OmxCodec) ExtraFilters

func (c *OmxCodec) ExtraFilters() string

ExtraFilters are the extra filters required for this codec in the transcoder.

func (*OmxCodec) GetPresetForLevel

func (c *OmxCodec) GetPresetForLevel(l int) string

GetPresetForLevel returns the string preset for this codec given an integer level.

func (*OmxCodec) GlobalFlags

func (c *OmxCodec) GlobalFlags() string

GlobalFlags are the global flags used with this codec in the transcoder.

func (*OmxCodec) Name

func (c *OmxCodec) Name() string

Name returns the codec name.

func (*OmxCodec) PixelFormat

func (c *OmxCodec) PixelFormat() string

PixelFormat is the pixel format required for this codec.

func (*OmxCodec) VariantFlags

func (c *OmxCodec) VariantFlags(v *HLSVariant) string

VariantFlags returns a string representing a single variant processed by this codec.

type QuicksyncCodec

type QuicksyncCodec struct {
}

QuicksyncCodec represents an instance of the Intel Quicksync Codec.

func (*QuicksyncCodec) DisplayName

func (c *QuicksyncCodec) DisplayName() string

DisplayName returns the human readable name of the codec.

func (*QuicksyncCodec) ExtraArguments

func (c *QuicksyncCodec) ExtraArguments() string

ExtraArguments are the extra arguments used with this codec in the transcoder.

func (*QuicksyncCodec) ExtraFilters

func (c *QuicksyncCodec) ExtraFilters() string

ExtraFilters are the extra filters required for this codec in the transcoder.

func (*QuicksyncCodec) GetPresetForLevel

func (c *QuicksyncCodec) GetPresetForLevel(l int) string

GetPresetForLevel returns the string preset for this codec given an integer level.

func (*QuicksyncCodec) GlobalFlags

func (c *QuicksyncCodec) GlobalFlags() string

GlobalFlags are the global flags used with this codec in the transcoder.

func (*QuicksyncCodec) Name

func (c *QuicksyncCodec) Name() string

Name returns the codec name.

func (*QuicksyncCodec) PixelFormat

func (c *QuicksyncCodec) PixelFormat() string

PixelFormat is the pixel format required for this codec.

func (*QuicksyncCodec) VariantFlags

func (c *QuicksyncCodec) VariantFlags(v *HLSVariant) string

VariantFlags returns a string representing a single variant processed by this codec.

type Transcoder

type Transcoder struct {
	TranscoderCompleted func(error)
	// contains filtered or unexported fields
}

Transcoder is a single instance of a video transcoder.

func NewTranscoder

func NewTranscoder() *Transcoder

NewTranscoder will return a new Transcoder, populated by the config.

func (*Transcoder) AddVariant

func (t *Transcoder) AddVariant(variant HLSVariant)

AddVariant adds a new HLS variant to include in the output.

func (*Transcoder) SetAppendToStream

func (t *Transcoder) SetAppendToStream(append bool)

SetAppendToStream enables appending to the HLS stream instead of overwriting.

func (*Transcoder) SetCodec

func (t *Transcoder) SetCodec(codecName string)

SetCodec will set the codec to be used for the transocder.

func (*Transcoder) SetIdentifier

func (t *Transcoder) SetIdentifier(output string)

SetIdentifier enables appending a unique identifier to segment file name.

func (*Transcoder) SetInput

func (t *Transcoder) SetInput(input string)

SetInput sets the input stream on the filesystem.

func (*Transcoder) SetInternalHTTPPort

func (t *Transcoder) SetInternalHTTPPort(port string)

SetInternalHTTPPort will set the port to be used for internal communication.

func (*Transcoder) SetOutputPath

func (t *Transcoder) SetOutputPath(output string)

SetOutputPath sets the root directory that should include playlists and video segments.

func (*Transcoder) SetStdin

func (t *Transcoder) SetStdin(rtmp *io.PipeReader)

SetStdin sets the Stdin of the ffmpeg command.

func (*Transcoder) Start

func (t *Transcoder) Start()

Start will execute the transcoding process with the settings previously set.

func (*Transcoder) Stop

func (t *Transcoder) Stop()

Stop will stop the transcoder and kill all processing.

type VaapiCodec

type VaapiCodec struct {
}

VaapiCodec represents an instance of the Vaapi codec.

func (*VaapiCodec) DisplayName

func (c *VaapiCodec) DisplayName() string

DisplayName returns the human readable name of the codec.

func (*VaapiCodec) ExtraArguments

func (c *VaapiCodec) ExtraArguments() string

ExtraArguments are the extra arguments used with this codec in the transcoder.

func (*VaapiCodec) ExtraFilters

func (c *VaapiCodec) ExtraFilters() string

ExtraFilters are the extra filters required for this codec in the transcoder.

func (*VaapiCodec) GetPresetForLevel

func (c *VaapiCodec) GetPresetForLevel(l int) string

GetPresetForLevel returns the string preset for this codec given an integer level.

func (*VaapiCodec) GlobalFlags

func (c *VaapiCodec) GlobalFlags() string

GlobalFlags are the global flags used with this codec in the transcoder.

func (*VaapiCodec) Name

func (c *VaapiCodec) Name() string

Name returns the codec name.

func (*VaapiCodec) PixelFormat

func (c *VaapiCodec) PixelFormat() string

PixelFormat is the pixel format required for this codec.

func (*VaapiCodec) VariantFlags

func (c *VaapiCodec) VariantFlags(v *HLSVariant) string

VariantFlags returns a string representing a single variant processed by this codec.

type Video4Linux

type Video4Linux struct{}

Video4Linux represents an instance of the V4L Codec.

func (*Video4Linux) DisplayName

func (c *Video4Linux) DisplayName() string

DisplayName returns the human readable name of the codec.

func (*Video4Linux) ExtraArguments

func (c *Video4Linux) ExtraArguments() string

ExtraArguments are the extra arguments used with this codec in the transcoder.

func (*Video4Linux) ExtraFilters

func (c *Video4Linux) ExtraFilters() string

ExtraFilters are the extra filters required for this codec in the transcoder.

func (*Video4Linux) GetPresetForLevel

func (c *Video4Linux) GetPresetForLevel(l int) string

GetPresetForLevel returns the string preset for this codec given an integer level.

func (*Video4Linux) GlobalFlags

func (c *Video4Linux) GlobalFlags() string

GlobalFlags are the global flags used with this codec in the transcoder.

func (*Video4Linux) Name

func (c *Video4Linux) Name() string

Name returns the codec name.

func (*Video4Linux) PixelFormat

func (c *Video4Linux) PixelFormat() string

PixelFormat is the pixel format required for this codec.

func (*Video4Linux) VariantFlags

func (c *Video4Linux) VariantFlags(v *HLSVariant) string

VariantFlags returns a string representing a single variant processed by this codec.

type VideoSize

type VideoSize struct {
	Width  int
	Height int
}

VideoSize is the scaled size of the video output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL