personal web client for Bluesky
typescript solidjs bluesky atcute

fix: adjust the bitrates

mary.my.id 3baa87c8 2afdda79

verified
Changed files
+6 -1
src
components
composer
+6 -1
src/components/composer/workers/gif-conversion.ts
··· 18 19 { 20 const { image } = await decoder.decode({ frameIndex: 0 }); 21 22 output = new Output({ 23 format: new WebMOutputFormat(), 24 target: new BufferTarget(), 25 }); 26 27 - videoSource = new VideoSampleSource({ codec: 'vp9', bitrate: 1e6 }); 28 output.addVideoTrack(videoSource); 29 30 await output.start();
··· 18 19 { 20 const { image } = await decoder.decode({ frameIndex: 0 }); 21 + const { displayWidth, displayHeight } = image; 22 + 23 + // Scale bitrate based on resolution (~5 Mbps at 1080p, sqrt curve for smaller sizes) 24 + const pixels = displayWidth * displayHeight; 25 + const bitrate = Math.max(500_000, Math.min(8_000_000, Math.round(Math.sqrt(pixels / (1920 * 1080)) * 5_000_000))); 26 27 output = new Output({ 28 format: new WebMOutputFormat(), 29 target: new BufferTarget(), 30 }); 31 32 + videoSource = new VideoSampleSource({ codec: 'vp9', bitrate }); 33 output.addVideoTrack(videoSource); 34 35 await output.start();