Processing
Packet transforms, processors and muxers are processing modules. Azot owns the pipeline; each module is a single stage, so stages from different extensions compose.
Pipeline
After a download's track files are on disk, Azot runs:
- Processors selected per format/encoding/encryption conversion.
- Packet transforms selected by the user, in their configured order.
- Mux the track files into the output container.
- Validate module outputs, then commit them.
Every choice comes from Settings > Processing, where each stage defaults to Built-in.
Installing and updating extensions from repositories, URLs, archives and local folders is available on every plan. Selecting custom processing modules, including a muxer that wraps ffmpeg, requires Azot Pro. Extension actions and background listeners require Pro, even when the extension includes a provider. Services of extensions that are not built into Azot also require Pro; see Services and dependencies.
Below Pro, user-selected processing stages are inactive and Azot uses provider defaults and built-in processing. Saved selections remain available after an upgrade. Choosing a custom output container is also a Pro feature.
Choosing a stage
| Stage | Owns | Use for |
|---|---|---|
| Packet transform | Payload bytes of each encoded packet | Bitstream fixes |
| Processor | One track file | Format changes (ass to srt), wrapping a binary |
| Muxer | All track files and the output container | Writing the container |
A packet transform cannot change the format or break sync: Azot keeps the container, timing and codec configuration. Use a processor only when you need to own the file.
Packet transforms
import { EncodedPacket, definePacketTransform } from "azot";
definePacketTransform({
accepts: { kind: "video", codecs: ["hevc"] },
transform: (packet) => packet,
});Processors
import { defineProcessor } from "azot";
defineProcessor({
accepts: { mediaKind: "subtitle", formats: ["ass"] },
produces: { mediaKind: "subtitle", formats: ["srt"] },
async process({ input, output, onProgress }) {
await convertAssToSrt(input.path, output.path, onProgress);
},
});Muxers
import { defineMuxer } from "azot";
defineMuxer({
containers: ["mkv", "mp4"],
async mux({ tracks, output, trim, tags, chapters, attachments, releaseYear, onProgress }) {
await runMuxer(
{ tracks, output, trim, tags, chapters, attachments, releaseYear },
(seconds, duration) => onProgress?.({ completed: seconds, total: duration, unit: "seconds" }),
);
},
});releaseYear is the entry's year when metadata embedding is on. Write it under the container's year tag unless tags.date or a raw year tag is set.
Output metadata
resolve() may return tags, chapters and attachments with the resource. Azot copies them when resolve() returns.
Before muxing, Azot adds what the entry already says, unless the user turned it off in Settings > Metadata: the title (an episode's title, with the show as album), author as artist, description, pageUrl as comment, year, and the image at artworkUrl as front cover. It fetches the artwork through your provider's transport, so session cookies and headers apply. Your values win field by field, and a coverFront image in tags.images replaces the artwork. Supply only what the entry cannot express, such as an album, a genre or a better cover.
import { defineProvider } from "azot";
defineProvider<{ id: string }>()({
list: ({ url }) => [{ title: "Episode 1", artworkUrl: posterUrl(url), data: { id: url } }],
async resolve({ entry }) {
const playback = await fetchPlayback(entry.data.id);
return {
source: { url: playback.manifestUrl },
tags: { genre: "Animation" },
// Seconds on the presentation timeline; Azot clips them to a trim
chapters: playback.chapters.map(({ start, end, title }) => ({ start, end, title })),
// Fonts the ASS subtitle styles name, found by file name
attachments: await Promise.all(
playback.fonts.map(async (font) => ({
name: font.fileName,
mimeType: "font/ttf",
data: new Uint8Array(await (await fetch(font.url)).arrayBuffer()),
})),
),
};
},
});The built-in muxer writes what each container holds and logs what it leaves out:
| Container | Tags | Cover | Chapters | Attachments | ASS/SSA subtitles |
|---|---|---|---|---|---|
| MKV | Yes | Any image | Yes | Yes | Kept styled |
| MP4 | Yes | One JPEG or PNG front cover | Yes | No | Plain text |
| MP3 | Yes | JPEG or PNG pictures | No | No | No subtitles |
A muxer module receives the completed metadata in its request and must keep it or fail with UNSUPPORTED_INPUT.
Progress
Processors and muxers receive an optional onProgress callback. Report absolute values, { completed, total?, unit? } with unit one of bytes, seconds or items. Completion is the method resolving, not completed reaching total. Azot shows a percentage when total is known and may coalesce updates. Forward the callback explicitly when a service does the work.