Documentation
¶
Index ¶
- Constants
- func F(v float64) *float64
- type AnimatedColor
- type AnimatedPosition
- type Animation
- type Audio
- func (a *Audio) BassBoost(gain float64) (*Audio, error)
- func (a *Audio) BitRate(bitRate uint64) *Audio
- func (a *Audio) Bps(bps uint) *Audio
- func (a *Audio) Channels(channels uint8) *Audio
- func (a *Audio) Codec(codec string) *Audio
- func (a *Audio) Duration(duration float64) *Audio
- func (a *Audio) Echo(delay, decay float64) (*Audio, error)
- func (a *Audio) FadeIn(duration float64) (*Audio, error)
- func (a *Audio) FadeOut(duration float64) (*Audio, error)
- func (a *Audio) GetBitRate() uint64
- func (a *Audio) GetBps() uint
- func (a *Audio) GetChannels() uint8
- func (a *Audio) GetCodec() string
- func (a *Audio) GetDuration() float64
- func (a *Audio) GetFilenames() []string
- func (a *Audio) GetSampleRate() uint64
- func (a *Audio) HighPass(freq float64) (*Audio, error)
- func (a *Audio) LowPass(freq float64) (*Audio, error)
- func (a *Audio) MuteRanges(ranges []TimeRange) (*Audio, error)
- func (a *Audio) Normalize() (*Audio, error)
- func (a *Audio) SampleRate(sampleRate uint64) *Audio
- func (a *Audio) SetFilename(filenames []string) *Audio
- func (a *Audio) Tempo(tempo float64) (*Audio, error)
- func (a *Audio) TrebleBoost(gain float64) (*Audio, error)
- func (a *Audio) Volume(volume float64) (*Audio, error)
- func (a *Audio) Write(parms AudioParameters) error
- type AudioCodec
- type AudioParameters
- type Background
- type Clip
- type Codec
- type CropParams
- type Curve
- type EqParams
- type FileCopy
- type FilterComplex
- type HueParams
- type ImageClip
- func (ic *ImageClip) Duration(d float64) *ImageClip
- func (ic *ImageClip) GetDuration() float64
- func (ic *ImageClip) GetFilename() string
- func (ic *ImageClip) GetHeight() uint64
- func (ic *ImageClip) GetPosition() Position
- func (ic *ImageClip) GetWidth() uint64
- func (ic *ImageClip) SetAnimatedOpacity(a Animation) *ImageClip
- func (ic *ImageClip) SetAnimatedPosition(ap AnimatedPosition) *ImageClip
- func (ic *ImageClip) SetPosition(position Position) *ImageClip
- type Layout
- type Oscillation
- type PadParams
- type PixelFormat
- type Position
- type Progress
- type ScaleParams
- type Shadow
- type Stroke
- type TextClip
- type TextExpansion
- type TimeRange
- type Transition
- type TransitionParams
- type TypewriterParams
- type Video
- func CompositeClip(videos []Video) (*Video, error)
- func Concatenate(videos []Video) (*Video, error)
- func ConcatenateWithTransition(clip1, clip2 *Video, params TransitionParams) (*Video, error)
- func HStack(videos []Video) (*Video, error)
- func NewVideoFile(filename string) (*Video, error)
- func VStack(videos []Video) (*Video, error)
- func XStack(videos []Video, layout string) (*Video, error)
- func (v *Video) AddText(clip TextClip) (*Video, error)
- func (v *Video) AddTexts(clips []*TextClip) (*Video, error)
- func (v *Video) AnimatedBlur(a Animation) (*Video, error)
- func (v *Video) AnimatedColor(ac AnimatedColor) (*Video, error)
- func (v *Video) AnimatedRotate(a Animation) (*Video, error)
- func (v *Video) AnimatedScale(a Animation) (*Video, error)
- func (v *Video) BitRate(bitRate string) *Video
- func (v *Video) Blur(sigma float64) (*Video, error)
- func (v *Video) Brightness(brightness float64) (*Video, error)
- func (v *Video) Codec(codec Codec) *Video
- func (v *Video) Contrast(contrast float64) (*Video, error)
- func (v *Video) Crop(params CropParams) (*Video, error)
- func (v *Video) Cut(start, end float64) (*Video, error)
- func (v *Video) Duration(duration float64) *Video
- func (v *Video) Eq(params EqParams) (*Video, error)
- func (v *Video) FadeIn(duration float64) (*Video, error)
- func (v *Video) FadeOut(duration float64) (*Video, error)
- func (v *Video) FfmpegArgs(ffmpegArgs map[string][]string) *Video
- func (v *Video) GetAudio() *Audio
- func (v *Video) GetBitRate() string
- func (v *Video) GetCodec() string
- func (v *Video) GetDuration() float64
- func (v *Video) GetEndTime() float64
- func (v *Video) GetFfmpegArgs() map[string][]string
- func (v *Video) GetFilenames() []string
- func (v *Video) GetFps() uint64
- func (v *Video) GetFrames() int64
- func (v *Video) GetHeight() uint64
- func (v *Video) GetIsTemp() bool
- func (v *Video) GetPixelFormat() PixelFormat
- func (v *Video) GetPosition() Position
- func (v *Video) GetPreset() preset
- func (v *Video) GetStartTime() float64
- func (v *Video) GetWidth() uint64
- func (v *Video) GetWithMask() bool
- func (v *Video) Grayscale() (*Video, error)
- func (v *Video) HasAudio() bool
- func (v *Video) Height(height uint64) *Video
- func (v *Video) HorizontalFlip() (*Video, error)
- func (v *Video) Hue(params HueParams) (*Video, error)
- func (v *Video) Negate() (*Video, error)
- func (v *Video) Pad(params PadParams) (*Video, error)
- func (v *Video) PixelFormat(pixelFormat PixelFormat) *Video
- func (v *Video) Preset(p preset) *Video
- func (v *Video) Pulse(o Oscillation) (*Video, error)
- func (v *Video) Rotate(angle float64) (*Video, error)
- func (v *Video) Saturation(saturation float64) (*Video, error)
- func (v *Video) Scale(params ScaleParams) (*Video, error)
- func (v *Video) ScaleRatio(ratio float64) (*Video, error)
- func (v *Video) Sepia() (*Video, error)
- func (v *Video) SetAnimatedOpacity(a Animation) *Video
- func (v *Video) SetAnimatedPosition(ap AnimatedPosition) *Video
- func (v *Video) SetAudio(audio Audio) *Video
- func (v *Video) SetEndTime(endTime float64) *Video
- func (v *Video) SetFilename(filenames []string) *Video
- func (v *Video) SetFps(fps uint64) *Video
- func (v *Video) SetFrames(frames uint64) *Video
- func (v *Video) SetIsTemp(isTemp bool) *Video
- func (v *Video) SetPosition(position Position) *Video
- func (v *Video) SetStartTime(startTime float64) *Video
- func (v *Video) Shake(o Oscillation) (*Video, error)
- func (v *Video) Sharpen(amount float64) (*Video, error)
- func (v *Video) Speed(speed float64, pitch ...float64) (*Video, error)
- func (v *Video) VerticalFlip() (*Video, error)
- func (v *Video) Vignette(angle float64) (*Video, error)
- func (v *Video) Width(width uint64) *Video
- func (v *Video) Wiggle(o Oscillation) (*Video, error)
- func (v *Video) WithMask(withMask bool) *Video
- func (v *Video) WriteAudio(parms AudioParameters) error
- func (v *Video) WriteVideo(parms VideoParameters) error
- func (v *Video) ZoomPan(params ZoomPanParams) (*Video, error)
- type VideoParameters
- type ZoomPanParams
Constants ¶
const ( // Software encoder presets (libx264, libx265, etc.) UltraFast preset = "ultrafast" SuperFast preset = "superfast" VeryFast preset = "veryfast" Fast preset = "fast" Medium preset = "medium" Slow preset = "slow" VerySlow preset = "veryslow" Placebo preset = "placebo" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnimatedColor ¶
type AnimatedColor struct {
Brightness *Animation // -1 to 1
Contrast *Animation // -1000 to 1000
Saturation *Animation // 0 to 3
Hue *Animation // degrees
}
AnimatedColor animates color properties over time. Nil fields are not animated.
type AnimatedPosition ¶
type AnimatedPosition struct {
Start Position
End Position
StartTime float64
EndTime float64
Curve Curve
}
AnimatedPosition interpolates a position from Start to End.
func (AnimatedPosition) ToExprXForTest ¶
func (ap AnimatedPosition) ToExprXForTest(timeVar string) string
ToExprXForTest returns the X expression for testing.
func (AnimatedPosition) ToExprYForTest ¶
func (ap AnimatedPosition) ToExprYForTest(timeVar string) string
ToExprYForTest returns the Y expression for testing.
type Animation ¶
Animation interpolates a single float from Start to End over a time range.
func (Animation) ToExprForTest ¶
ToExprForTest returns the FFmpeg expression for testing.
type Audio ¶
type Audio struct {
// contains filtered or unexported fields
}
func AudioFile ¶
AudioFile probes an audio file using ffprobe and returns an Audio with its metadata populated (codec, sample rate, channels, bit rate, duration).
func Composite ¶
Composite mixes multiple audio tracks together. Audio from all sources is mixed using amix.
func (*Audio) Echo ¶
Echo applies an echo effect. delay: delay in milliseconds, decay: decay amount (0-1).
func (*Audio) GetBitRate ¶
func (*Audio) GetChannels ¶
func (*Audio) GetDuration ¶
func (*Audio) GetFilenames ¶
func (*Audio) GetSampleRate ¶
func (*Audio) MuteRanges ¶
MuteRanges mutes audio only during the specified time ranges. Uses FFmpeg's volume filter with enable='between(t,s1,e1)+between(t,s2,e2)+...'. If ranges is empty, returns the audio unchanged.
func (*Audio) SampleRate ¶
func (*Audio) SetFilename ¶
func (*Audio) Tempo ¶
Tempo changes the audio tempo without changing pitch. Supported range: 0.5 to 100.0.
func (*Audio) TrebleBoost ¶
TrebleBoost boosts the treble frequencies.
func (*Audio) Write ¶
func (a *Audio) Write(parms AudioParameters) error
Write processes the audio with applied filters and writes to output file
type AudioCodec ¶
type AudioCodec string
const ( AudioCodecAAC AudioCodec = "aac" AudioCodecMP3 AudioCodec = "libmp3lame" AudioCodecFLAC AudioCodec = "flac" AudioCodecOpus AudioCodec = "libopus" AudioCodecVorbis AudioCodec = "libvorbis" AudioCodecPCM AudioCodec = "pcm_s16le" )
type AudioParameters ¶
type AudioParameters struct {
OutputPath string
Threads uint16
Codec AudioCodec
SampleRate uint64
Channels uint8
Bitrate uint64
// SilentProgress disables the default colored progress bar.
SilentProgress bool
// OnProgress, when set, replaces the default colored progress bar.
OnProgress func(Progress)
}
AudioParameters holds configuration for audio processing.
type Background ¶
type Background struct {
Enabled bool // show background box
Color string // box fill color, e.g. "black@0.5" (default: "white")
Padding string // padding inside box: "10" or per-side "10|20|30|40"
Width int // explicit box width (0 = auto-fit text)
Height int // explicit box height (0 = auto-fit text)
}
Background controls the box drawn behind text.
type Clip ¶
type Clip interface {
GetWidth() uint64
GetHeight() uint64
GetDuration() float64
GetPosition() Position
}
Clip is the shared interface for visual clip types (Video and ImageClip). Audio intentionally does not implement this interface since it has no visual dimensions.
type Codec ¶
type Codec string
const ( // H.264/AVC codecs CodecH264 Codec = "h264" CodecLibx264 Codec = "libx264" CodecH264Auto Codec = "h264_auto" CodecH264Nvenc Codec = "h264_nvenc" CodecH264Qsv Codec = "h264_qsv" CodecH264Amf Codec = "h264_amf" CodecH264Vt Codec = "h264_videotoolbox" // H.265/HEVC codecs CodecH265 Codec = "h265" CodecHevc Codec = "hevc" CodecLibx265 Codec = "libx265" CodecHevcNvenc Codec = "hevc_nvenc" CodecHevcQsv Codec = "hevc_qsv" CodecHevcAmf Codec = "hevc_amf" CodecHevcVt Codec = "hevc_videotoolbox" // VP8/VP9 codecs CodecVP8 Codec = "vp8" CodecVP9 Codec = "vp9" CodecLibvpx Codec = "libvpx" CodecLibvpxVP9 Codec = "libvpx-vp9" // AV1 codecs CodecAV1 Codec = "av1" CodecLibaomAV1 Codec = "libaom-av1" CodecLibsvtav1 Codec = "libsvtav1" CodecAV1Nvenc Codec = "av1_nvenc" CodecAV1Qsv Codec = "av1_qsv" // MPEG codecs CodecMpeg2video Codec = "mpeg2video" CodecMpeg4 Codec = "mpeg4" CodecMpeg1video Codec = "mpeg1video" // Other codecs CodecTheora Codec = "theora" CodecWmv1 Codec = "wmv1" CodecWmv2 Codec = "wmv2" CodecWmv3 Codec = "wmv3" CodecVc1 Codec = "vc1" CodecProres Codec = "prores" CodecProresKS Codec = "prores_ks" CodecDNxHD Codec = "dnxhd" CodecDNxHR Codec = "dnxhr" CodecHuffYUV Codec = "huffyuv" CodecFFV1 Codec = "ffv1" CodecUtvideo Codec = "utvideo" CodecMjpeg Codec = "mjpeg" CodecLibxvid Codec = "libxvid" )
type CropParams ¶
CropParams holds parameters for the crop filter.
type Curve ¶
type Curve int
Curve defines the interpolation curve between start and end values.
const ( Linear Curve = iota // Quadratic EaseIn EaseOut EaseInOut // Cubic CubicIn CubicOut CubicInOut // Quartic QuartIn QuartOut QuartInOut // Quintic QuintIn QuintOut QuintInOut // Sine SineIn SineOut SineInOut // Exponential ExpoIn ExpoOut ExpoInOut // Circular CircIn CircOut CircInOut // Back (overshoots then settles) BackIn BackOut BackInOut // Elastic (spring-like oscillation) ElasticIn ElasticOut ElasticInOut // Bounce (ball drop) BounceIn BounceOut BounceInOut // Spring (damped spring) Spring // Steps (discrete jumps) Steps )
type EqParams ¶
type EqParams struct {
Brightness *float64 // -1 to 1, default 0
Contrast *float64 // -1000 to 1000, default 1
Saturation *float64 // 0 to 3, default 1
Gamma *float64 // 0.1 to 10, default 1
}
EqParams holds parameters for the eq (equalizer) filter: brightness, contrast, saturation, gamma. Nil fields use ffmpeg defaults (brightness=0, contrast=1, saturation=1, gamma=1).
type FilterComplex ¶
type HueParams ¶
type HueParams struct {
Degrees *float64 // hue angle in degrees, default 0
Saturation *float64 // -10 to 10, default 1
}
HueParams holds parameters for the hue filter. Nil fields use ffmpeg defaults (degrees=0, saturation=1).
type ImageClip ¶
type ImageClip struct {
// contains filtered or unexported fields
}
ImageClip represents a still image used as a clip in compositions/timelines. It carries only image-relevant fields — no audio, codec, fps, or video filter chains.
func NewImageClip ¶
NewImageClip creates a new ImageClip with the given filename, dimensions, and duration.
func (*ImageClip) GetDuration ¶
GetDuration returns how long the image should be displayed.
func (*ImageClip) GetFilename ¶
GetFilename returns the image filename.
func (*ImageClip) GetPosition ¶
GetPosition returns the overlay position. Returns center position if none was explicitly set.
func (*ImageClip) SetAnimatedOpacity ¶
SetAnimatedOpacity sets the overlay opacity animation for CompositeClip.
func (*ImageClip) SetAnimatedPosition ¶
func (ic *ImageClip) SetAnimatedPosition(ap AnimatedPosition) *ImageClip
SetAnimatedPosition sets the overlay position animation for CompositeClip.
func (*ImageClip) SetPosition ¶
SetPosition sets the overlay position used by CompositeClip.
type Layout ¶
type Layout struct {
LineSpacing int // extra spacing between lines in pixels
TabSize int // tab character width in spaces (default: 4)
Align string // multi-line alignment: "L"/"C"/"R" + "T"/"M"/"B"
YAlign string // what y refers to: "text", "baseline", "font"
FixBounds bool // prevent text from going outside the video frame
}
Layout controls multi-line text arrangement.
type Oscillation ¶
type Oscillation struct {
Amplitude float64 // max displacement from center
Frequency float64 // cycles per second
StartTime float64
EndTime float64
Decay float64 // damping factor (0 = no decay, higher = fades faster)
}
Oscillation creates periodic motion (shake, wiggle, pulse).
func (Oscillation) ToExprForTest ¶
func (o Oscillation) ToExprForTest(timeVar string) string
ToExprForTest returns the oscillation expression for testing.
type PixelFormat ¶
type PixelFormat string
const ( PixelFormatRGBA PixelFormat = "rgba" PixelFormatRGB PixelFormat = "rgb" PixelFormatYUV420P PixelFormat = "yuv420p" PixelFormatYUVA420P PixelFormat = "yuva420p" PixelFormatYUV422P PixelFormat = "yuv422p" PixelFormatYUV444P PixelFormat = "yuv444p" )
type Position ¶
Position defines where a video is placed when used in a CompositeClip. X and Y are FFmpeg expressions (e.g. "(W-w)/2", "0", "100").
func CenterPosition ¶
func CenterPosition() Position
CenterPosition returns a position that centers the overlay on the background.
func TextBottomCenter ¶
func TextBottomCenter() Position
TextBottomCenter returns a position at the bottom center.
func TextBottomLeft ¶
func TextBottomLeft() Position
TextBottomLeft returns a position at the bottom-left corner.
func TextBottomRight ¶
func TextBottomRight() Position
TextBottomRight returns a position at the bottom-right corner.
func TextCenter ¶
func TextCenter() Position
TextCenter returns a position that centers the text on the video.
func TextTopCenter ¶
func TextTopCenter() Position
TextTopCenter returns a position at the top center.
func TextTopLeft ¶
func TextTopLeft() Position
TextTopLeft returns a position at the top-left corner with 10px margin.
func TextTopRight ¶
func TextTopRight() Position
TextTopRight returns a position at the top-right corner.
func TopLeftPosition ¶
func TopLeftPosition() Position
TopLeftPosition returns a position at the top-left corner.
type Progress ¶
type Progress struct {
// Percentage of encoding completed (0.0 – 100.0).
Percentage float64
// Current output timestamp in seconds.
OutTime float64
// Total expected duration in seconds.
TotalDuration float64
// Encoding speed relative to real-time (e.g. 1.5 means 1.5× real-time).
Speed float64
// Current encoding bitrate string (e.g. "1024.5kbits/s").
Bitrate string
// Current frame number being encoded.
Frame int64
// Frames per second the encoder is running at.
FPS float64
// Whether encoding has finished.
Done bool
// ElapsedSeconds is wall-clock time since encoding started (set by run loop).
ElapsedSeconds float64
// ExpectedTotalSeconds is estimated total time; ETA remaining = ExpectedTotalSeconds - ElapsedSeconds.
ExpectedTotalSeconds float64
}
Progress holds real-time encoding progress reported by FFmpeg.
type ScaleParams ¶
type ScaleParams struct {
Width int // pixels, use -1 to preserve aspect when Height set
Height int // pixels, use -1 to preserve aspect when Width set
}
ScaleParams holds parameters for the scale filter.
type Shadow ¶
type Shadow struct {
X int // horizontal offset (default: 0)
Y int // vertical offset (default: 0)
Color string // shadow color (default: "black")
}
Shadow controls the drop shadow behind text.
type Stroke ¶
type Stroke struct {
Width int // outline thickness in pixels (default: 0)
Color string // outline color (default: "black")
}
Stroke controls the outline/border around each glyph.
type TextClip ¶
type TextClip struct {
// Content
Text string // text string to draw (required if TextFile is empty)
TextFile string // path to text file (alternative to Text)
// Font -- FontFamily is auto-detected:
// ends with .ttf/.otf/.woff or contains path separator -> fontfile
// otherwise -> font family name via fontconfig
FontFamily string // e.g. "Arial", "Sans", or "/path/to/font.ttf"
FontSize int // font size in pixels (default: 24)
FontColor string // "white", "0xFF0000", "black@0.5" (default: "white")
// Position & Timing
Position Position // X, Y as FFmpeg drawtext expressions
StartTime float64 // when text appears in seconds (0 = from start)
EndTime float64 // when text disappears in seconds (0 = until end)
// Opacity
Opacity float64 // 0.0 (transparent) to 1.0 (opaque), default 1.0
// Appearance sub-structs
Background Background
Stroke Stroke
Shadow Shadow
Layout Layout
// Advanced
TextShaping bool // enable RTL/Arabic text shaping (default: true)
Expansion TextExpansion // text expansion mode (default: ExpansionNormal)
// Animations (if set, override static Position/Opacity)
AnimatePosition *AnimatedPosition // animated X,Y position
AnimateOpacity *Animation // animated alpha (0-1)
Typewriter *TypewriterParams // character-by-character reveal
}
TextClip represents a text overlay to be drawn on a video.
type TextExpansion ¶
type TextExpansion string
TextExpansion controls how text is expanded in the drawtext filter.
const ( ExpansionNone TextExpansion = "none" ExpansionNormal TextExpansion = "normal" )
type Transition ¶
type Transition string
Transition defines the type of crossfade between two clips.
const ( TransitionFade Transition = "fade" TransitionFadeBlack Transition = "fadeblack" TransitionFadeWhite Transition = "fadewhite" TransitionWipeLeft Transition = "wipeleft" TransitionWipeRight Transition = "wiperight" TransitionWipeUp Transition = "wipeup" TransitionWipeDown Transition = "wipedown" TransitionSlideLeft Transition = "slideleft" TransitionSlideRight Transition = "slideright" TransitionSlideUp Transition = "slideup" TransitionSlideDown Transition = "slidedown" TransitionCircleCrop Transition = "circlecrop" TransitionDissolve Transition = "dissolve" TransitionPixelize Transition = "pixelize" TransitionRadial Transition = "radial" TransitionZoomIn Transition = "zoomin" TransitionDiagTL Transition = "diagtl" TransitionDiagTR Transition = "diagtr" TransitionDiagBL Transition = "diagbl" TransitionDiagBR Transition = "diagbr" )
type TransitionParams ¶
type TransitionParams struct {
Transition Transition
Duration float64 // overlap duration in seconds
}
TransitionParams holds parameters for clip-to-clip transitions.
type TypewriterParams ¶
type TypewriterParams struct {
CharDelay float64 // seconds between each character appearing
StartTime float64 // when typing starts
Cursor string // cursor character (e.g. "|"), empty = no cursor
}
TypewriterParams configures the typewriter (character-by-character) effect.
type Video ¶
type Video struct {
// contains filtered or unexported fields
}
Video represents a video file with its properties and processing options
func CompositeClip ¶
CompositeClip overlays multiple videos on top of each other, similar to MoviePy's CompositeVideoClip. The first video is the background; each subsequent video is overlaid using its Position (defaults to center). Audio from all layers is mixed together with amix.
func Concatenate ¶
func ConcatenateWithTransition ¶
func ConcatenateWithTransition(clip1, clip2 *Video, params TransitionParams) (*Video, error)
ConcatenateWithTransition joins two clips with a transition effect. The transition overlaps the end of clip1 with the start of clip2.
func HStack ¶
HStack stacks videos horizontally from left to right. All input videos must have the same height before calling HStack.
func NewVideoFile ¶
func VStack ¶
VStack stacks videos vertically from top to bottom. All input videos must have the same width before calling VStack.
func XStack ¶
XStack stacks videos according to the provided FFmpeg xstack layout. Example layout: "0_0|w0_0|0_h0|w0_h0"
func (*Video) AnimatedBlur ¶
AnimatedBlur applies a time-based blur. Start/End are blur radius values (0 = sharp). Uses boxblur for expression support; radius is in pixels (uses floor for integer radius).
func (*Video) AnimatedColor ¶
func (v *Video) AnimatedColor(ac AnimatedColor) (*Video, error)
AnimatedColor applies time-based color adjustments. Nil fields are not animated.
func (*Video) AnimatedRotate ¶
AnimatedRotate applies a time-based rotation. Angle is in radians.
func (*Video) AnimatedScale ¶
AnimatedScale applies a time-based scale. Start/End are scale ratios (1.0 = 100%).
func (*Video) Blur ¶
Blur applies a Gaussian blur. Sigma controls blur strength (higher = more blur).
func (*Video) Brightness ¶
Brightness adjusts brightness (-1 to 1, 0 = no change).
func (*Video) Crop ¶
func (v *Video) Crop(params CropParams) (*Video, error)
Crop crops the video to the specified region.
func (*Video) Cut ¶
Cut creates a new video segment with specified start and end times (lazy operation) Parameters:
- start: Start time in seconds (must be >= 0)
- end: End time in seconds (must be > start and <= video duration)
Returns a new Video object with updated metadata (no file is created until WriteVideo is called)
func (*Video) FadeIn ¶
FadeIn applies a fade-in effect for the given duration (seconds) at the start.
func (*Video) FadeOut ¶
FadeOut applies a fade-out effect for the given duration (seconds) at the end.
func (*Video) FfmpegArgs ¶
FfmpegArgs sets custom FFmpeg arguments
func (*Video) GetDuration ¶
GetDuration returns the video duration
func (*Video) GetEndTime ¶
GetEndTime returns the end time for subclip
func (*Video) GetFfmpegArgs ¶
GetFfmpegArgs returns the custom FFmpeg arguments
func (*Video) GetFilenames ¶
GetFilenames returns the video filename
func (*Video) GetPixelFormat ¶
func (v *Video) GetPixelFormat() PixelFormat
GetPixelFormat returns the video pixel format
func (*Video) GetPosition ¶
GetPosition returns the overlay position. Returns center position if none was explicitly set.
func (*Video) GetStartTime ¶
GetStartTime returns the start time for subclip
func (*Video) GetWithMask ¶
GetWithMask returns whether the video has a mask
func (*Video) HorizontalFlip ¶
HorizontalFlip flips the video horizontally.
func (*Video) PixelFormat ¶
func (v *Video) PixelFormat(pixelFormat PixelFormat) *Video
PixelFormat sets the video pixel format
func (*Video) Pulse ¶
func (v *Video) Pulse(o Oscillation) (*Video, error)
Pulse applies a scale oscillation (zoom in/out effect).
func (*Video) Saturation ¶
Saturation adjusts color saturation (0-3, 1 = no change).
func (*Video) Scale ¶
func (v *Video) Scale(params ScaleParams) (*Video, error)
Scale resizes the video. Use -1 for width or height to preserve aspect ratio.
func (*Video) ScaleRatio ¶
ScaleRatio scales video by a ratio multiplier (e.g., 0.5 = half, 2.0 = double). Uses explicit dimensions from video metadata; ensures dimensions are even for codec compatibility.
func (*Video) SetAnimatedOpacity ¶
SetAnimatedOpacity sets the overlay opacity animation for CompositeClip.
func (*Video) SetAnimatedPosition ¶
func (v *Video) SetAnimatedPosition(ap AnimatedPosition) *Video
SetAnimatedPosition sets the overlay position animation for CompositeClip.
func (*Video) SetEndTime ¶
SetEndTime sets the end time for subclip
func (*Video) SetFilename ¶
SetFilename sets the video filename
func (*Video) SetPosition ¶
SetPosition sets the overlay position used by CompositeClip.
func (*Video) SetStartTime ¶
SetStartTime sets the start time for subclip
func (*Video) Shake ¶
func (v *Video) Shake(o Oscillation) (*Video, error)
Shake applies a position oscillation (camera shake effect).
func (*Video) Sharpen ¶
Sharpen applies an unsharp mask. Amount controls sharpening strength (1.0-5.0 typical).
func (*Video) Speed ¶
Speed changes playback speed for both video and audio. Parameters:
- speed: Playback speed multiplier (e.g. 2.0 = 2x faster, 0.5 = half speed)
- pitch: Optional. If omitted or 0 or 1, pitch is preserved. Otherwise a multiplier (e.g. 1.5 = higher, 0.5 = lower)
Returns a new Video object with updated metadata (no file is created until WriteVideo is called)
func (*Video) VerticalFlip ¶
VerticalFlip flips the video vertically.
func (*Video) Vignette ¶
Vignette applies a vignette (darkened corners) effect. Angle controls darkness (radians, PI/5 typical).
func (*Video) Wiggle ¶
func (v *Video) Wiggle(o Oscillation) (*Video, error)
Wiggle applies a rotation oscillation.
func (*Video) WriteAudio ¶
func (v *Video) WriteAudio(parms AudioParameters) error
func (*Video) WriteVideo ¶
func (v *Video) WriteVideo(parms VideoParameters) error
WriteVideo processes the video with applied filters and writes to output file
type VideoParameters ¶
type VideoParameters struct {
OutputPath string
Threads uint16
Codec Codec
Fps uint64
Preset preset
WithMask bool
Bitrate string
PixelFormat PixelFormat
// SilentProgress disables the default colored progress bar.
// Has no effect when OnProgress is set.
SilentProgress bool
// OnProgress, when set, replaces the default colored progress bar.
// Called periodically with encoding progress.
OnProgress func(Progress)
}
VideoParameters holds configuration for video processing.
By default every encode shows a colored progress bar on stderr. Set SilentProgress to true to suppress it, or set OnProgress to replace the built-in output with your own handler.
type ZoomPanParams ¶
type ZoomPanParams struct {
Zoom Animation
Pan AnimatedPosition
Duration float64
FPS int
}
ZoomPanParams holds parameters for the ZoomPan (Ken Burns) effect.