Skip to content

🎥 Make videos programmatically with React

18.1 KB
Raw Blame
package lambda_go_sdk

type RemotionOptions struct {
	EnableCancellation             bool                   `json:"enableCancellation"`
	ServeUrl                       string                 `json:"serveUrl" validate:"required"`
	FunctionName                   string                 `json:"functionName" validate:"required"`
	RendererFunctionName           string                 `json:"rendererFunctionName"`
	Region                         string                 `json:"region" validate:"required"`
	InputProps                     interface{}            `json:"inputProps"`
	Composition                    string                 `json:"composition" validate:"required"`
	Codec                          string                 `json:"codec"`
	ImageFormat                    string                 `json:"imageFormat"`
	Crf                            int                    `json:"crf"`
	EnvVariables                   interface{}            `json:"envVariables"`
	Metadata                       interface{}            `json:"metadata"`
	JpegQuality                    int                    `json:"jpegQuality"`
	MaxRetries                     int                    `json:"maxRetries"`
	Privacy                        string                 `json:"privacy"`
	ColorSpace                     string                 `json:"colorSpace"`
	LogLevel                       string                 `json:"logLevel"`
	FrameRange                     interface{}            `json:"frameRange"`
	OutName                        interface{}            `json:"outName"`
	SeparateAudioTo                interface{}            `json:"separateAudioTo"`
	TimeoutInMilliseconds          int                    `json:"timeoutInMilliseconds"`
	ChromiumOptions                interface{}            `json:"chromiumOptions"`
	Scale                          int                    `json:"scale"`
	EveryNthFrame                  int                    `json:"everyNthFrame"`
	NumberOfGifLoops               int                    `json:"numberOfGifLoops"`
	ConcurrencyPerLambda           int                    `json:"concurrencyPerLambda"`
	Concurrency                    *int                   `json:"concurrency"`
	DownloadBehavior               map[string]interface{} `json:"downloadBehavior"`
	Muted                          bool                   `json:"muted"`
	PreferLossless                 bool                   `json:"preferLossless"`
	Overwrite                      bool                   `json:"overwrite"`
	ForcePathStyle                 bool                   `json:"forcePathStyle"`
	AudioBitrate                   interface{}            `json:"audioBitrate"`
	VideoBitrate                   interface{}            `json:"videoBitrate"`
	EncodingBufferSize             interface{}            `json:"encodingBufferSize"`
	EncodingMaxRate                interface{}            `json:"encodingMaxRate"`
	Webhook                        interface{}            `json:"webhook"`
	ForceHeight                    interface{}            `json:"forceHeight"`
	ForceFps                       interface{}            `json:"forceFps"`
	ForceDurationInFrames          interface{}            `json:"forceDurationInFrames"`
	OffthreadVideoCacheSizeInBytes interface{}            `json:"offthreadVideoCacheSizeInBytes"`
	MediaCacheSizeInBytes          interface{}            `json:"mediaCacheSizeInBytes"`
	OffthreadVideoThreads          interface{}            `json:"offthreadVideoThreads"`
	ForceWidth                     interface{}            `json:"forceWidth"`
	ApiKey                         interface{}            `json:"apiKey"`
	LicenseKey                     interface{}            `json:"licenseKey"`
	BucketName                     interface{}            `json:"bucketName"`
	AudioCodec                     interface{}            `json:"audioCodec"`
	StorageClass                   interface{}            `json:"storageClass"`
	ForceBucketName                string                 `json:"forceBucketName"`
	Gl                             string                 `json:"gl"`
	X264Preset                     interface{}            `json:"x264Preset"`
	GopSize                        *int                   `json:"gopSize"`
	DisableSharedMemoryCapture     bool                   `json:"disableSharedMemoryCapture"`
	DeleteAfter                    *string                `json:"deleteAfter"`
	IsProduction                   *bool                  `json:"isProduction"`
	SampleRate                     int                    `json:"sampleRate"`
}

