Documentation
¶
Index ¶
- Constants
- func ConvertFromMP4(mp4Path, smkPath string) error
- func ConvertToMP4(smkPath, mp4Path string) error
- func FFmpegAvailable() bool
- func StreamToMP4(smkPath string) (string, error)
- type Header
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Duration() float64
- func (r *Reader) FrameCount() int
- func (r *Reader) FrameRate() float64
- func (r *Reader) HasAudio() bool
- func (r *Reader) Header() *Header
- func (r *Reader) Height() int
- func (r *Reader) Info() string
- func (r *Reader) SignatureString() string
- func (r *Reader) Width() int
Constants ¶
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 ¶
ConvertFromMP4 converts an MP4 file to Smacker format using FFmpeg
func ConvertToMP4 ¶
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 ¶
StreamToMP4 converts a Smacker file to MP4 and returns the output path Useful for web streaming - converts on-demand
Types ¶
type Header ¶
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 ¶
OpenReader opens a Smacker video file for reading
func (*Reader) FrameCount ¶
FrameCount returns total number of frames
func (*Reader) SignatureString ¶
SignatureString returns the four-character signature ("SMK2" or "SMK4").