Commits
Commits on
fbc29d12fa2e194b105dd2344342fc50da4e90cdFiltered to crates/engine/src/audio.rsClear filter2026-09-18
🐛 fix(media): audio routing, session audio re-arm, hw trailing-zero NALs, display-matrix rotationAhmet Kaan Gümüş · bc8b82e
🐛 fix(media): audio routing, session audio re-arm, hw trailing-zero NALs, display-matrix rotation - is_audio admits .mpeg/.mpg so mp3-with-cover files import (was fed to Mp4Demuxer) - session audio walks past trackless leading sources and re-arms when a sounding file joins a silent timeline (fixes add/remove/add silence) - engine-hw pump clears trailing cabac_zero_word bytes instead of dying with code -2; export falls back to software decode before first frame - tkhd display matrix read for mp4; 90/180/270 turns baked into preview and export pixels; other angles refused by name (UnsupportedRotation)
2026-09-12
🔁 feat(audio): the AC-3/E-AC-3 decode seat is the native ec-ac3Ahmet Kaan Gümüş · 9fab7c9
🔁 feat(audio): the AC-3/E-AC-3 decode seat is the native ec-ac3 oxideav-ac3 leaves the tree. One decoder reads both syntaxes, dispatching per packet on bsid, and hands back interleaved f32 -- the seat asks for its own A/52 §7.8.2 stereo fold on anything wider than mono, per-position coefficients from each frame's own acmod and mix levels, so no width is refused any more (the 2.1-at-3ch passthrough refusal dies with the library) and the mono digital-silence corner-cut is gone with it. Witnesses on real content, identical packets, old seat vs new: - AC-3 5.1 film: per-channel correlations 0.99965-0.99999, rms ratios 1.001; the residual is the format's unspecified dither noise -- against ffmpeg's own decode both decoders sit equally close, and the two spots where they did not agree are OLD-seat deviations (the 2.0 rematrixing decode: 0.92/0.76 vs ffmpeg, the new seat 0.99997; the LFE: 0.976 vs ffmpeg, the new seat 1.000000). - E-AC-3 5.1 film: correlations >= 0.99998 on all six channels, rms 1.000. - Decode speed 1.64-1.68x the old seat (min-of-7, ~320x realtime 5.1). - Named coverage edge, refused by name at open, not silently: Annex E dependent substreams and enhanced coupling (7.1 DD+ assembled as 5.1-plus-dependents) -- oxideav walked those, ec-ac3 refuses them. Every single-substream AC-3 and E-AC-3 track decodes. New film witness file tests/audio_ac3_film.rs (seek-landing + ffmpeg correlation on a real AC-3 5.1 film and a real E-AC-3 5.1 film, mirroring the Opus/AAC film witnesses), real_library.toml.example documents the ac3_51_film key. caps row and the codec-table comment follow the seat.
✨ feat(engine): the multichannel AAC decode seat is an ec-aac native — rusty_aac stays encoder-onlyAhmet Kaan Gümüş · fc0891f
✨ feat(engine): the multichannel AAC decode seat is an ec-aac native — rusty_aac stays encoder-only - the >2-channel seat (a film's 5.1/7.1 track, symphonia refusing anything wider than stereo) now decodes with the family's own ec-aac; the same construction and decode call sites, the same seat shape, the same film channel order FL FR FC LFE BL BR the downmix folds - witness: fold correlation +1.00000 against the retired rusty_aac decoder on 2000 identical AUs of a 5.1 film remux (max|diff| 5.96e-8, RMS ratio 1.0000, channel matrix diagonal-dominant); stereo fixture +1.00000 / 5.46e-4 (PNS noise seed differs); new ffmpeg-correlated film witness a_seek_into_real_five_one_aac_film... scores 0.929/0.858/0.922 landing on the asked second (threshold 0.5) - perf: 12.0-13.2 Msamples/s (250-275x realtime) vs rusty 2.8-3.6 (58-75x) at 5.1 on identical packets; 26-32 Msamples/s (580-719x) vs 6.7-7.7 (151-174x) on the stereo fixture -- ~3.5x the retired decoder, bar was >=0.9x - known behaviour delta, honest in both directions: HE-AAC v1 (SBR) now reconstructs at the extension rate where rusty band-limited everything to the core Nyquist; PS streams decode core-only at the core rate in BOTH
✨ feat(engine): both Opus seats are ec-opus natives — the library pair is goneAhmet Kaan Gümüş · 597e096
✨ feat(engine): both Opus seats are ec-opus natives — the library pair is gone The decode seat (SymDecoder::Opus) and the encode seat (encode_opus) move off ruopus 0.1.2 / opus-rs 0.1.26 onto the codec family's own ec-opus, the first path dependency across into the sibling edith_codecs workspace. Both replaced crates leave Cargo.lock with everything they pulled in. What the swap is measured to do, not hoped to do: * decode equivalence: a real 5.1 stream decodes to correlation 1.000000 between the two decoders, and the film seek witness lands on the same samples it always did — the 312-sample pre-skip corrections hold unchanged, so no constant moved. * the 128 kbps cap goes to 320, the Sound row's top: opus-rs's packets above ~165 kbps were noise to every decoder but its own (re-measured: 0.011 correlation at 320 through BOTH decoders), and that cliff is the only thing the old ceiling stood on. ec-opus's 320 kbps packets read back identically through ruopus and through ec-opus. Fidelity at the top of the new band: 0.9999 (stereo 320), mono 0.9999-1.0000 (was 0.9983-0.9987 at 128). * mono leaves as Opus now. opus-rs mis-encoded mono at every rate, which is what kept a mono mix on the AAC path; a_mono_mix_leaves_as_opus_too pins the new behavior and the export.rs unit suite round-trips mono at 96 and 256. The muxer's family-0 OpusHead needed no change: it already wrote mono. * performance, measured honestly (release, min-of-7 alternating, against ruopus WITH the spectrograms/FFT backend the product actually shipped): ec-opus is ~1.4-1.7x SLOWER on every path — 5.1 decode 246x realtime where ruopus managed 407x; the export seat (encode plus its mandatory fidelity decode) 0.27 s against the old seat's 0.18 s per 30 s of stereo. Both stay far past realtime (>=88x), so nothing is user-perceptible, but the >10% bar is not met numerically; the swap stands on the dependency-freedom goal, and the family decoder has the headroom to close the gap. KNOWN-OPEN, not silently accepted.
2026-08-26
🐛 fix(engine): mono sources up-mix onto wider timelines (DEBT #46)Ahmet Kaan Gümüş · d7c614b
🐛 fix(engine): mono sources up-mix onto wider timelines (DEBT #46) widen() (audio.rs) duplicates a mono decode buffer into every timeline channel -- the inverse of downmix(), wired into every decode site that feeds mix() (run_ac3, run_mkv_ac3, run_sym, the AAC loop in run()). audio_matches_probed (playback.rs) and the export-time width check (audio.rs:open_multi_streams_speed_at_fade) both now let a 1ch source join a wider timeline; a wider-than-timeline source stays refused.
2026-08-19
🐛 fix(engine): fades reach exported and played-back audioAhmet Kaan Gümüş · 9ec26f6
🐛 fix(engine): fades reach exported and played-back audio Two bugs: `forces_encode` never checked a clip's own fade, so the default Web MP4 copy path silently dropped fades from the exported AAC track. Worse, `Fade`'s frame counts are timeline (fps) frames but `Fade::apply` multiplies audio-rate sample blocks; unconverted, a fade's threshold was crossed a few milliseconds into any clip, so a fade-out muted the rest of the segment outright and a fade-in finished before an ear (or a 100ms RMS window) could catch it. `Fade::scaled` now re-counts a fade at the mix's own sample rate the moment the audio session learns it, which also fixes the same bug in live preview.
✨ feat(engine): per-clip audio fades, adjacency crossfade, and edith 18Ahmet Kaan Gümüş · 6d0747c
✨ feat(engine): per-clip audio fades, adjacency crossfade, and edith 18 Clip carries fade_in/fade_out, an equal-power gain envelope mixed into playback and export, a crossfade() op that sets both edges of two adjacent audio clips, and split's rule that only the kept edge keeps its fade. The project file format bumps to edith 18 to carry the two new fields; a v17 (or older) file loads with every clip's fades at zero. Fixes a stray fade_in/fade_out struct-literal fragment left outside any Clip literal in Player::trimmed (crates/app/src/player/timeline_edit.rs), which was a syntax error breaking the whole app crate's build. Adds unit coverage for Fade::gain_at's boundary/midpoint curve, the split edge rule, crossfade's adjacency refusal, the Clip size-lock test (40 -> 48 bytes), and a v17-loads-zero-fades / v18-round-trips edith.rs test.
✨ feat(engine): a project can name its own sample rateAhmet Kaan Gümüş · 31981de
✨ feat(engine): a project can name its own sample rate .edith goes to v17 with an optional samplerate line; the session carries it, save/load round-trip it, and the one audio-open seam every consumer shares (open_multi_streams_speed_at) conforms all segments to the named rate — playback rebuild and both export encoders inherit it for free. Proxies keep their film's own rate. A v16 file loads with the rate unset, meaning derived-from-source as before.
2026-08-15
✨ feat(engine): a speeded clip keeps its pitchAhmet Kaan Gümüş · 475f10c
✨ feat(engine): a speeded clip keeps its pitch The tape effect is gone: a speeded clip's audio was resampled at its speed, so its pitch moved with its rate. The resample is now only what it always should have been -- the rate conversion, reading a source written at another sample rate at the ratio of the two rates, pitch- true by construction -- and the time the Speed asks for is taken by a WSOLA stretch behind it: windows overlap-added at a different hop, each placed where it best continues the one before it, so the timeline compresses or stretches while every period of the signal keeps its own length. The beep stays a 1 kHz beep at 2x, the words stay spoken. Hand-rolled, no new dependencies: N=1024 Hann windows, 512-frame synthesis hop, ±512 search on the first channel by normalized cross- correlation against the natural continuation, one offset for every channel so a stereo pair stays coherent. A silent continuation is placed nominally -- nothing to match -- and a segment too short to prime a window passes through as the decoder read it. Both halves of the chain pace the timeline's promise to the frame, which is the A/V sync invariant the speed suite pins. Measured, not felt: the stretch's own tests put a 440 Hz sine through 2x and 0.5x and read 440 back by Goertzel with the octave gone; the sync fixture's 1 kHz beep plays at 1 kHz at 2x and 0.5x through the real open path (the tape effect's ladder peak read 1350 Hz there), and a 2x WAV export carries the same 1 kHz back out.
2026-08-13
🐛 fix(import): Cancel stops the read, not only the landingAhmet Kaan Gümüş · 4d0dd2b
🐛 fix(import): Cancel stops the read, not only the landing The Cancel beside the import line gave the window back and let the disk carry on: a cancelled cold 24 GB remux still cost its twenty seconds, and the notice said so rather than doing anything about it. The flag now reaches the walk — `demux::with_cancel` installs it as the reading thread's own, and every Matroska cluster the header index and the subtitle pass step over checks it and gives up there, with `is_cancelled` telling an abandoned read from a file that would not open. Thread-scoped rather than a parameter, deliberately: a read *is* a thread here (an import worker, an audio feeder, a decode worker), and the walk that has to stop sits five frames under an `open` with a dozen callers, none of which have anything to cancel. An mp4's header stays uncancellable — it is one read inside `mp4::Mp4Reader` with no flag to poll — so the notice and the button say the read stops "where the container lets it" instead of promising the disk went quiet. The feeder's own abandoned opens are NOT wired to this, and the corner-cut in `spawn_feeder_deferred` says why: three runs of one build over 200 cold scrub steps measured 14, 101 and 137 live workers, so that number is the machine's and not the cancel's — and cancelling every step's walk would stop the sidecar index from ever being written, which is the thing that makes the second pass over a film fast.
chore: rename ponytail: comment marker to corner-cut:Ahmet Kaan Gümüş · 9ba8e0a
chore: rename ponytail: comment marker to corner-cut: Marker convention renamed after uninstalling the ponytail plugin; semantics unchanged (deliberate corner-cut, known ceiling + upgrade path). Token-only rename, 81 comment lines, no code change.
2026-08-12
✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusingAhmet Kaan Gümüş · c94ba8b
✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusing An 8-channel Opus track came back "IMPORT FAILED: unsupported channel layout: 8 channels (max stereo)" and took the picture with it, and a 48 kHz file "audio 48000 Hz 2 ch does not match the timeline's 44100 Hz 2 ch". Both strings are gone: an import converts. Width: `fold_5_1` becomes `downmix`, a coefficient table per layout from 2.1 to 7.1 (ITU-R BS.775 — front channels keep their side, centre and surrounds join at -3 dB, LFE dropped, both sides normalised by their own coefficient sum so a full-scale source cannot clip). 5.1 comes out of the table bit-identical to what it was. `vorbis_to_film_order` gains the RFC 7845 permutations for 3, 5, 7 and 8 channels beside the 6 it had, so surround Opus at any width reaches the fold in the order the fold reads. The AC-3 decoder's own 2.1 passthrough, which it leaves at 3, folds here too, and a multichannel AAC track in an *mp4* now takes the `rusty_aac` route the Matroska side already had (`aac_decoder`, one call for both). Rate: the segment resampler a speeded clip already goes through takes the source rate over the timeline's into its step, so the two compose into one interpolation and 48 kHz onto a 44.1 kHz timeline keeps its pitch. All of it is convert-on-read — per packet in the decoder, per buffer in `emit`, after the window trim — so there is no upfront pass to show progress for and nothing to cancel. What is still refused is the layout alone: a mono track cannot join a stereo timeline, in the words "audio 1 ch does not match the timeline's 2 ch". The picker's grey-out rule follows the gate rather than leading it. Measured on a 12.9 GB 2160p AV1 remux with a real-library 7.1 Opus track: imports, opens as a timeline, and a ten-second WAV export comes back at RMS 0.0091 left / 0.0085 right.
🔒 chore(privacy): the tests name a key, the machine names the fileAhmet Kaan Gümüş · a893c91
🔒 chore(privacy): the tests name a key, the machine names the file
Nothing in this tree says what is in anybody's library or where it lives.
The handful of tests that are worth nothing against a fixture -- a real
HDR10 grade, a header-stripped BluRay remux, a disc's PGS tracks -- asked
for absolute paths written into their source, and the comments around them
recorded which films the measurements were taken on.
Both go. `engine::real_library::film(key)` reads `real_library.toml` at the
workspace root, which is gitignored: three logical keys named for what the
file *is* (`hevc_4k_hdr`, `h264_dual_audio`, `hevc_4k_pgs`), mapped to
wherever that machine keeps them. A missing manifest, a missing key or a
missing file each say so on stderr and the test passes, which is the
existence gate every one of these already had, in one line instead of five.
`real_library.toml.example` documents the shape and what each key must be.
The comments keep the technical fact and lose the title: a peak of 1759
cd/m^2 is still 1759, the 37 BCP-47 elements are still 37, and the Opus
pre-skip is still measured against ffmpeg -- on "a real 5.1 Opus remux"
rather than on a named one. The synthetic paths in the app's unit tests
("/films/…") were never real and are now anonymous too.🐛 fix(audio): a seek into a Matroska lands on the second it asked forAhmet Kaan Gümüş · 702501a
🐛 fix(audio): a seek into a Matroska lands on the second it asked for A film played 1.47 s further in than the timeline said after a scrub to 600 s, 3.39 s after one to 610 s -- sound against picture, the oldest complaint in this project, and the Matroska half of the mp4 fps truncation that was fixed once and never swept. One symphonia mkv seek does not land where it is asked to. It goes through the cue table and stops at the first frame at or *past* the cue's cluster: asking for 599.83 s on a 2h+ AV1/Opus 5.1 mkv landed the reader at 601.487 s, asking for 609.83 s at 613.407 s, and on the new 30 s fixture asking for 25 s lands at 29.987 s. Samples that far behind a reader cannot be reached by any window rule downstream, so `emit` had nothing to trim and the film simply played from the landing while the clock counted from the request. So the landing is read back and an overshoot is asked again from far enough before it to swallow the overshoot, and every attempt gets a *new reader* -- symphonia's mkv seek is reliable exactly once per reader: it hands out the frames it had already queued (they arrive carrying the old block's timestamp) and its element iterator does not recover, so a second seek on one reader landed back at the file's first cluster, 0.094 s, whatever it was asked for. That is a *clip* of a film, and at HEAD the second clip of a two-clip timeline came out with no audio at all. Opening again costs 2 ms on a 5 GB film. Seeking to the beginning is now not seeking: that seek is how the first 167 ms of the same film went missing at open, and 2.35 s more of it at 27 s, where the iterator left inside a cue's cluster ran on into the wrong one. Two smaller things the trimming needed to be right at all. A packet's own timestamp cannot carry the decode position: the frames of one laced block all share the block's, so the position accumulates from the decoder's count between blocks, which is what both mp4 readers here already do. And the pre-skip comes off a landing timestamp, because an Opus track's blocks are timestamped for the audible stream while the decoder hands its samples back with the pre-skip still in front of them -- 6.5 ms, measured. Measured against an ffmpeg decode of the same window, envelope correlation, real files. A 2h+ AV1/Opus 5.1 mkv at 600/610/1200/5400/6000 s: +1.474/+3.393/+0.094/+0.073/+0.094 s before, ≤1 ms after. An HEVC/AAC 5.1 mkv at 610 and 1200 s: +2.054/+1.856 before, 0.000 after. An H.264/AAC mkv and an AC-3 mp4 were already exact and stay exact -- the mp4 tables never had this to get wrong. A/V skew after a seek on the AV1 mkv: -0.007 s at 600 s, -0.005 s at 5400 s. The video path was measured at the same four positions and lands on the requested frame.
🔊 feat(audio): an Opus film is heard, not refusedAhmet Kaan Gümüş · 699950a
🔊 feat(audio): an Opus film is heard, not refused The refusal was the bug again. `is_audio` said "no opus, ac3 or dts, for which no pure-Rust decoder exists" while symphonia's own mkv and ogg readers have always mapped `A_OPUS` and `OpusHead` to `CODEC_ID_OPUS`: the containers read the format, only the decoder was missing. Symphonia genuinely has none at any version -- its feature list stops at vorbis and there is no `symphonia-codec-opus` crate -- so the decoder is `ruopus`, pure Rust, MIT, no dependencies of its own, and the film plays. Which crate is not a coin toss. A 5.1 track is four elementary Opus streams in one packet, all but the last self-delimited (RFC 6716 App. B). `rusty-opus 0.9.1` -- the sibling of `rusty_aac`/`rusty_mp3` already here -- hands each self-delimited slice to a decoder that parses it as an ordinary packet, so every stream but the last reads the length prefix as payload: it was measured on a 5.1 Opus remux as full-scale noise at -13 dBFS over a passage where the film is silent, which is exactly the failure that "the decoder returns samples" would have shipped. `ruopus` matches ffmpeg's decode of the same file to a correlation of 1.00000 on all six channels. Two things that are Opus's alone: it is stored in Vorbis channel order (FL, FC, FR, BL, BR, LFE) and the 5.1 fold reads the film order every other decoder here hands back, so the frame is permuted before it folds; and its encoder delay lives in the stream (`OpusHead`'s pre-skip, 312 samples) where neither reader drops it, so that is this track's priming -- sample-exact against ffmpeg afterwards, 6.5 ms late before. `.opus` and `.mka` join `is_audio`, `unsupported` asks the other reader before naming a codec (a refusal that fires on a track which decodes is the same defect wearing the other face), and `capability_matrix` covers Opus per container with DTS left as the one live refusal row.
🐛 fix(demux): a codec's support is probed per container, not inferred from a neighbourAhmet Kaan Gümüş · 4f4dcb4
🐛 fix(demux): a codec's support is probed per container, not inferred from a neighbour VP9 was decodable out of an mp4 and refused out of a .webm — `V_VP9` fell through the Matroska track dispatch into `OtherVideo` and came back as "V_VP9 video in a Matroska file is not supported", with the VA-API VP9 decoder wired in `engine-hw` the whole time. A browser-downloaded .mkv was one of those files. Both dispatches now read one table (`CODEC_IDS`), and the Matroska arm matches on `Codec` with no wildcard, so a codec added to the enum fails to compile until it has been routed rather than falling through to a refusal. A cell that is deliberately absent is a row in `UNSUPPORTED` with a reason, and the refusal quotes that reason instead of listing what is supported and leaving the user to guess. The mp4 video track comes out of `moov.traks` in file order, not a `HashMap` walk of `Mp4Reader::tracks()`: a file with two video tracks opened on a different picture from one run to the next, and a saved .edith reopened on the other one. `audio::audio_track_ids` fixed the same trap for sound; the naming half of `AudioSession::unsupported` had it too. VP9 states its bit depth in no container record — an mkv `TrackEntry` carries none and an mp4's `vpcC` is optional — so it is read off the first keyframe's uncompressed header. Assumed 8-bit, a profile 2 stream would decode into an NV12 pool and come back as garbage; 12-bit is refused by name like 12-bit AV1 and HEVC. The audio refusals said "AAC and AC-3 only" long after FLAC, MP3, Vorbis, ALAC and PCM decoded out of a Matroska file. They name the real set now, per container, because an mp4 video's sound never reaches symphonia and reads fewer codecs than an mkv does. tests/capability_matrix.rs holds all of it against real files.
⚡ perf(playback): a seek opens the sound on the feeder, not on the hand that seekedAhmet Kaan Gümüş · 46e8379
⚡ perf(playback): a seek opens the sound on the feeder, not on the hand that seeked The picture's open moved onto its worker last week; the sound's stayed on the caller. `AudioSession::open_mixed_streams_live` opens every track a segment names -- one `pread` per track, seconds off a cold cache on a 25 GB film -- and `PlaybackSession::seek` ran it on whoever called it, which in the editor is the thread that paints. Measured at the seat, cold: one ruler click froze the window 13.5 s, a 300-step scrub burst froze it 22 s. The line written for exactly that wait (`seek_line`, "the window is not frozen") was unreachable, because the thread that would have painted it was inside the open. `Audio::spawn_feeder_deferred` gives the feeder the open as well as the drain, mirroring `DecodeSession::open_worker_deferred`: the caller pays a thread spawn (2.09 ms cold on the film, was 9.27 s) and the sound arrives when it arrives. The epoch is captured at the seek rather than when the open returns, so a scrub that abandons twenty opens leaves twenty *stale* feeders, every one of them refused at the same lock the flush is taken under. The clock is untouched by the wait, which is what makes the wait safe: it holds where the seek put it until the first real sample is queued (`content_at`), so 8.7 s of cold open put the timeline 22 ms past its target rather than 8.7 s past it. `fed` is now re-based at that same first sample instead of at the seek -- the open's seconds are device time nobody fed, and counting them handed the timeline to wall time that far before the sound really ran out. There is no synchronous answer to "will anything play" any more, so `start_audio` returns whether a feeder took the job and the callers hand the clock to audio on it; a timeline with nothing to play ends its feeder at once, and `fed_all` hands the clock straight back, continuously. Whether there is a *mixer* to talk to is decided from the lists the open is about to be handed (`AudioSession::is_mixed`, the one definition, shared with the opener) rather than read off the handle afterwards -- a fader on the single-lane flat path still rebuilds the stream. Cold, playing, the device now runs through the open with an empty ring: audibly the same silence, counted as 1721 underruns where it was 5. Named at `resume` with its upgrade path. A warm session is unchanged (46 -> 53 across the suite).
2026-08-11
🩹 fix(audio): an mkv's stream 0 is the track it already played, not its firstAhmet Kaan Gümüş · a7dd4c5
🩹 fix(audio): an mkv's stream 0 is the track it already played, not its first A remux flags the language it wants heard with FlagDefault on whichever track it likes -- mkvmerge writes it on the second one all the time -- and every reader here picked with that flag. Numbering the streams by file position outright made stream 0 a different track on those files, so an .edith project saved before the listing existed would quietly start playing the other language. mkv_stream_order puts the track the file already plays first and the rest behind it in file order, and it does not re-derive the old pick, it runs it: the AC-3 arm asks MkvAc3Track the same question Track::open asked it, everything else asks symphonia for its default track. probe_streams, Track::open and therefore the library's rows all count in that one order. Tested on a byte-patched fixture -- ffmpeg writes FlagDefault only to say 0, so the one byte behind the French track's language is flipped to 1 -- and it fails on file-order numbering: eng leads instead of fra.
✨ feat(audio): every audio track of an mkv is a row, and the second one playsAhmet Kaan Gümüş · 264c10c
✨ feat(audio): every audio track of an mkv is a row, and the second one plays A Matroska file was worth exactly one audio stream here -- whichever track the readers stumbled on first -- so the second language of a dual-audio remux was invisible and unopenable, and no mkv ever showed what language its sound was in. The header walk now collects every audio TrackEntry in file order with its number, codec id, TrackLanguage and TrackName (demux::matroska_audio_tracks), and that list is what a stream index counts in. The index picks an entry, the entry's *track number* is what each reader is then pointed at -- MkvAudio::open_track for the AC-3 blocks, SymTrack::open_track for symphonia, whose mkv reader keeps the same number as its track id -- so the two readers cannot disagree about which track a stream meant. Stream 0 is still the file's first audio track, sample for sample. Rows name their codec from the container rather than from symphonia's registry: the tracks that most need naming are exactly the ones it has no decoder for, and "opus is not supported" beats "an unsupported format". Fixture: test_multiaudio.mkv, two AAC tracks, eng 440/880 Hz and fra 220/330 Hz -- different tones because a mapping that drifts plays the other language.
Merge remote-tracking branch 'origin/main' into worktree-agent-a3fe67eb0bcf4cbceAhmet Kaan Gümüş · 9ebff59Browse files
✨ feat(export): OGG Vorbis is a row you can pick, not a note about missing encodersAhmet Kaan Gümüş · 17d7d99
✨ feat(export): OGG Vorbis is a row you can pick, not a note about missing encoders The export card said "no pure-Rust Vorbis or Opus encoder" and that had stopped being true. `rusty_vorbis` 0.1.1 (Apache-2.0, zero dependencies, same family as the h264/aac/mp3 encoders already here) is the first permissively-licensed pure-Rust Vorbis *encoder*; `oxideav-ogg` 0.1.8 pages it, and its only dependency is the `oxideav-core` the AC-3 decoder already pulls in. No C, no FFI, no new runtime system dependency -- `ldd` on the binary is unchanged, name for name. The row is live, keyed `o`, and names its encoder like every other live row does. VP9 stays refused with the reason it always had: AV1 replaces it. What the bench found, and what the code does about it. Every number below was measured by encoding this suite's own fixtures and decoding them back with symphonia -- an independent decoder, and the one this engine reopens exports with: * The encoder numbers its granules a full block ahead of the samples it codes, so written straight through, every sample lands ~1024 early: a marker signal came back with its head at 36% amplitude and a full-scale burst 1500 samples before the real one, in silence. One hop of silent pre-roll puts it back -- head 0.86 against an input peak of 0.80, the phantom burst down to 0.04. * Its block grid overshoots the last sample, so the stream is padded and the last page's granule declares the timeline's own frame count. An `.ogg` is now exactly as long as the WAV of the same timeline, which is the promise every other audio row here keeps. * Below quality 0.50 the encoder is *quiet*, not merely coarse (1-1.6 dB of level error, near-silence at 0.10), and the whole usable band tops out around 200 kbps. So the file is written at one measured quality, 0.85, and the Sound row is refused by name rather than mapping 128/192/256/320 onto quality steps: the top two are rates this encoder cannot reach, and a card that printed them would be lying. * The embedded setup header is a stereo profile -- a mono push is refused outright -- so a mono mix is written as dual mono, both channels bit-identical. And one defect the round trip turned up on the way in: `SymTrack` subtracted `Track::delay` on top of symphonia, which already drops those frames itself. Every `.mp3` import was losing its first 1105 samples (25 ms) and reading 25 ms short, every `.ogg` its first 128. Measured against `test_tone.flac` -- lossless, and the only one of the three declaring no delay -- which the mp3 and the ogg of the same tone now align with. WAV, FLAC and AAC-in-mp4 read hash-identical across the change; only those two formats move, and both move to the length their own container declares.
✨ feat(engine): an edit rebuilds what it dirtied, and nothing elseAhmet Kaan Gümüş · c2e62a3
✨ feat(engine): an edit rebuilds what it dirtied, and nothing else Every param change went through one funnel -- edit() -> seek() -- which flushed the audio ring, reopened every track, respawned the feeder and rebuilt the video decoder. Dragging a colour slider therefore cut the sound ~40 times across one gesture, and every restart re-anchored the clock onto an empty ring, so the silence of the restart was counted as timeline time: a permanent A/V offset, re-rolled by every edit made while playing (the resolution-change desync). Edits are classified by what they dirty now. A grade, a fit policy and the project resolution rebuild the picture where it stands and never touch a sample. An equalizer rebuilds the sound and never touches the picture. A fader and the master ceiling rebuild nothing at all: they live at the mix sum, so the running mixer picks them up between two blocks (MixControls), and the limiter is retuned rather than restarted so its delay line -- and the sample count the master clock is made of -- keeps running. Only a structural edit still reseeks both halves. And a restart no longer costs an offset: the feeder stamps the device position its first real sample was queued at, and the clock anchors there instead of on the first poll after the seek, so the silence before the content is never timeline time. Also: a span whose source will not open no longer presents the old channel's frames under the new mapping, and the feeder stops parking 10 ms on a ring that is merely waiting out a flush.
🐛 fix(audio): a broken Matroska track is an error, not silenceAhmet Kaan Gümüş · 941e882
🐛 fix(audio): a broken Matroska track is an error, not silence Two verifier findings, both in the same class as A5's silent-take work: a hole nobody asked for must not be indistinguishable from a hole the timeline means. Track::open's mkv arm turned every symphonia failure into Ok(None) -- silence -- with an eprintln as the only trace, so a file whose audio is broken played and exported as a quiet stretch and said nothing. Now SymTrack::open returns Ok(None) for the one honest case (the container opened and holds no audio track) and Err for the rest; a codec nothing here decodes is still silent, since that is what the decoder, not the open, reports. probe_streams follows the same split, and a standalone audio file keeps its old answer through open_required. lanes.rs: three_lane_file() handed both of its tests one pid-keyed path, so whichever finished first deleted the file the other was still using. The name is the caller's now.
🔀 merge(A5): main (b10235a) into the import-policy branchAhmet Kaan Gümüş · 685d4e6
🔀 merge(A5): main (b10235a) into the import-policy branch Clean: A1's Track::open rework routes codecs (MkvAc3Track before symphonia) and A5 handles absent tracks -- the two compose, and git merged them without touching either. C1's main.rs churn moved the refusal test's neighbourhood, not the test.
Merge remote-tracking branch 'origin/main' into worktree-agent-ab6959260e5ee211cAhmet Kaan Gümüş · 0776b46
Merge remote-tracking branch 'origin/main' into worktree-agent-ab6959260e5ee211c # Conflicts: # crates/engine/src/audio.rs
Merge remote-tracking branch 'origin/main' into worktree-agent-ab6959260e5ee211cAhmet Kaan Gümüş · 1e8c454
Merge remote-tracking branch 'origin/main' into worktree-agent-ab6959260e5ee211c # Conflicts: # crates/engine/src/audio.rs # crates/engine/src/demux.rs # crates/engine/tests/audio_decode.rs # scripts/gen_fixtures.sh
🔀 merge(A5): main (dfd4ffe) into the import-policy branchAhmet Kaan Gümüş · cbb0f62
🔀 merge(A5): main (dfd4ffe) into the import-policy branch No conflicts: A6's waveform/demux work and the subtitle lane do not touch the import gate.
🔀 merge(A5): main (de15818) into the import-policy branchAhmet Kaan Gümüş · d17f345
🔀 merge(A5): main (de15818) into the import-policy branch The rate gate main landed (`Rate`) and this branch's codec gate removal are the same function: `matches_timeline` keeps main's `Rate` return and loses the codec equality, with the decoder probe in its place. The refusal tests that named a rate or a silence now name the one thing left -- one output device, one rate and one layout.
✨ fix(waveform): a film in an mkv paints its wave, and a failure says soAhmet Kaan Gümüş · ffb3105
✨ fix(waveform): a film in an mkv paints its wave, and a failure says so A 5.1 AAC track decodes through rusty_aac, whose IMDCT ran as an 8 MB cosine matrix -- 88% of decode time and 2x realtime, so a two-hour film needed an hour of background decode before its lane had anything to draw. The same file has an N/4-point FFT already, for the encoder: the IMDCT is a DCT-IV read at an offset, so both directions now share dsp::dct4. 40x on the fixture, 141 s for the film. And a decode that fails is no longer a silent file: peaks() errors reach the lane as Wave::Failed with a band that says "audio unreadable", the reason goes to the log, and the Matroska opener logs what it swallows.
✨ feat(audio): AC-3 and E-AC-3 sound out of a Matroska fileAhmet Kaan Gümüş · a71f015
✨ feat(audio): AC-3 and E-AC-3 sound out of a Matroska file The "(AAC only)" refusal fired on every A_AC3/A_EAC3 track in an mkv because a Matroska file's sound reached no reader at all. The blocks of its first audio track are now indexed beside the picture's and handed to the oxideav-ac3 decoder the mp4 path already uses, downmix and all.
✨ feat(import): mixed codecs and silent takes join the timelineAhmet Kaan Gümüş · 9bc3bd4
✨ feat(import): mixed codecs and silent takes join the timeline The two refusals a user hits for no reason are gone: a file coded differently opens its own decoder like every clip already does, and a file with no audio track contributes silence over its span like a gap already does. What the codec gate was really protecting against stays, moved to the one place that can answer it: import asks the file for a decoder, so a machine without the VA-API plugin refuses an HEVC take by the decoder's own name rather than playing black frames with the complaint on stderr. Rate and layout stay refused -- there is no resampler. Both audio paths now read a source with no track as the silence they already synthesise for a hole: the worker plays it, the packet copy writes it, so an mp4 export of a timeline with a silent take is as long as the timeline and quiet where the take is.
✨ feat(mix): every track has its own volume and the mix has a ceilingAhmet Kaan Gümüş · dc7d07d
✨ feat(mix): every track has its own volume and the mix has a ceiling A fader per audio track and one master limiter over the sum of them, both applied where the lanes are added and nowhere else -- so what an export writes is what the room heard, by construction rather than by two call sites agreeing. A track's fader moves everything on it, every frequency: it is not the equalizer (one take, one band) and not the panel's volume (this machine's monitoring, which no file carries). The limiter is lookahead, soft-knee and per sample: the peak of an exported file is a measurement, not a hope, and the hard clamp stays behind it as the backstop. Flat settings are still the bit-exact passthrough: one lane at unity with the limiter off never opens a mixer thread, and an mp4 of such a timeline is still a packet copy. A mixed one re-encodes, and the card says so before the export starts. Both belong to the project, so `.edith` is v9: `fps`, `limiter` and `gain` lines, every older dialect still loading flat. The rate line pays an old debt with it -- a timeline of nothing but stills and songs now comes back at the rate it was cut at instead of the one its scaffold implied. UI: the mix card (f, or an audio track's own header), rows with steppers and hold-to-run arrows, and the track's level on its header.
✨ feat(export): every video format carries sound, AV1 picks its box, MP3 is a rowAhmet Kaan Gümüş · 5ebd3ac
✨ feat(export): every video format carries sound, AV1 picks its box, MP3 is a row Three asks, one seam — the export's audio path was a packet copy, and everything it could not copy was a refusal. - MkvMuxer gains an A_AAC track (CodecPrivate = AudioSpecificConfig, CodecDelay one packet) and interleaves it into the clusters: an AV1 export carries the timeline's sound instead of naming it as left out. - Mp4Muxer::create_av1 writes AV1 into an mp4 — the `av01` + `av1C` sample entry `mp4 0.14` cannot spell is patched into the finished moov (layout cribbed from OxideAV's oxideav-mp4, MIT); Mp4Demuxer reads that entry back. - Format::Mp3 through `rusty_mp3` at 256 kbps CBR, and Format::Av1Mp4 beside Format::Av1: the export card has a row and a key for each. - copy_audio lifts every "cannot copy" refusal into a route to encode_audio — a second audio lane, a speeded clip, a Matroska source, an mp3 or a png timeline. A copy nothing forces stays a bit-exact copy. Round trips per container, through this project's own readers: mkv + mp4 AV1 with a tone (mux unit tests), an AV1 export in either box (tests/av1.rs), a still under a song as an mp4 with sound and an MP3 of the timeline (tests/audio_export.rs), two lanes summed into an mp4 (tests/lanes.rs), a speeded lane resampled into one (tests/speed.rs).
2026-08-10
🔀 merge(T1): mkv HEVC + 5.1 AAC import meets the EQ exportAhmet Kaan Gümüş · 1dc163e
🔀 merge(T1): mkv HEVC + 5.1 AAC import meets the EQ export One rusty_aac, not two: the branch's vendored 0.5.0 (patched IMDCT) is what the workspace patch table points every dependant at, so T5's encoder and this branch's decoder are the same crate. The auto-merge had left two identical `rusty_aac` keys in the engine manifest, which is a duplicate-key error -- one entry now, its comment naming both halves. The three prose conflicts were all one shape: this branch wrote 'no AAC encoder is wired here' while T5 was busy wiring one. T5's wording wins in each. Where main's Av1 doc said this engine's reader 'refuses Matroska audio' the claim is now false the other way round, so that sentence keeps main's writer half and takes this branch's reader half.
✨ feat(import): a Matroska film opens, its 10-bit picture and its 5.1 sound alikeAhmet Kaan Gümüş · b083a3b
✨ feat(import): a Matroska film opens, its 10-bit picture and its 5.1 sound alike mkv HEVC demux (Main/Main10), a P010 pool in the hardware path read back to I420, mkv audio through symphonia's Matroska reader with rusty_aac decoding what symphonia's own AAC refuses (anything wider than stereo), and a BS.775 fold of 5.1 down to the stereo the output device takes. vendor/rusty_aac is 0.5.0 with one local patch: its decoder's IMDCT caches the cosine matrix instead of calling cos() per term, 11x faster and the difference between playable and not.
🔀 merge(T6): the last media leaves, and nothing assumes source 0 stayedAhmet Kaan Gümüş · 7e4ead7
🔀 merge(T6): the last media leaves, and nothing assumes source 0 stayed Both sides kept: the library-removal slice (a project may name no file, the audio reference is never a still, the clipboard follows its file down the list, a silence edit drops the selection) and main's EQ audio export, image left-trim, track removal, volume slider, hold-repeat and EQ spectrum. The one textual conflict was the test import list; close_session now also drops the gestures and caches those slices added.
🐛 fix(library): the last media leaves and nothing assumes it stayedAhmet Kaan Gümüş · 96c9fbeBrowse files
🐛 fix(export): an equalized mp4 re-encodes the sound the copy could not carryAhmet Kaan Gümüş · 33f7a15Browse files
✨ feat(timeline): clips play at a speed of their ownAhmet Kaan Gümüş · f8effe8
✨ feat(timeline): clips play at a speed of their own A clip gains a rate (`Speed`, thousandths of real time, 0.25x to 4x) and every speed question is answered at the mapping seams that were already there: `Clip::frames` is the source range divided by the rate, `end` is built on it, and `map`/`span_at`/`composite_span_at` walk the offset through `Speed::source_at`. `in_frame`/`out_frame` stay *source* frames, so a trim and a split still address the file. The picture needs no new decoder: the span says how many source frames it reads, and `try_frame` brings the decoder's numbers back through the same rate -- at 2x two decoded frames land on one timeline frame and the display's drop-when-behind policy takes it from there. The sound is resampled per segment inside the worker playback and the audio export already share (linear interpolation, carried across packet seams), so the pitch moves with the rate: tape, not pitch-preserve, and the card says so. Each segment is told how much timeline it owes and pads or trims to it, which is what keeps a run of speeded cuts from drifting. Rounding is where a rate could break the lane, so it does not: `Speed::fit` never hands a trim more source than its room holds, and `Speed::split_at` refuses a cut a slow clip's rate cannot address rather than leaving two halves that no longer add up. The fuzz sweeps set_speed in with the rest. - card in the eq/colour pattern, on `j` and in the clip menu; a drag is one undo step for the whole linked group, 1.00x reachable by hand and by `r` - clip boxes carry a "2.00x" mark, and their width, waveform and details row are the timeline length - WAV/FLAC honour it; mp4 and AV1 *refuse* by name -- that path copies AAC packets and a resample is not a copy (ponytail names the upgrade path) - .edith v8 carries the rate; v7 and older load at 1.00x - `assets/test_speed_sync.mp4`: one flash, one beep, same instant. At 2x they still land together, to the frame.
✨ feat(audio): AC3 tracks decode with a built-in stereo downmixAhmet Kaan Gümüş · 8c7bf80Browse files
✨ feat(audio): per-clip equalizer is live in playback and exportAhmet Kaan Gümüş · 4d92155
✨ feat(audio): per-clip equalizer is live in playback and export The model, the format and the filter have all existed with no callers. This wires them: `Project::audio_eqs_from` hands one curve per segment beside the play list `audio_segments_from` already builds, `open_mixed_streams_eq` gives each lane's worker those curves, and `emit` -- the one place both readers hand their samples over -- filters a segment after it is trimmed and before it is sent. Playback and an audio export therefore get the same filtered stream by construction rather than by two call sites agreeing. A parallel list, not a fourth element of the segment tuple: that tuple is what every opener, the packet-copy path and a dozen tests speak, and an effect is not part of which samples a segment names. A short list plays flat, so a mismatch can neither panic nor shift a curve onto the wrong clip. Live editing needs no channel into a running worker: `set_eq` is an edit and every edit reseeks, so the workers are rebuilt from the new curves where the playhead is standing. An mp4 export copies AAC packets and no filter can reach a copy, so an equalized clip is refused by name and by timecode rather than written flat. The card is the third of its kind (same scrim, width and rows as keys and export): a row per band, dragged from the middle out, with `q` to open it and 1-5 / up / down / r as its own keyboard, every one of them listed in the keys menu by the registry the guard test reads.
✨ feat(engine): N-lane compositing in playback and exportAhmet Kaan Gümüş · 08af6bc
✨ feat(engine): N-lane compositing in playback and export Video: the topmost video lane with a clip there wins, topmost being the last lane in display order (V2 over V1, the overlay convention). No blending, so exactly one lane is visible per frame and the composite is itself a span list -- Project::composite_span_at -- which one decoder plays. N video lanes never mean N decoders; a lane change costs the one decoder reopen a cut already costs. Audio: every audio lane that holds something gets a play list (Project::audio_segments_from) and AudioSession::open_mixed_streams sums them, clamped, each lane keeping its own gap rule so the master clock counts a sample per sample of timeline. One lane skips the mixer entirely and is the byte-for- byte path it always was. Export walks the same composite and mixes the same lanes for WAV/FLAC. The mp4 path copies AAC packets and cannot mix, so a timeline whose sound is spread over two lanes is refused there by name rather than silently exported without half of it.
✨ feat(engine): AV1 import via the VA-API pluginAhmet Kaan Gümüş · 6d3e3ba
✨ feat(engine): AV1 import via the VA-API plugin
AV1 arrives in Matroska, never in an mp4 -- `mp4 0.14` knows no `av01`
sample entry at all -- so the demuxer grows a second container:
`MkvDemuxer` walks the EBML itself, indexes every block of the AV1 track
in one header-only pass (payloads are seeked over) and hands each block
to the decoder as the temporal unit it is, with the `av1C` sequence
header re-injected ahead of every keyframe the way the H.264 parameter
sets are.
Matroska indexes neither the frame count nor the frame rate, which is why
that walk exists: the count is the blocks of the track and the rate is
`DefaultDuration` in nanoseconds (33333333 = 30 fps to seven digits,
where the millisecond block timestamps beside it would say 30.30).
Keyframe flags come out of the same pass, so a seek lands on a sync point
without a Cues element and without guessing at the bitstream.
Audio is picture-only for now: a Matroska file is a silent source and
says so by name ("A_AAC audio in a Matroska file is not wired to the
decoder yet") rather than failing in the mp4 reader's words. 10- and
12-bit AV1 are refused at open like HEVC Main 10, for the same 8-bit
read-back reason.
No new dependency: symphonia's mkv reader drops the keyframe flag and
`DefaultDuration` and offers no frame count, so it could not have done
the job. edith keeps its 7 DT_NEEDED entries.Merge S5a audio-file import into stream-picker mainAhmet Kaan Gümüş · 1bb8ee2
Merge S5a audio-file import into stream-picker main
Both sides taught `audio` a new axis and they meet on one type: S5a made
`Track` an enum over the mp4/AAC reader and symphonia's, main gave every
reader a `(path, stream)` address. The merged `Track::open(path, stream)`
keeps both -- the stream index lives inside `AacTrack::open`, and a
standalone audio file, which has exactly one track by construction, refuses
any stream above 0 rather than quietly serving the only one it has.
- `AudioProbe` is S5a's `{sample_rate, channels}`: equality is playability,
so an mp3 may share a timeline with mp4s. Copyability is a separate
refusal, at export, and stays AAC-only through `copy_track`.
- `probe_streams` reads a standalone file through symphonia instead of
walking it as an mp4 -- an ALAC .m4a parses as an mp4 whose only audio
track is not AAC, so the mp4 walk would call it undecodable where
symphonia decodes it.
- Which lane a source lands on is decided once, in `place_stream_at`: a
file with no picture is placed on the audio lane alone, everything else
is pasted as a grouped take. The front-end only owes the refusal notice.
- `unsupported()` and the NTSC/VP9 work are untouched; `is_audio` files
never reach the former, since a song cannot open a timeline at all.✨ feat(engine): common audio files import and playAhmet Kaan Gümüş · fe53979
✨ feat(engine): common audio files import and play mp3, wav, flac, ogg-vorbis, ALAC and ADTS join a timeline as sources with no picture: symphonia's own probe reads them, the audio lane holds them, and the video lane refuses them by name. The mp4/AAC path is untouched -- it is still the only one that yields packets an export can copy, so a timeline carrying anything else is refused at export with the file and its format named rather than exported silent. A source with no picture is as long as it plays, rounded up to whole frames; import, load and the library row all derive its length from that.
✨ feat(library): every audio stream is a row, and the picked one plays and exportsAhmet Kaan Gümüş · ecb5e06
✨ feat(library): every audio stream is a row, and the picked one plays and exports A file with one audio track per language is one row per track now, not one row per file. The engine carries the pick end to end: a source is a (file, audio stream) pair, .edith v3 writes the stream on the source line, playback opens it and — the trap this closes — the export copies *that* stream's packets rather than always stream 0. Streams that cannot go on the timeline are listed greyed with the reason instead of hidden: a codec we cannot read, or a rate/layout that cannot share one output device and one copied AAC track with the rest of the timeline (there is no resampler here and no AAC encoder to write a join with). place_stream_at is the one door a row goes through, and it refuses those in the engine's own words. - v2 and v1 files still load: no stream field means stream 0, which is all those dialects could play; saving either writes v3. - Waveform peaks are keyed by file *and* stream, so two tracks of one file cannot draw each other's envelope. - Library swatches and clip tints follow the *file*, so a file's streams share one colour in the panel and on the lanes. - assets/test_multilang.mp4: two AAC 44.1k stereo streams (und, fra), the shape real multi-language media has and the one where a second stream is placeable.
🐛 fix(engine): NTSC frame rates survive the sample tableAhmet Kaan Gümüş · 3f81ef8
🐛 fix(engine): NTSC frame rates survive the sample table `mp4 0.14`'s `Mp4Track::frame_rate` divides the sample count by whole milliseconds before the float cast, so 24000/1001 read back as a flat 23.0: the picture the audio-sample master clock asked for was 4 % out and the drift grew with the film — five minutes of it by the end of a two-hour one. The frame rate now comes off the stts totals in f64, which is exactly `timescale / delta` for a constant table and an average for a spread one. The same truncation lived at the writing end (a 90 kHz clock cannot count 23.976 fps in whole ticks), so the muxer picks a timescale that can: 90 kHz wherever it divides exactly — every integer rate, so those exports are byte for byte what they were — and `round(fps * 1001)` over 1001 ticks otherwise, which is exact for the whole NTSC family. The hardware encoder gets that same rational instead of a rounded `fps * 1000`. The video edit list is honoured now too, the way the audio one always was — but only what it really trims: a `media_time` equal to the first `ctts` offset is the B-frame composition delay, not a cut, and reading it as one throws two real frames away. A file whose audio we cannot decode at all (an AC-3 remux) played silent with the reason on stderr; the session carries it now and the window says NO AUDIO in its notice bar.