// RenderFramesOptions configures a PNG or JPEG image sequence render.
type RenderFramesOptions struct {
	ServeUrl                       string                 `json:"serveUrl" validate:"required"`
	FunctionName                   string                 `json:"functionName" validate:"required"`
	Region                         string                 `json:"region" validate:"required"`
	Composition                    string                 `json:"composition" validate:"required"`
	InputProps                     interface{}            `json:"inputProps"`
	ImageFormat                    string                 `json:"imageFormat"`
	OutputPrefix                   interface{}            `json:"outputPrefix"`
	ImageSequencePattern           string                 `json:"imageSequencePattern"`
	JpegQuality                    *int                   `json:"jpegQuality"`
	FrameRange                     interface{}            `json:"frameRange"`
	FramesPerLambda                *int                   `json:"framesPerLambda"`
	Concurrency                    *int                   `json:"concurrency"`
	ConcurrencyPerLambda           int                    `json:"concurrencyPerLambda"`
	EveryNthFrame                  int                    `json:"everyNthFrame"`
	EnvVariables                   interface{}            `json:"envVariables"`
	Privacy                        string                 `json:"privacy"`
	ChromiumOptions                interface{}            `json:"chromiumOptions"`
	Scale                          float64                `json:"scale"`
	DownloadBehavior               map[string]interface{} `json:"downloadBehavior"`
	Overwrite                      bool                   `json:"overwrite"`
	MaxRetries                     *int                   `json:"maxRetries"`
	Webhook                        interface{}            `json:"webhook"`
	ForceWidth                     interface{}            `json:"forceWidth"`
	ForceHeight                    interface{}            `json:"forceHeight"`
	ForceFps                       interface{}            `json:"forceFps"`
	ForceDurationInFrames          interface{}            `json:"forceDurationInFrames"`
	RendererFunctionName           string                 `json:"rendererFunctionName"`
	ForceBucketName                string                 `json:"forceBucketName"`
	ForcePathStyle                 bool                   `json:"forcePathStyle"`
	StorageClass                   interface{}            `json:"storageClass"`
	IsProduction                   *bool                  `json:"isProduction"`
	LicenseKey                     interface{}            `json:"licenseKey"`
	LogLevel                       string                 `json:"logLevel"`
	TimeoutInMilliseconds          int                    `json:"timeoutInMilliseconds"`
	DeleteAfter                    *string                `json:"deleteAfter"`
	OffthreadVideoCacheSizeInBytes interface{}            `json:"offthreadVideoCacheSizeInBytes"`
	OffthreadVideoThreads          interface{}            `json:"offthreadVideoThreads"`
	MediaCacheSizeInBytes          interface{}            `json:"mediaCacheSizeInBytes"`
	EnableCancellation             bool                   `json:"enableCancellation"`
}

// ImageSequenceOutputPrefix selects a custom bucket or S3-compatible provider.
type ImageSequenceOutputPrefix struct {
	BucketName       string      `json:"bucketName"`
	KeyPrefix        string      `json:"keyPrefix"`
	S3OutputProvider interface{} `json:"s3OutputProvider"`
}

