GizStack
View .mdOpen in ChatGPTOpen in Claude

gizlang:mp4

MP4 files (ISO/IEC 14496-12 and 14496-14) of a video track (H.264, HEVC or AV1) and an AAC-LC track (ISO/IEC 14496-3). A browser plays the file as it arrives: the index (moov) comes before the samples.

gizlang
import * as Mp4 from "gizlang:mp4";

Types

Track

gizlang
type Track = { codec: string; width: i64; height: i64; fps: i64; headers: Vec<bytes>; frames: Vec<bytes>; keys: Vec<bool>; }

A video track: its codec ("h264", "hevc" or "av1"), size, frames a second, parameter sets, and frames with their key flags.

  • codec: string
  • width: i64
  • height: i64
  • fps: i64
  • headers: Vec<bytes>
  • frames: Vec<bytes>
  • keys: Vec<bool>

Aac

gizlang
type Aac = { rate: i64; channels: i64; config: bytes; frames: Vec<bytes>; delay: i64; samples: i64; }

An AAC-LC track: its rate, channels, AudioSpecificConfig, and raw frames of 1024 samples a channel. The first delay samples it decodes to are the encoder's priming, before the audio; samples is the audio's length.

  • rate: i64
  • channels: i64
  • config: bytes
  • frames: Vec<bytes>
  • delay: i64
  • samples: i64

Functions

mp4

gizlang
function mp4(video: Track, audio: Option<Aac>): bytes

The MP4 file of video and, when given, audio. The samples of each track are one chunk, the video's first.

Effects: fail.