avatar

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package avatar provides types and utilities for local avatar bundles.

An avatar bundle is an on-disk directory containing a metadata.json file and one or more idle clips. The bundle format is shared across all local render engines (liveportrait-joyvasa, echomimic, etc.).

Bundle structure:

~/.omniavatar/avatars/<name>/
    metadata.json        # bundle metadata (name, fps, resolution)
    idle/
        idle.mp4         # neutral, mouth-closed clip (MVP: one clip)
    references/          # optional still frames for image-driven engines
        front-neutral.png

Index

Constants

View Source
const BundlesDirEnvVar = "OMNIAVATAR_BUNDLES_DIR"

BundlesDirEnvVar is the environment variable to override the bundles directory.

View Source
const DefaultBundlesDir = "~/.omniavatar/avatars"

DefaultBundlesDir is the default location for avatar bundles. Can be overridden via OMNIAVATAR_BUNDLES_DIR environment variable.

Variables

View Source
var (
	ErrBundleNotFound   = errors.New("avatar bundle not found")
	ErrMetadataNotFound = errors.New("metadata.json not found in bundle")
	ErrNoIdleClips      = errors.New("no idle clips found in bundle")
	ErrInvalidMetadata  = errors.New("invalid metadata.json")
)

Errors returned by bundle operations.

Functions

func BundlesDir added in v0.4.0

func BundlesDir() string

BundlesDir returns the directory where avatar bundles are stored. Uses OMNIAVATAR_BUNDLES_DIR if set, otherwise DefaultBundlesDir.

func List added in v0.4.0

func List() ([]string, error)

List returns the names of all avatar bundles in the bundles directory.

func ListFrom added in v0.4.0

func ListFrom(bundlesDir string) ([]string, error)

ListFrom returns the names of all avatar bundles in a specific directory.

Types

type Bundle added in v0.4.0

type Bundle struct {
	// Path is the absolute path to the bundle directory.
	Path string

	// Metadata is the parsed metadata.json.
	Metadata Metadata

	// IdleClips is the list of idle clip paths (relative to bundle).
	IdleClips []string

	// References is the list of reference image paths (relative to bundle).
	References []string
}

Bundle represents a loaded avatar bundle.

func Load added in v0.4.0

func Load(name string) (*Bundle, error)

Load loads an avatar bundle by name from the bundles directory.

func LoadFrom added in v0.4.0

func LoadFrom(bundlesDir, name string) (*Bundle, error)

LoadFrom loads an avatar bundle by name from a specific directory.

func (*Bundle) PrimaryIdleClip added in v0.4.0

func (b *Bundle) PrimaryIdleClip() string

PrimaryIdleClip returns the path to the primary idle clip.

func (*Bundle) PrimaryReference added in v0.4.0

func (b *Bundle) PrimaryReference() string

PrimaryReference returns the path to the primary reference image, if any.

type Metadata added in v0.4.0

type Metadata struct {
	// Name is the bundle identifier (matches the directory name).
	Name string `json:"name"`

	// Description is an optional human-readable description.
	Description string `json:"description,omitempty"`

	// FPS is the frame rate of the idle clips. Default: 25.
	FPS int `json:"fps,omitempty"`

	// Resolution is the output dimensions. Default: 512x512.
	Resolution Resolution `json:"resolution,omitempty"`

	// Created is the creation date (informational).
	Created string `json:"created,omitempty"`

	// CaptureGuidance is a reference to capture instructions.
	CaptureGuidance string `json:"capture_guidance,omitempty"`
}

Metadata contains the avatar bundle's metadata.json contents.

type Resolution added in v0.4.0

type Resolution struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

Resolution specifies the dimensions of the avatar output.

Jump to

Keyboard shortcuts

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