Changeset 1c33804 in Klonkt


Ignore:
Timestamp:
06/30/2026 06:02:20 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
adb6291
Parents:
7ecbefc
Message:

fix(video-cover): double the ANMF frame offset (node-webpmux quirk)

node-webpmux returns the raw WebP frame X/Y, which the spec stores as actual/2 (frame offsets are
always even); libwebp/webpmux double it. We placed partial frames at HALF offset -> the moving
sub-frame ghosted over the base frame (a doubled/garbled torus on Mastodon). x2 the x/y offset so
frames land at their true pixel position. Verified against the libwebp anim_dump reference: the
composited frame now matches.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/VideoCoverService.js

    r7ecbefc r1c33804  
    4040    }
    4141    const data = Buffer.from(await img.getFrameData(i)); // fr.width*fr.height*4 RGBA sub-region
    42     const fx = fr.x, fy = fr.y, fw = fr.width, fh = fr.height, blend = fr.blend;
     42    // node-webpmux returns the raw ANMF offset, which the WebP spec stores as actual/2 (frame
     43    // offsets are always even); libwebp/webpmux double it. So ×2 the x/y to get the true pixel
     44    // position — else partial frames land at half-offset and ghost over the base. width/height are fine.
     45    const fx = fr.x * 2, fy = fr.y * 2, fw = fr.width, fh = fr.height, blend = fr.blend;
    4346    if (fx === 0 && fy === 0 && fw === W && fh === H && !blend) {
    4447      data.copy(canvas, 0); // full opaque overwrite (the typical base frame)
Note: See TracChangeset for help on using the changeset viewer.