type renderInternalOptions struct {
	EnableCancellation             bool                   `json:"enableCancellation"`
	RendererFunctionName           *string                `json:"rendererFunctionName"`
	FramesPerLambda                *int                   `json:"framesPerLambda"`
	Composition                    string                 `json:"composition" validate:"required"`
	ServeUrl                       string                 `json:"serveUrl" validate:"required"`
	InputProps                     interface{}            `json:"inputProps"`
	Type                           string                 `json:"type,omitempty"`
	Output                         map[string]interface{} `json:"output"`
	Codec                          *string                `json:"codec"`
	ProResProfile                  interface{}            `json:"proResProfile"`
	PixelFormat                    interface{}            `json:"pixelFormat"`
	ImageFormat                    string                 `json:"imageFormat"`
	Crf                            *int                   `json:"crf"`
	EnvVariables                   interface{}            `json:"envVariables,omitempty"`
	Metadata                       interface{}            `json:"metadata,omitempty"`
	JpegQuality                    int                    `json:"jpegQuality"`
	MaxRetries                     int                    `json:"maxRetries"`
	Privacy                        string                 `json:"privacy"`
	ColorSpace                     *string                `json:"colorSpace"`
	LogLevel                       string                 `json:"logLevel"`
	FrameRange                     interface{}            `json:"frameRange"`
	OutName                        interface{}            `json:"outName"`
	SeparateAudioTo                interface{}            `json:"separateAudioTo"`
	TimeoutInMilliseconds          int                    `json:"timeoutInMilliseconds"`
	ChromiumOptions                interface{}            `json:"chromiumOptions"`
	Scale                          float64                `json:"scale"`
	EveryNthFrame                  int                    `json:"everyNthFrame"`
	NumberOfGifLoops               *int                   `json:"numberOfGifLoops,omitempty"`
	ConcurrencyPerLambda           int                    `json:"concurrencyPerLambda"`
	Concurrency                    *int                   `json:"concurrency"`
	DownloadBehavior               map[string]interface{} `json:"downloadBehavior"`
	Muted                          bool                   `json:"muted"`
	PreferLossless                 bool                   `json:"preferLossless"`
	ForcePathStyle                 bool                   `json:"forcePathStyle"`
	Version                        string                 `json:"version"`
	Overwrite                      bool                   `json:"overwrite"`
	AudioBitrate                   interface{}            `json:"audioBitrate"`
	VideoBitrate                   interface{}            `json:"videoBitrate"`
	EncodingBufferSize             interface{}            `json:"encodingBufferSize"`
	EncodingMaxRate                interface{}            `json:"encodingMaxRate"`
	Webhook                        interface{}            `json:"webhook"`
	OffthreadVideoCacheSizeInBytes interface{}            `json:"offthreadVideoCacheSizeInBytes"`
	MediaCacheSizeInBytes          interface{}            `json:"mediaCacheSizeInBytes"`
	OffthreadVideoThreads          interface{}            `json:"offthreadVideoThreads"`
	ForceHeight                    interface{}            `json:"forceHeight"`
	ForceWidth                     interface{}            `json:"forceWidth"`
	ForceFps                       interface{}            `json:"forceFps"`
	ForceDurationInFrames          interface{}            `json:"forceDurationInFrames"`
	ApiKey                         interface{}            `json:"apiKey,omitempty"`
	LicenseKey                     interface{}            `json:"licenseKey"`
	BucketName                     interface{}            `json:"bucketName"`
	AudioCodec                     interface{}            `json:"audioCodec"`
	StorageClass                   interface{}            `json:"storageClass"`
	ForceBucketName                string                 `json:"forceBucketName,omitempty"`
	Gl                             *string                `json:"gl,omitempty"`
	X264Preset                     interface{}            `json:"x264Preset"`
	GopSize                        *int                   `json:"gopSize"`
	DisableSharedMemoryCapture     bool                   `json:"disableSharedMemoryCapture"`
	DeleteAfter                    *string                `json:"deleteAfter"`
	IsProduction                   *bool                  `json:"isProduction"`
	SampleRate                     int                    `json:"sampleRate"`
}

type RawInvokeResponse struct {
	Body string `json:"body"`
	Type string `json:"type"`
}

type RemotionRenderResponse struct {
	BucketName string `json:"bucketName"`
	RenderId   string `json:"renderId"`
}

type RenderConfig struct {
	RenderId         string      `json:"renderId" validate:"required"`
	BucketName       string      `json:"bucketName" validate:"required"`
	LogLevel         string      `json:"logLevel"`
	FunctionName     string      `json:"functionName" validate:"required"`
	Region           string      `json:"region" validate:"required"`
	DeleteAfter      *string     `json:"deleteAfter"`
	S3OutputProvider interface{} `json:"s3OutputProvider"`
	ForcePathStyle   bool        `json:"forcePathStyle"`
}

type CancelRenderOnLambdaInput struct {
	RenderId       string `json:"renderId" validate:"required"`
	BucketName     string `json:"bucketName" validate:"required"`
	Region         string `json:"region" validate:"required"`
	ForcePathStyle bool   `json:"forcePathStyle"`
}

type renderProgressInternalConfig struct {
	RenderId   string `json:"renderId" validate:"required"`
	BucketName string `json:"bucketName" validate:"required"`
	Type       string `json:"type" validate:"required"`
	Version    string `json:"version" validate:"required"`
	LogLevel   string `json:"logLevel" validate:"required"`
}

type FileNameAndSize struct {
	Name string `json:"name"`
	Size int    `json:"size"`
}

type TmpDir struct {
	Files []FileNameAndSize `json:"files"`
	Total int               `json:"total"`
}

