[package] name = "engine" version.workspace = true edition.workspace = true # No UI dependency here, ever: the engine must stay reusable across front-ends. [dependencies] # The two audio-only export formats. Pure Rust, both of them, which is the whole # reason they are the two: `hound` writes the RIFF header and the PCM, `flacenc` # encodes FLAC. No default features on flacenc -- its `par` (rayon), `log` and # `serde` are for its own command-line front-end, and this needs none of them. hound = "3.5.1" flacenc = { version = "0.5.1", default-features = false } libloading = "0.8" # `memfd_create`, `mmap` and `SCM_RIGHTS` -- the three things std has no door to # and the whole of what puts the video driver in another process # (`crate::hwproc`). Not a new crate tree: it was already in this workspace's # lock file, pulled in by half the dependencies here, so this line compiles # nothing that was not compiled before. libc = "0.2" # Still images, decoded once per placed clip (`decode::Still`). Pure Rust like # everything else here, and already in the app's tree (gpui pulls it), so this # costs the build nothing new. Exactly the formats `crate::is_image` admits: no # default features, which would drag in a dozen decoders nothing opens. image = { version = "0.25", default-features = false, features = [ "png", "jpeg", "webp", ] } mp4 = "0.14" # zlib, for the one Matroska `ContentEncodings` scheme that is not a byte off # the front of every block: mkvmerge compressed subtitle tracks with it for # years. No new crate tree and nothing new to compile -- `image` above already # pulls this exact version in through `png`, and it is the pure-Rust inflate the # rest of the ecosystem is built on. miniz_oxide = "0.8" # The software H.264 pair, and the only software decoder this project has for # any format. Pinned exactly, like `ruopus` and `oxideav-ac3` below, because a # decoder is a bit-exactness dependency -- and 0.9.1 is where that stopped being # a figure of speech. Measured 2026-08-12 against ffmpeg's own decode of a 1080p # High and a 720p Main clip, 750 pictures between them: 0.8 matched it # byte-for-byte on 26 of the 750 and drifted on the rest (worst 69.8 dB PSNR -- # invisible, but wrong); 0.9.1 matches on all 750. It is also 1.44x faster at it # (247 Mpx/s against 171 on the 1080p clip, single-threaded); software *encode* # is unchanged within noise, so this is a decode bump that the encoder came # along with. `default-features = false` is what keeps `asm` off: those are # vendored openh264 SIMD kernels that want `nasm` at build time, which this # project's no-install rule forbids, and the crate enables them by default. # # What that line does not turn off, and cannot: the facade asks for its three # sub-crates with *their* defaults, and `rusty_h264-common`'s default installs # `rusty_alloc` -- a pure-Rust mimalloc remake, MIT -- as the process-wide # `#[global_allocator]`, for the whole application rather than the codec. It was # faster on a synthetic 2M-allocation churn (0.104 s against glibc's 0.142 s) # and it crashed the editor: sustained scrubbing churns decode-worker threads, # and it segfaulted on a new thread's *first* allocation. `common` is therefore # vendored with that declaration removed (workspace root `[patch.crates-io]`), # which is the only way to decline it -- the codec itself is untouched and still # bit-exact. Frame-threaded decode arrived in 0.9 as well and # is opt-in through `RS_H264_FRAME_THREADS`, unset here -- the decode loop is # serial exactly as it was. rusty_h264 = { version = "=0.9.1", default-features = false } # Both halves of AAC, and the only crate here that is asked for both. The # *encoder*, so an mp4's sound can be a mix rather than a copy: an equalized (or # otherwise processed) lane has to be decoded, and what is decoded has to be # encoded again. The *decoder*, because symphonia's own refuses anything wider # than stereo outright (`aac/mod.rs:93`, "aac: aac too complex") and a 5.1 film # soundtrack in an mkv is exactly that -- this one hands 5.1 back already # reordered into FL, FR, FC, LFE, BL, BR, which is the order the downmix in # `audio` folds. Pure Rust with no C or FFI, Apache-2.0, same family as # `rusty_h264` above. Nothing else in the ecosystem encodes AAC without linking # Fraunhofer's C library, which this project's no-install rule forbids. Built # from `vendor/rusty_aac` -- see the patch table in the workspace manifest. rusty_aac = "0.5" # The MP3 encoder, so that format is a row a user can pick rather than a licence # note: pure Rust, Apache-2.0, CBR and VBR. The decoder side of mp3 is # symphonia's below -- an mp3 has always been importable here, and until this it # was the one format the editor could read and never write. rusty_mp3 = "0.6" # The Vorbis encoder, same family and the same reason as the three above: pure # Rust, Apache-2.0, no C and no FFI. It is the *first* permissively-licensed # pure-Rust Vorbis encoder -- `vorbis_rs` and `vorbis-encoder` are both bindings # to Xiph's C library, which this project's no-install rule forbids, and # `oxideav-vorbis` (whose own manifest calls itself an "orphan-rebuild scaffold") # ships encoder-side *bitstream writers* with no analysis stage at all: no psy # model, no floor fit, no residue quantiser, nothing that turns PCM into a # packet. This one does the whole pipeline. Its quirks are measured and worked # around in [`crate::export::write_ogg`] -- read that before touching this line. rusty_vorbis = "0.1.1" # The Opus decoder: pure Rust, MIT, no C and no FFI. # # `spectrograms` is not, as this line long claimed, "for its own analysis tools": # it is the crate's *FFT backend*, and it is default-on because CELT synthesis is # an N/4 complex FFT per block. Turned off -- which is what asking for `std` # alone did -- `celt/mdct.rs` falls back to an O(n²) DFT evaluated in f64, and a # 5.1 film soundtrack decodes at **0.95x realtime**: slower than playing it. # With the backend on, the same file decodes at **104x** (7.1: 0.93x -> 112x, # stereo: 10.4x -> 135x). The cost is fifteen pure-Rust crates (`spectrograms` -> # `realfft`/`rustfft`, `ndarray`, `regex`), still no C and no `build.rs`. # The output is *not* bit-identical to the DFT build -- FFT summation order # differs -- but the two agree to 144 dB SNR (max |Δ| 3.7e-8, half an LSB at # 24-bit) while *both* sit 93 dB from ffmpeg's own libopus decode of the same # file. The change is 40 dB below the decoder's existing distance to the # reference, i.e. inside float noise, and upstream says as much: Opus conformance # is a quality threshold (`opus_compare`), not bit-exactness, and every # bitstream-affecting computation stays exact either way. # Symphonia has no Opus at any version -- its feature list stops at vorbis and # there is no `symphonia-codec-opus` crate -- while both of its containers *read* # the format already: `A_OPUS` and `OpusHead` have always mapped to # `CODEC_ID_OPUS`. The decoder was the one missing half, and the reason a 5.1 # Opus film played silent while its picture was fine. # # Multistream is what decides which crate: a 5.1 track is four elementary Opus # streams in one packet, all but the last **self-delimited** (RFC 6716 App. B), # and this one strips that framing per stream (`multistream.rs:71`). The obvious # sibling pick, `rusty-opus 0.9.1` -- same family as `rusty_aac`/`rusty_mp3` # above -- hands each self-delimited slice to a decoder that parses it as an # ordinary packet, so every stream but the last decodes the length prefix as # payload: measured on a real 5.1 Opus remux as full-scale noise at -13 dBFS # where the film is silent. This one matches ffmpeg's own decode of the same file to a # correlation of 1.0000 on all six channels. Pinned exactly, like `oxideav-ac3` # below, because a decoder is a bit-exactness dependency. ruopus = { version = "=0.1.2", default-features = false, features = ["std", "spectrograms"] } # The Opus *encoder*, the other half of that pair: a pure-Rust port of libopus # 1.6, BSD-3, `build.rs`-less and with **no dependencies at all** -- checked, not # taken from the README (`cargo tree` is two lines; there is not one `.c`, `.h` # or `.S` file in the crate). It is what lets an edited Opus source leave in a # Matroska file as Opus instead of being downgraded to AAC on the way out. # # Used inside a measured envelope, and that envelope is the whole reason this # line is not simply "the encoder": 48 kHz **stereo** at **at most** # [`crate::export::OPUS_MAX_KBPS`]. Above roughly 165 kbps stereo this encoder # writes packets that only its *own* decoder reads back -- `ruopus` decodes them # as noise (correlation 0.06 at 256 kbps against the source, 0.9999 at 160), and # `ruopus` is not the suspect: it decodes ffmpeg's own libopus at 256 kbps to # correlation 1.00000 on the same signal. Mono is worse and at every rate, which # is why a mono mix keeps the AAC path. Both measured in # `tests/opus_export.rs`, which fails the day the crate is unpinned onto a # version that has fixed it -- that is the upgrade signal. opus-rs = "=0.1.26" # The Ogg container, and the only new *name* here that is not a new crate tree: # its one dependency is `oxideav-core`, which the AC-3 decoder above already # pulls in. MIT. Vorbis-aware where it counts -- `xiph_lace` builds the # three-header blob and the muxer pages those ahead of the audio, which is the # encapsulation order a Vorbis decoder needs and the part that is easy to get # wrong by hand. oxideav-ogg = "0.1.8" symphonia-core = "0.6" symphonia-codec-aac = "0.6" # The umbrella crate for the standalone audio files: one dependency instead of # seven, and its `default::get_probe`/`get_codecs` are the registries this would # otherwise hand-build. Explicit feature list rather than the default one -- no # ape, no adpcm: what is listed here is exactly what `is_audio` admits, plus # `mkv`, which is not an `is_audio` container at all -- it is how the *sound* of # a Matroska video file is read, the picture having its own demuxer here. # There is no opus/ac3/dts feature at any symphonia version: AC-3 comes from # `oxideav-ac3` and Opus from `ruopus` above, both plugged into this crate's # own readers, and DTS is the one that really is refused. symphonia = { version = "0.6", default-features = false, features = [ "aac", "alac", "flac", "id3v1", "id3v2", "isomp4", "mkv", "mp3", "ogg", "pcm", "vorbis", "wav", ] } oxideav-ac3 = "=0.0.10" oxideav-core = "0.1.34" # The subtitle parsers: SRT and WebVTT here, ASS/SSA in the sibling crate -- # `oxideav-subtitle` hosts the shared IR and hands ASS to `oxideav-ass`, which # is why both names are needed for the three formats. MIT, pure Rust, and both # asked for without their default features: nothing here *draws* a cue yet (see # `crate::subtitle`), so the rendering stacks are dead weight. Only `oxideav-ass` # actually loses one -- it depends on `oxideav-subtitle` with defaults on, so # that crate's `text` feature (the bitmap font and rasterizer) is unified back # in whatever this line says. Nothing here calls into it. oxideav-subtitle = { version = "0.1.2", default-features = false } oxideav-ass = { version = "0.0.9", default-features = false } # The software AV1 encoder, and the only new name in this list that was already # in the lock file: `ravif` pulls the very same rav1e 0.8.1 in through the image # crate, so this links what the build already compiled. BSD-2 with the AOM # patent grant, and pure Rust with `asm` *off*: that feature wants `nasm`, which # this project's build does not have and will not require. `threading` is rayon # inside rav1e itself and is what keeps an export minutes rather than tens of # minutes; the cost of no assembly is measured in `export::Enc::open_av1`. rav1e = { version = "0.8.1", default-features = false, features = ["threading"] } # The software HEVC encoder, intra-only: OxideAV's pure-Rust H.265, MIT, no C # and no FFI like everything else here. Its *inter* modes run at 0.81 fps on # 1080p across 12 cores (measured 2026-08-11) and are therefore not an export # anyone would wait for; its intra AU is a stateless free function that fans out # across cores at 4.30 fps for the same picture, which is the export this # project offers -- an intraframe master, ProRes-shaped, large files and all. # Built from `vendor/oxideav-h265`; see the note in the workspace manifest. oxideav-h265 = { path = "../../vendor/oxideav-h265" } oxideav-sub-image = "0.0.7" [dev-dependencies] # The still-image suite compares what the timeline shows against the file's own # pixels rather than against a constant. Already built for the engine itself. image = { version = "0.25", default-features = false, features = ["png"] }