Documentation ¶
Index ¶
- Variables
- type CustomOptions
- type FSConfig
- type FileOutputType
- type ImageBasic
- type ImageConfiguration
- type ImageProcessor
- type ImageVips
- type MediaConfig
- type MediaConfiguration
- type MediaJob
- type MediaProcessor
- type MediaType
- type VideoCodec
- type VideoConfiguration
- type VideoGoffmpeg
- type VideoGotranscoder
- type VideoProcessor
Constants ¶
This section is empty.
Variables ¶
var STARTEDLIBVIPS bool
Functions ¶
This section is empty.
Types ¶
type CustomOptions ¶
type CustomOptions struct { Pass *int `flag:"-pass"` PassLogFile *string `flag:"-passlogfile"` Crf *int `flag:"-crf"` // Work around bug with *uint32 in ffmpeg.Options CpuUsed *int `flag:"-cpu-used"` // Used with AV1 codec QScaleVideo *int `flag:"-qscale:v"` // Used for thumbnails }
TODO: Submit PR
func (CustomOptions) GetStrArguments ¶
func (opts CustomOptions) GetStrArguments() []string
type FSConfig ¶
type FSConfig struct { InputDir string OutputDir string MoveProcessed bool ProcessedDir string Watch bool Workers int DebugFilenames bool }
FSConfig contains the filesystem-related parameters used when processing media
type FileOutputType ¶
type FileOutputType string
FileOutputType is the file extension of the output media file. For images, this represents the image format. For videos, this represents the container format.
const ( JPG FileOutputType = "jpg" WebP FileOutputType = "webp" MP4 FileOutputType = "mp4" WebM FileOutputType = "webm" )
func (FileOutputType) GetMediaType ¶
func (f FileOutputType) GetMediaType() MediaType
GetMediaType returns the MediaType of a given FileOutputType
type ImageBasic ¶
type ImageBasic struct{}
ImageBasic is an ImageProcessor which uses a mix of Go image generation libraries
type ImageConfiguration ¶
type ImageConfiguration struct { MaxWidth int Quality int FileType FileOutputType }
ImageConfiguration describes output size, quality, and format for an output image file
func (*ImageConfiguration) OutputFileSuffix ¶
func (i *ImageConfiguration) OutputFileSuffix(debugFilename bool) string
func (*ImageConfiguration) Validate ¶
func (i *ImageConfiguration) Validate() error
type ImageProcessor ¶
ImageProcessor is an interface for types which can process images
type MediaConfig ¶
type MediaConfig struct { ImageConfigurations []*ImageConfiguration VideoConfigurations []*VideoConfiguration }
MediaConfig contains the image and video output parameters used when encoding media
type MediaConfiguration ¶
type MediaJob ¶
type MediaJob struct { MediaConfig *MediaConfig FSConfig *FSConfig S3Client *s3.S3Client InputFile *pixelio.InputFile MediaProcessor *MediaProcessor }
MediaJob represents an encoding job to perform, and contains types representing the target file, where the files should be written, encoding settings, and which processor to use.
func (*MediaJob) CheckOutputDir ¶
func (m *MediaJob) CheckOutputDir()
CheckOutputDir ensures that a job's output subdirectory exists
func (*MediaJob) OutputPath ¶
func (m *MediaJob) OutputPath(mediaConfiguration MediaConfiguration) string
OutputPath returns the full output path for a MediaJob with a specific MediaConfiguration e.g. output/subdir1/sunset-x100.jpg
func (*MediaJob) ProcessImage ¶
ProcessImage dispatches an image resize job to the configured ImageProcessor
func (*MediaJob) ProcessVideo ¶
ProcessVideo dispatchse a video resize job to the configured VideoProcessor
type MediaProcessor ¶
type MediaProcessor struct { Image ImageProcessor Video VideoProcessor }
func New ¶
func New() (mediaProcessor *MediaProcessor)
type MediaType ¶
type MediaType string
MediaType is the type of a piece of media - Image, Video, etc
type VideoCodec ¶
type VideoCodec string
VideoCodec represents the codec used to encode a video file, as part of a VideoConfiguration
const ( H264 VideoCodec = "h264" H265 VideoCodec = "h265" VP9 VideoCodec = "vp9" AV1 VideoCodec = "av1" )
func (VideoCodec) Validate ¶
func (c VideoCodec) Validate() error
type VideoConfiguration ¶
type VideoConfiguration struct { MaxWidth int Quality int Preset string FileType FileOutputType Codec VideoCodec }
VideoConfiguration describes output size, quality, format, and other information for an encoded output video file
func (*VideoConfiguration) OutputFileSuffix ¶
func (v *VideoConfiguration) OutputFileSuffix(debugFilename bool) string
func (*VideoConfiguration) Validate ¶
func (v *VideoConfiguration) Validate() error
Validate validates a VideoConfiguration
type VideoGoffmpeg ¶
type VideoGoffmpeg struct{}
VideoGoffmpeg is based on github.com/xfrr/goffmpeg. This library is fairly robust, but doesn't allow custom flags to be passed.
func (*VideoGoffmpeg) Thumbnail ¶
func (v *VideoGoffmpeg) Thumbnail(m *MediaJob, videoConfig *VideoConfiguration) (err error)
func (*VideoGoffmpeg) Transcode ¶
func (v *VideoGoffmpeg) Transcode(m *MediaJob, videoConfig *VideoConfiguration) (err error)
type VideoGotranscoder ¶
type VideoGotranscoder struct{}
VideoGotranscoder is based on github.com/floostack/transcoder. This library allows custom ffmpeg commands to be passed, which permits two-pass codecs such as VP9.
func (*VideoGotranscoder) Thumbnail ¶
func (v *VideoGotranscoder) Thumbnail(m *MediaJob, videoConfig *VideoConfiguration) (err error)
func (*VideoGotranscoder) Transcode ¶
func (v *VideoGotranscoder) Transcode(m *MediaJob, videoConfig *VideoConfiguration) (err error)
type VideoProcessor ¶
type VideoProcessor interface { Thumbnail(*MediaJob, *VideoConfiguration) error Transcode(*MediaJob, *VideoConfiguration) error }
VideoProcessor is an interface for types which can process videos