type FunctionErrorInfo struct {
	Type          string  `json:"type"`
	Message       string  `json:"message"`
	Name          string  `json:"name"`
	Stack         string  `json:"stack"`
	Frame         *int    `json:"frame,omitempty"`
	Chunk         *int    `json:"chunk,omitempty"`
	IsFatal       bool    `json:"isFatal"`
	Attempt       int     `json:"attempt"`
	WillRetry     bool    `json:"willRetry"`
	TotalAttempts int     `json:"totalAttempts"`
	TmpDir        *TmpDir `json:"tmpDir,omitempty"`
}

type RenderProgress struct {
	OverallProgress          float64              `json:"overallProgress"`
	Chunks                   int                  `json:"chunks"`
	Done                     bool                 `json:"done"`
	EncodingStatus           *EncodingStatus      `json:"encodingStatus,omitempty"`
	Costs                    *Costs               `json:"costs,omitempty"`
	RenderId                 string               `json:"renderId"`
	RenderMetadata           *RenderMetadata      `json:"renderMetadata,omitempty"`
	OutputFile               *string              `json:"outputFile,omitempty"`
	SeparateAudio            *SeparateAudioOutput `json:"separateAudio"`
	OutputSequence           *ImageSequenceOutput `json:"outputSequence"`
	FramesUploaded           *int                 `json:"framesUploaded"`
	OutKey                   *string              `json:"outKey,omitempty"`
	TimeToFinish             *int                 `json:"timeToFinish,omitempty"`
	Errors                   []FunctionErrorInfo  `json:"errors,omitempty"`
	FatalErrorEncountered    bool                 `json:"fatalErrorEncountered"`
	CurrentTime              int64                `json:"currentTime"`
	RenderSize               int64                `json:"renderSize"`
	OutputSizeInBytes        *int64               `json:"outputSizeInBytes,omitempty"`
	LambdasInvoked           int                  `json:"lambdasInvoked"`
	FramesRendered           *int                 `json:"framesRendered,omitempty"`
	MostExpensiveFrameRanges []FrameRange         `json:"mostExpensiveFrameRanges,omitempty"`
}

type SeparateAudioOutput struct {
	Url         string `json:"url"`
	BucketName  string `json:"bucketName"`
	Key         string `json:"key"`
	SizeInBytes int64  `json:"sizeInBytes"`
}

type ImageSequenceOutput struct {
	BucketName  string `json:"bucketName"`
	KeyPrefix   string `json:"keyPrefix"`
	ManifestKey string `json:"manifestKey"`
	ManifestUrl string `json:"manifestUrl"`
	ImageFormat string `json:"imageFormat"`
	FrameCount  int    `json:"frameCount"`
}

type EncodingStatus struct {
	FramesEncoded int `json:"framesEncoded"`
}

type Costs struct {
	AccruedSoFar float64 `json:"accruedSoFar"`
	Currency     string  `json:"currency"`
	DisplayCost  string  `json:"displayCost"`
	Disclaimer   string  `json:"disclaimer"`
}

type RenderMetadata struct {
	TotalFrames                      int    `json:"totalFrames"`
	StartedDate                      int64  `json:"startedDate"`
	TotalChunks                      int    `json:"totalChunks"`
	EstimatedTotalLambdaInvokations  int    `json:"estimatedTotalLambdaInvokations"`
	EstimatedRenderLambdaInvokations int    `json:"estimatedRenderLambdaInvokations"`
	CompositionId                    string `json:"compositionId"`
	Codec                            string `json:"codec"`
	Bucket                           string `json:"bucket"`
}

type FrameRange struct {
	Chunk              int    `json:"chunk"`
	TimeInMilliseconds int    `json:"timeInMilliseconds"`
	FrameRange         [2]int `json:"frameRange"`
}

// SerializedInputProps is the serialized form of inputProps sent to the Lambda
// function. When the props fit inline, Type is "payload" and Payload holds the
// JSON string. When the props exceed the inline limit they are uploaded to S3,
// Type is "bucket-url", and Hash/BucketName point to the uploaded object.
type SerializedInputProps struct {
	Type       string `json:"type"`
	Payload    string `json:"payload,omitempty"`
	Hash       string `json:"hash,omitempty"`
	BucketName string `json:"bucketName,omitempty"`
}

// PayloadData is kept as an alias for backwards compatibility.
type PayloadData = SerializedInputProps