smacker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SignatureSMK2 = 0x324B4D53 // "SMK2" as little-endian uint32
	SignatureSMK4 = 0x344B4D53 // "SMK4" as little-endian uint32
	HeaderSize    = 104        // Minimum header size
)

Smacker file header constants

Variables

This section is empty.

Functions

func ConvertFromMP4

func ConvertFromMP4(mp4Path, smkPath string) error

ConvertFromMP4 converts an MP4 file to Smacker format using FFmpeg

func ConvertToMP4

func ConvertToMP4(smkPath, mp4Path string) error

ConvertToMP4 converts a Smacker video file to MP4 using FFmpeg This is a practical implementation using FFmpeg as it has native Smacker support

func FFmpegAvailable

func FFmpegAvailable() bool

FFmpegAvailable reports whether an ffmpeg binary is on the PATH.

func StreamToMP4

func StreamToMP4(smkPath string) (string, error)

StreamToMP4 converts a Smacker file to MP4 and returns the output path Useful for web streaming - converts on-demand

Types

type Header struct {
	Signature    uint32 // Should be "SMK2" or "SMK4"
	Width        uint32
	Height       uint32
	Frames       uint32
	FrameRate    int32 // Microseconds per frame (negative = frames per second)
	Flags        uint32
	AudioSize    [7]uint32
	TreesSize    uint32
	MMapSize     uint32
	MClrSize     uint32
	FullSize     uint32
	TypeSize     uint32
	AudioRate    [7]uint32
	AudioFlags   [7]uint32 // Lower 2 bytes: format, upper: channels
	FrameSizes   []uint32  // Array of frame sizes
	FrameTypes   []byte    // Array of frame types
	HuffmanTrees []byte    // Huffman trees data
	RingFrame    uint32
}

Header represents a Smacker video file header

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader wraps a Smacker video file for reading

func OpenReader

func OpenReader(path string) (*Reader, error)

OpenReader opens a Smacker video file for reading

func (*Reader) Close

func (r *Reader) Close() error

Close closes the reader

func (*Reader) Duration

func (r *Reader) Duration() float64

Duration returns video duration in seconds

func (*Reader) FrameCount

func (r *Reader) FrameCount() int

FrameCount returns total number of frames

func (*Reader) FrameRate

func (r *Reader) FrameRate() float64

FrameRate returns frames per second

func (*Reader) HasAudio

func (r *Reader) HasAudio() bool

HasAudio returns true if the video has any audio tracks

func (*Reader) Header

func (r *Reader) Header() *Header

Header returns the video header

func (*Reader) Height

func (r *Reader) Height() int

Height returns video height

func (*Reader) Info

func (r *Reader) Info() string

Info returns a formatted string with video information

func (*Reader) SignatureString

func (r *Reader) SignatureString() string

SignatureString returns the four-character signature ("SMK2" or "SMK4").

func (*Reader) Width

func (r *Reader) Width() int

Width returns video width

Jump to

Keyboard shortcuts

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