Commits
2026-11-17
2026-11-15
2026-10-23
🚚 edith moves to git.tahinli.comAhmet Kaan Gümüş · b02f499
🚚 edith moves to git.tahinli.com The working tree as of 2026-10-23, as one commit on top of the last one here. It carries the work up to that date plus the test-slimming work: integration tests merged into one binary per crate, nextest config, doctest = false, debug line tables only, perf tests behind --ignored, and faster generators, reverse, undo, subtitle-export, hevc, stabilise and hear tests.
2026-09-24
copy(exact): the copy door keeps the pixel aspect, and an mp4 copy refuses itAhmet Kaan Gümüş · 312b13e
copy(exact): the copy door keeps the pixel aspect, and an mp4 copy refuses it ffmpeg's own copy behaviour: the blocks are the source's coded pixels and the aspect travels with them as container metadata. The Matroska copy door now does that: CopyPlan compares CODED to CODED (the display comparison would refuse every anamorphic source and then lie about the track it wrote), declares the source's coded pair, and writes the source's aspect as Display* elements -- unit 4, the SAR itself, the ratio this engine's reader reproduces exactly. A square copy writes no Display* at all, so every existing copy's header is byte-identical. The mp4 copy cannot carry it: the sample entry this writer produces has no pasp box, and a header that declares the coded pair while the pixels are drawn 4/3 wide lies about its own shape. Refused by name -- 'a copy would lose the pixel aspect' -- before the container's codec sentence, so the export re-encodes into the square pixels the picture is drawn at (mp4 export measured: 1920x1080, square).
💄 style(media): the dedupe's doc line wraps where it readsAhmet Kaan Gümüş · 87acb80
💄 style(media): the dedupe's doc line wraps where it reads The muxer's reference to the demuxer's table made one comment line run past the wrap every other line in the region keeps.
♻️ refactor(media): one ISO 639 table, the demuxer's, for both sidesAhmet Kaan Gümüş · 737b171
♻️ refactor(media): one ISO 639 table, the demuxer's, for both sides The mux lane had carried its own copy of the demuxer's ISO 639-1 → 639-2 table because that one was private to its module. Make the demuxer's `pub(crate)` and have the muxer read it, so the two can no longer drift; the copies were byte-identical, all 183 entries, so nothing is dropped.
🐛 fix(media): a block behind its cluster, a subtitle tag, an empty mp4Ahmet Kaan Gümüş · 781cdf8
🐛 fix(media): a block behind its cluster, a subtitle tag, an empty mp4 Three writer defects in one file, each with the test that proves it: - MkvMuxer: only the forward bound of a block's distance from its own cluster was checked (ts - cluster_ts >= CLUSTER_MS), so a step back wider than the signed 16-bit relative field was truncated by `as i16` into a positive offset -- a block the source put at 0 s read back at 65.536 s, silently. Both bounds are now one cluster_holds predicate, the cast is i16::try_from with the distance named in the error, and put re-checks after the drains, where a lagging track can have opened a cluster behind the picture the cluster was opened for. - Mp4Muxer: the mp4 crate's language_code masks the three UTF-16 units it is handed with 0x1F and drops the rest, so a pt-BR subtitle track was written as `ptm` and a two-letter en as `en` plus a backtick, read back off the file. The tag is turned into a code at the muxer boundary now (mp4_language): three lowercase letters pass, a BCP-47 primary subtag is mapped through the ISO 639-1 table, anything else is und. Matroska's own writer needs no change -- its Language element is raw bytes, and the same tag is normalised on the way in by demux::mkv_language. - Mp4Muxer::finish: a file nobody put a picture in was written anyway, while the Matroska twin has always refused that by name. The mp4 refuses in its own container's words; the encoded export door already refuses earlier, so this is the container contract rather than a live-door fix. Each is a mux.rs unit test that reads the file back: the mkv blocks through the project's own Demuxer, the mp4 language through the mp4 reader and the refusal by its message.
2026-09-12
♻️ refactor(engine): the AAC encode seat is ec-aac -- export.rs's encode_audio and the muxer's tone harness speak ec_aac::AacEncoder on the seat's old contract (interleaved f32 push_pcm, raw raw_data_block packets one frame long, the sf_index_for_rate refusal the export turns into a user-facing message, ASC rebuilt from AacTrackParams), the caps row and both SW-encode labels read ec-aac, and a new mux witness round-trips seat-encoded mono, stereo and 5.1 through the project's own decode door (symphonia's reader for the pair, the family decoder for 5.1, folded to stereo as the door's contract states). A/B on identical synthetic program -- mono 44.1k 128k, stereo 44.1/48k 256k, stereo 48k 96k, 5.1 48k 512k, every output ADTS-framed and ffmpeg-decoded, alignment by envelope correlation with an ffmpeg-native control column: ec-aac correlates at or above the incumbent on every row (mono 0.9674 vs 0.9564, stereo 96k 0.9445 vs 0.8458, 5.1 0.6050 vs 0.6007) and matches or beats ffmpeg's own encoder at matched actual rate; cost is +4-6% actual bits at the same target and a slower encode wall (single-threaded vs rusty_aac's frame-parallel finish: 2.0-3.7x on one core, 5.9-10.2x as-shipped on this box) -- named here per the perf bar. rusty_aac itself leaves in the next commit. Export and capability suites green, -p engine --all-targets 0 warningsAhmet Kaan Gümüş · 7ed056a
♻️ refactor(engine): the AAC encode seat is ec-aac -- export.rs's encode_audio and the muxer's tone harness speak ec_aac::AacEncoder on the seat's old contract (interleaved f32 push_pcm, raw raw_data_block packets one frame long, the sf_index_for_rate refusal the export turns into a user-facing message, ASC rebuilt from AacTrackParams), the caps row and both SW-encode labels read ec-aac, and a new mux witness round-trips seat-encoded mono, stereo and 5.1 through the project's own decode door (symphonia's reader for the pair, the family decoder for 5.1, folded to stereo as the door's contract states). A/B on identical synthetic program -- mono 44.1k 128k, stereo 44.1/48k 256k, stereo 48k 96k, 5.1 48k 512k, every output ADTS-framed and ffmpeg-decoded, alignment by envelope correlation with an ffmpeg-native control column: ec-aac correlates at or above the incumbent on every row (mono 0.9674 vs 0.9564, stereo 96k 0.9445 vs 0.8458, 5.1 0.6050 vs 0.6007) and matches or beats ffmpeg's own encoder at matched actual rate; cost is +4-6% actual bits at the same target and a slower encode wall (single-threaded vs rusty_aac's frame-parallel finish: 2.0-3.7x on one core, 5.9-10.2x as-shipped on this box) -- named here per the perf bar. rusty_aac itself leaves in the next commit. Export and capability suites green, -p engine --all-targets 0 warnings
2026-08-26
✨ feat(engine): interleave the overlapped mp4 audio pass under the pictureAhmet Kaan Gümüş · 4ba4015
✨ feat(engine): interleave the overlapped mp4 audio pass under the picture Mp4Muxer holds ~2s of pictures and releases them merged by pts against landed sound instead of writing whole-picture-then-whole-track; feed_late_audio hands the mix over the moment it lands.
2026-08-13
🔀 merge(engine): the stand-in decides one path, and the intra file keeps its marksAhmet Kaan Gümüş · eff035e
🔀 merge(engine): the stand-in decides one path, and the intra file keeps its marks Lane P's proxy workflow meets a main that had taken S's persistent decode workers, E's pipelined export and E4's zero-copy encode. * `start_span` keeps S's reuse door and P's single substitution point at once: `picture_path(source)` is resolved *before* the door and handed to both halves of it. A worker holding the film is then asked for a span of the stand-in, declines on the path it already has (`Worker::reseek`), and `set_proxies`' seek becomes a respawn on the other file -- while a span that did not change files still costs no thread and no VA-API init. Asking the project for the path at the door, as main did, would have left every proxied span opening a worker from scratch. * `Enc::encode_dma` takes P's `intra` flag, which is not symmetry: a proxy of a file already small enough is coded at that file's own size (`proxy::size_for` -- `wanted` is true for HEVC and AV1 at any size), so an intraframe export's decoder and encoder can agree on a surface and the buffer goes straight across. Marked `false` there, an all-intra stand-in would have carried no sync point at all, which is the exact bug `gop_limit` was written against, reached by the other door. * The five other conflicts were both sides adding a field: `drop_late` and `proxies` next to each other, in the struct and in all three opens. * `enc_depth` is keyed by codec, so the intra seat takes H.264's two. Said in its doc rather than left to be re-derived: that seat is the same entrypoint with every inter dependency removed, so a picture there is finished no later than one on the seat the two was measured on. `nm -D libengine_hw.so` lists sixteen: P's `vh_enc_open_intra` beside E4's `vh_next_frame_dma`, `vh_enc_dma_geometry`, `vh_enc_frame_dma` and main's `vh_seek`. `picture_path` still has exactly one call site outside the tests, and it is in `playback` -- an export reads the film. The intra seat and the zero-copy path are read, not run: every test that would reach either is hardware-gated and the GPU is wedged.
⚡ perf(export): the sound is worked out under the picture, not in front of itAhmet Kaan Gümüş · cd31ad1
⚡ perf(export): the sound is worked out under the picture, not in front of it An export mixed, encoded and held its whole audio track before a single frame was decoded, because the muxer was handed the track when it was created. On a feature film that is minutes of nothing visible happening, and it was pure waiting: an mp4 writes its audio samples after the last picture anyway. So the mp4 muxer declares its audio track where it writes it. `mp4 0.14` builds the movie box at the end from the tracks in the order they were added, and the samples go into `mdat` in the order the caller writes them, so a track added before the first picture and a track added after the last one produce the same file -- which is checked and not argued: a ten-second span of the film exported before and after this is byte-identical, md5 73f1a9ca9b2eb1c4a7a8f8d467e7635e either way. With that gone, the audio pass runs on a thread from the top of `run` and the picture starts immediately. Where it is *waited* for is the whole design: a Matroska file interleaves audio into its clusters from the header on, so that path still collects the pass before the first coded picture (nothing there to overlap, and the copied-picture path is the same muxer); an mp4 collects it at the frame where the thread happens to have finished, and failing that after the last one. Collecting inside the loop is not tidiness -- a mix this engine cannot decode used to refuse in seconds, and an overlapped pass that reported only at the end would spend the whole encode first. Measured on the film, 600 s span, AC-3 5.1 re-encoded to AAC: the audio pass now completes 4.5 s and 7.0 s into the picture on two runs (`export audio: done N s into the picture`), where before it stood in front of it. The wall clock says 214-229 fps against 199-268 for the serial build -- this box was running four other agents' benchmarks and its noise (±30%) is wider than the 10% this is worth on that path, so the stage lines are the evidence and the fps numbers are not. Two smaller things fall out. The progress bar advances with `fetch_max`, so the audio's share of the band cannot pull it backwards while the picture pushes it forwards. And the encoder line says "working out the sound…" until the pass is collected -- the half-line the copied-picture path already used -- so what it publishes is still never a codec that did not run.
✨ feat(engine): a big film gets a small stand-in to cut withAhmet Kaan Gümüş · 83e561d
✨ feat(engine): a big film gets a small stand-in to cut with A proxy is the film at 1280 on its long edge, every frame an IDR, no sound in it at all: a seek lands on the frame asked for instead of on the nearest one a decoder can start from, and the mix stays the original's. Generation is the export walk given a one-clip project and a smaller canvas, so the hardware seat, the progress and the cancel are the ones a file export already had. Two switches were wanted for it: `intra_only` (one frame a GOP on the H.264 pair) and `keep_source_colour`, which carries the film's own space into the stand-in instead of converting it -- that conversion ran on the source's full 4K, cost 48 ms a frame and was the whole of a proxy's price, and leaving it to the screen means the tone-map preset can still be changed after the stand-in was made. The cache is keyed on the source's path, length and modification time, so a re-encoded original misses rather than reading a stale stand-in. A 4K HDR film: 2.35x realtime on the VA-API seat, against 0.59x before the colour switch; a cancel leaves neither the file nor its .part.
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(export): an edited Opus source leaves an mkv as OpusAhmet Kaan Gümüş · 76ede8e
🔊 feat(export): an edited Opus source leaves an mkv as Opus Opus could be read here since `ruopus` landed and could not be written at all, so every cut of an Opus film came out as AAC in a Matroska file: a codec downgrade nobody asked for, paid on every edit. `opus-rs 0.1.26` is the encoder half -- a pure-Rust port of libopus 1.6, BSD-3, no `build.rs`, not one `.c` in the crate and no dependencies at all (checked, not read off the README) -- and a Matroska export now writes `A_OPUS` with an `OpusHead` in its `CodecPrivate`, `CodecDelay` and the codec's fixed 80 ms `SeekPreRoll` beside it. An mp4 still says AAC and the mp4 writer now refuses an Opus track by name rather than declaring `mp4a` over it. Only where an *encode* was going to happen anyway. An untouched timeline still copies its packets, bit for bit, into the same container: Opus is what an edit costs, never what a passthrough costs. The envelope is measured and it is narrow, which is the whole story of this crate. On three one-second spans of a 5.1 Opus film, encoded here and decoded with `ruopus` -- not the suspect, it reads ffmpeg's libopus at 256 kbps back at correlation 1.00000 -- the encoder is usable to 128 kbps (0.937/0.989/0.994) and ruined by 136 (0.452/0.697/0.951), against libopus at 0.997/0.998 on the same material. Pure-tone fixtures put that cliff at 165 kbps, so its edge moves with the content and no constant is safe on its own: the cap is 128 kbps *and* every track is decoded again and correlated with the mix before it is written. Below 0.95 the export writes AAC instead, and the encoder line the export publishes says AAC, so the fallback is visible rather than silent. Mono keeps AAC outright -- this encoder mis-codes it at every rate asked for here -- and so does any timeline that is not 48 kHz, since Opus has one rate and resampling a whole timeline to reach it is a bigger change to the sound than the codec is. Two delays, both measured rather than hoped for. The pre-skip is 1080 samples: the encoder's 2.5 ms lookahead plus one warm-up frame, because a cold first frame comes out ramped and out of phase (the head of the fixture went 0.9788 -> 0.988 correlated once it was fed its own first 20 ms first), and one silent frame is pushed in at the end so the last 2.5 ms leave the encoder instead of ending the track short under a picture that is not. ffmpeg's decode of the file agrees with this project's own reader sample for sample, which is what says the header describes the stream. `tests/opus_export.rs` exports a cut and reads it back through symphonia's mkv reader and `ruopus` -- 0.9948 left and 0.9825 right against the source, 0.997/0.993 past the first frame -- proves the AAC copy still wins where it applies and that a mono mix takes the AAC path, and, with `EDITH_OPUS_FILM` pointing at a real-library Opus mkv, cuts a span out of the film itself: correlation 0.9914 at a lag of one sample. The unit test in `export.rs` pins the 256 kbps failure, so the day the crate fixes it this suite fails and the cap can be raised.
✨ feat(export): an untouched Matroska timeline leaves as its own packetsAhmet Kaan Gümüş · ada6ac5
✨ feat(export): an untouched Matroska timeline leaves as its own packets The picture's half of what `copy_audio` already did for the sound: where a copy says exactly what the timeline says, the coded blocks of the source are written straight into the file and no decoder or encoder is opened at all. The gate is the audio one's doctrine, not a looser one -- Matroska in and Matroska out, the source's codec is the one this format carries (HEVC for `Format::Hevc`, AV1 for `Format::Av1`), and nothing has touched a sample: no grade, no speed, no rate conversion, no gap to fill with black, no source of another size, no `ContentEncodings` packing to undo. Every span must begin on a sync point and end where the next begins, which is what placing a cut on a keyframe gives it. All or nothing per export, and that is the interesting constraint: a copied span and an encoded one cannot share one track, because this project's encoders write 8-bit SDR streams with parameter sets of their own and a container states its configuration record once -- splicing them into a Main 10 HDR source would change bit depth and colour mid-track. So the head and tail fragments of a cut that lands mid-GOP are not re-encoded into the copy; they are what makes the whole export fall back to the encoder it always used. A copy keeps its source's `Colour` as well as its `CodecPrivate`: an HDR film copied is still the HDR film, because not one of its samples was touched. The blocks are timed by their source's own timestamps (`MkvMuxer::write_block`) rather than by a frame counter, without which a stream with B-frames -- stored in decode order, timestamped in display order -- would play its groups of pictures in the order they were coded in. An open-GOP source writes leading pictures after a sync point that are shown before it and reference the group before it; at the start of a copied region those references are not in the file, so they are dropped rather than written as pictures no decoder can put back together. The region still starts at the timeline frame it owns, so the sound never drifts. Measured on a real-library 4K x265 HDR Matroska of 2h30m (167671 pictures), five minutes cut out of the middle on two sync points: the export takes 162 s and writes 10.8 GB, against a re-encode of the same timeline measured at 0.94-1.75 pictures a second -- 25 to 47 hours for the same file. Every block sampled either side of the join is its source's own bytes, the shown order is one unbroken frame grid, and the pictures two seconds either side of the join decode through this project's own decoder without an error.
✨ feat(subtitles): as many tracks as you want, embedded in the exportAhmet Kaan Gümüş · 28e2853
✨ feat(subtitles): as many tracks as you want, embedded in the export Subtitle tracks now work the way audio and video tracks do: add as many as you like, remove any of them, and every track with cues on the timeline is written into the exported file. Add and remove - "+ S" beside "+ V"/"+ A" imports every subtitle track in a picked file; each row carries its own "x". Pointer and keyboard doors share one implementation and refuse identically, before any chooser opens. - Project::remove_subtitles / PlaybackSession::remove_subtitles, with the index fixup in one place so a removal cannot repoint the overlay. Embedded in the output - ExportSettings.subtitles is a list; the Matroska muxer writes N tracks from number 3 up, ceiling derived from the encoding (0x7F - SUB_TRACK_FIRST) because track 127 is the all-ones VINT our own reader maps to "unknown" and would silently lose. - mp4 carries them too, as real tx3g timed text. The old "an mp4 carries none" was a false refusal: mp4 0.14 has MediaConfig::TtxtConfig all along. Samples are built from cue boundaries, so gaps are empty samples and the track spans the film. - of_mp4 reads them back, so edith re-imports its own output. Verified against a file ffmpeg muxed, which writes mdhd in microseconds where we write milliseconds. - The export set is derived from timeline_cues per call, so it cannot desync; the card names a track it leaves off, and counts past the width budget rather than eating the card. Language and title - SubtitleTrack carries language and name apart; the guess-them-back heuristic is gone. LanguageBCP47 is read and mapped to a 3-letter code (ffmpeg reads no BCP-47 at all, so writing it would have made the language invisible). A 17-track subtitle library file and a dual-language one no longer read "und". Media bitrate in properties - engine::probe_bitrate opens no decoder; all three numbers share the container's duration, so total >= video + audio holds by construction. Within 0.004% of ffprobe across the library. - Both properties cards show it; a dual-audio file says which of how many. The line picks one unit off its smallest stated component, so a real value never renders as 0.00. Off the render thread - The subtitle walk moved to the background executor at every door: 1324ms -> 0.1ms on a 3.1GB film, 234ms -> 5.0ms on a 25.4GB/35-track one. (The media walk is still on the render thread; separate slice.) False refusals removed - .mks and .mka were refused while the compiled-in Matroska reader parses them; is_matroska now takes the standard's closed set. - The audio-only "sound alone" sentence was unreachable when every pick was a bitmap track. Subtitle-free exports stay byte-identical: 294a8b0c (hevc mkv), 8c16b8b1 (default mp4).
2026-08-11
✨ feat(export): a file says which matrix its numbers are in, and its clips are all in that oneAhmet Kaan Gümüş · 907dfc5
✨ feat(export): a file says which matrix its numbers are in, and its clips are all in that one Exports carried no colour tags at all: the numbers went out as they came off the decoder and every reader downstream had to guess. A 601 clip beside a 709 one went out as two spaces in one file, and nothing said so. Now every export declares a space -- BT.709 at 720 lines and up, BT.601 below, the same rule a reader with no tags applies -- in the Matroska `Colour` element and the mp4 `colr` box, and a clip coded against the other matrix is rewritten into it before it is graded. Same-space clips take the path they always did and not a byte is touched.
🧹 test(scratch): a fixture directory is deleted by the test that made itAhmet Kaan Gümüş · 5c39124
🧹 test(scratch): a fixture directory is deleted by the test that made it Every suite here made its own directory under /tmp with a name and a process id and then walked away from it: 2907 `ve_*` directories, 6.4G of a 16G tmpfs, none of them reclaimable by anything but a person with `rm`. `engine::scratch::Scratch` is the one place a throwaway path comes from now -- a directory, or the single file inside one -- and `Drop` is what takes it back. That is the whole reason it is a guard rather than a cleanup call at the end of a test: unwinding runs `Drop`, so the *failing* tests, which are exactly the ones that used to leave the most behind, clean up like the passing ones. It derefs to a `Path`, so the call sites did not have to change: the helpers that handed back a `PathBuf` hand back one of these. The prefixes stay what they were, so a directory is still recognisable while a test is stopped in it. Nothing about what a test *does* moved -- only where its fixtures live and when they die. Driven: the whole engine suite and the app's own tests run with the count of `/tmp/ve_*` before equal to the count after.
✨ feat(export): the subtitles leave with the fileAhmet Kaan Gümüş · df92458
✨ feat(export): the subtitles leave with the file A Matroska export now carries the picked subtitle track as S_TEXT/UTF8: a TrackEntry beside the picture and the sound, and one BlockGroup per cue — Block plus BlockDuration, because a SimpleBlock has nowhere to say when a line goes away. Interleaved into the clusters as the AAC packets are, so a player has the cue by the time it needs it. The cues are put on the exported timeline first. A track that came out of a media file is timed against that file, so it is carried through the spans that still play it: a cue over a stretch that was cut out is gone, one straddling the cut keeps the half that is still there, and everything after a rippled delete moves back with the picture it belongs to. A standalone .srt has no clip to hang on and no offset to shift by, so it stays on the timeline's own clock — the one the overlay drew it at — clipped to the exported length. A cue nothing clipped keeps its own microseconds, so an untouched timeline exports the times the source states, to the millisecond the file is written in. An mp4 says so instead of pretending: tx3g is a different beast and nothing here writes one, so the export card carries a Subtitles row that reads "test_subs.srt → embedded", "mkv only — an mp4 carries none" or "none" before the button is pressed. Exports without a picked track are the files they always were: the track entry and the blocks are written only when there is one.
✨ feat(export): HEVC leaves the way it came in — intra, in either boxAhmet Kaan Gümüş · 12f8cb7
✨ feat(export): HEVC leaves the way it came in — intra, in either box The one codec edith could read and never write. OxideAV's pure-Rust H.265, vendored from git master (its released 0.0.9 is pre-encoder) with one marked patch: the intra SPS writer had no conformance window and refused any dimension off the 16-sample CTB grid, so 1920x1080 could not be written at all. It is now coded padded to 1088 with the edge replicated and cropped back by the SPS, which is what ffprobe reads out of the bitstream. Intra-only, and every row says so: the inter modes code 1080p at 0.81 fps across twelve cores and the intra path does 4.30 on the same picture, so the export is an intraframe master — ProRes-shaped, large files, every frame a cut point — rather than a delivery file nobody would wait for. The AU is a stateless function of one frame, so frames fan out across twelve lanes and are collected back in display order. Two rows, `h` and `x`, because a codec and a container are two choices: the `hvcC` record built from the encoder's own VPS/SPS/PPS goes into a Matroska `CodecPrivate` and into an mp4 `hvc1` sample entry unchanged, so the two files are one stream written twice. Both re-open in edith through the plugin, sound and all.
✨ 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
✨ feat(export): AV1 comes back out, in a Matroska file this editor reopensAhmet Kaan Gümüş · dd3a2a8
✨ feat(export): AV1 comes back out, in a Matroska file this editor reopens
The export card's second picture format. AV1 already *arrives* here as
Matroska (`mp4 0.14` has no `av01` sample entry at all, so `demux` walks
the EBML by hand); it now leaves the same way, through an `MkvMuxer`
written beside the mp4 one -- EBML header, `Info`, one `V_AV1` track whose
`CodecPrivate` is a real `av1C` record built from the first keyframe's
sequence header OBU, then clusters that open on every keyframe. The
segment size and the duration are the only two fields patched at `finish`.
Matroska rather than AV1-in-mp4 because the reader for it already exists:
the round trip closes against this project's own `Demuxer`.
Picture only, and said so on the row before a destination is picked ("AV1
picture in .mkv — no sound: export WAV or FLAC for that"). Matroska
carries no sound this project can *write* -- no AAC or Opus encoder here
-- and an AAC track copied in would be one this engine's own reader leaves
silent (`AudioSession::open` refuses Matroska audio). A silent track
written anyway is the one failure a user would not notice.
The encoder pair mirrors H.264's: `rav1e` in software, the plugin's new
`vh_enc_av1_open` on the GPU. The hardware seat is wired, tested and
**opt-in** (`VE_HW_AV1=1`): the vendored cros-codecs AV1 encoder took the
radeonsi box this was written on into an amdgpu hard recovery, and a
driver reset is not an export. `rav1e` is not a new dependency at all --
`ravif` already locks the same 0.8.1 -- and is built with `asm` off (no
`nasm` in this build) and `threading` on: 39 s for the 5 s 720p fixture,
progress reported the whole way.
HEVC and VP9 are rows too, refused by name: no encoder in this stack and
patent-encumbered, and superseded by the AV1 row above.🐛 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.
✨ feat(engine): real silent AAC for export gaps, link + overflow guardsAhmet Kaan Gümüş · 301e29b
✨ feat(engine): real silent AAC for export gaps, link + overflow guards Grafts the losing candidate's hand-written AAC-LC silence into the offset-placed lanes: a gap in the audio lane is copied as max_sfb=0 access units (4 bytes mono, 7 stereo, verified against our own decoder) instead of being spent as stts duration on the packet in front of it. That retires the 23 ms leading-gap misplacement, so every packet is one 1024-frame sample table entry again and the muxer takes no duration. from_parts becomes the release-active untrusted door it claims to be: per-cause errors, an end-overflow bound, and the grouping rules -- a link id names at most one clip per lane, and a pair covers one span. The parser bounds the same overflow by line number, `place` strips the incoming group id, and the two lane surgeries (`clear`, `open_room`) drop the id from what they cut, which is where duplicates came from.
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2Ahmet Kaan Gümüş · 59eb78e
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2 Project gains two lanes; a Clip now carries `start` (its timeline placement) and `link` (group id), so a gap is simply the absence of a placement rather than an object anyone has to keep in sync. Moves and trims become arithmetic on start/in_frame; the lane invariant (sorted, non-overlapping) is checked in from_parts, at the .edith parser, and asserted after every mutation. split cuts every lane and hands the two sides fresh group ids; regroup is its exact inverse. delete still ripples both lanes (the app keeps its behaviour), lift removes one placement and leaves a hole, place is the per-lane overwrite that can make one. A video gap plays as black frames from a worker that opens no file -- same channel, backpressure, cancel and retire path as a decoder -- and exports as encoded black. An audio gap is synthesised zero chunks, real ones, so the master clock keeps counting through it; on the export side it is spent as stts duration on the packet beside it, since there is no AAC encoder to make silence with. .edith v2 writes one line per placement per lane; v1 files still load, as fully-grouped gapless lanes, and save as v2.
2026-08-09
✨ feat(engine): export — edit list to mp4, HW encode with SW fallbackAhmet Kaan Gümüş · 86d5c15
✨ feat(engine): export — edit list to mp4, HW encode with SW fallback Worker thread per export: decodes each clip straight to I420 (never through DecodeSession, which only speaks BGRA), feeds one encoder chosen once -- VA-API plugin unless VE_SW_ENC=1 or the plugin is unavailable, rusty_h264 Fast/CBR otherwise -- and muxes the access units as they come. Audio is copied packet for packet, so the file has to be opened before the first video sample is written. Cancel and every error path delete the partial file; progress is a permille atomic a render loop can read without a lock. mux: the movie timescale moves to 90 kHz. mp4 0.14 converts each sample duration into the movie timescale with its own integer division, so 1 kHz lost 0.33 ms per frame and made a 4.000 s export announce 3.960 s.
✨ feat(engine): export lane 1 — mux module, AAC packet copyAhmet Kaan Gümüş · 5ce68fe
✨ feat(engine): export lane 1 — mux module, AAC packet copy mux.rs is the write side of demux.rs: split_annex_b/nal_type feed a repack to 4-byte-length-prefixed samples (mp4 0.14 hardcodes length_size_minus_one=3), SPS/PPS/AUD/SEI stripped out of the sample bytes, is_sync taken from an actual NAL type 5 rather than GOP arithmetic. Mp4Muxer::create wants the parameter sets up front, so mux::parameter_sets pulls them out of a buffered first access unit before the muxer exists. Timescales are 90000 video / sample_rate audio / 1000 movie, per-frame duration (90000/fps).round(), and mp4 0.14 ignores Mp4Sample::start_time on write -- timing is duration accumulation only. An SPS shorter than 4 bytes panics inside the crate (avc1.rs indexes sps[1..3]), so create rejects that and the other degenerate shapes up front instead. Audio is copied, not re-encoded: there is no pure-Rust AAC encoder and mp4 0.14 has no PCM MediaConfig, so the only honest option is to hand the source packets back through verbatim. AudioSession::copy_segments does that -- stts walk to packet ids, no decode, bytes straight from read_sample. Cut points do not land on 1024-sample boundaries (23.2 ms packets vs 33.3 ms frames), so a bresenham accumulator picks the packet run per segment and keeps the cumulative A/V offset under 512 samples, proven by induction over the carry and measured over 200 random join lists. The first segment starts one packet early to feed the 1024-sample priming drop; interior segments do not, because an extra head packet there is 23 ms of pre-cut audio at every join and it would not fix the missing MDCT predecessor anyway. That artifact is documented at the seam.