Update .gitignore to include log files and database journal files. Modify go.mod to update dependencies for go-sqlite3 and cloud.google.com/go/compute/metadata. Enhance Makefile to include logging options for manager and runner commands. Introduce new job token handling in auth package and implement database migration scripts. Refactor manager and runner components to improve job processing and metadata extraction. Add support for video preview in frontend components and enhance WebSocket management for channel subscriptions.
This commit is contained in:
71
internal/runner/encoding/encoder.go
Normal file
71
internal/runner/encoding/encoder.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// Package encoding handles video encoding with software encoders.
|
||||
package encoding
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// Encoder represents a video encoder.
|
||||
type Encoder interface {
|
||||
Name() string
|
||||
Codec() string
|
||||
Available() bool
|
||||
BuildCommand(config *EncodeConfig) *exec.Cmd
|
||||
}
|
||||
|
||||
// EncodeConfig holds configuration for video encoding.
|
||||
type EncodeConfig struct {
|
||||
InputPattern string // Input file pattern (e.g., "frame_%04d.exr")
|
||||
OutputPath string // Output file path
|
||||
StartFrame int // Starting frame number
|
||||
FrameRate float64 // Frame rate
|
||||
WorkDir string // Working directory
|
||||
UseAlpha bool // Whether to preserve alpha channel
|
||||
TwoPass bool // Whether to use 2-pass encoding
|
||||
SourceFormat string // Source format: "exr" or "png" (defaults to "exr")
|
||||
PreserveHDR bool // Whether to preserve HDR range for EXR (uses HLG with bt709 primaries)
|
||||
}
|
||||
|
||||
// Selector selects the software encoder.
|
||||
type Selector struct {
|
||||
h264Encoders []Encoder
|
||||
av1Encoders []Encoder
|
||||
vp9Encoders []Encoder
|
||||
}
|
||||
|
||||
// NewSelector creates a new encoder selector with software encoders.
|
||||
func NewSelector() *Selector {
|
||||
s := &Selector{}
|
||||
s.detectEncoders()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Selector) detectEncoders() {
|
||||
// Use software encoding only - reliable and avoids hardware-specific colorspace issues
|
||||
s.h264Encoders = []Encoder{
|
||||
&SoftwareEncoder{codec: "libx264"},
|
||||
}
|
||||
|
||||
s.av1Encoders = []Encoder{
|
||||
&SoftwareEncoder{codec: "libaom-av1"},
|
||||
}
|
||||
|
||||
s.vp9Encoders = []Encoder{
|
||||
&SoftwareEncoder{codec: "libvpx-vp9"},
|
||||
}
|
||||
}
|
||||
|
||||
// SelectH264 returns the software H.264 encoder.
|
||||
func (s *Selector) SelectH264() Encoder {
|
||||
return &SoftwareEncoder{codec: "libx264"}
|
||||
}
|
||||
|
||||
// SelectAV1 returns the software AV1 encoder.
|
||||
func (s *Selector) SelectAV1() Encoder {
|
||||
return &SoftwareEncoder{codec: "libaom-av1"}
|
||||
}
|
||||
|
||||
// SelectVP9 returns the software VP9 encoder.
|
||||
func (s *Selector) SelectVP9() Encoder {
|
||||
return &SoftwareEncoder{codec: "libvpx-vp9"}
|
||||
}
|
||||
Reference in New Issue
Block a user