Mastodon turns GIFs into silent looping MP4s (gifv); only the first-frame preview was kept. The MP4 is now saved locally and played muted and looping with the still as poster. Animated GIFs from other sites are saved as animated WebP. Migration 025 adds reply_contexts.video and has fediverse contexts with an image fetched again once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
v2.20.1: Moving pictures in reply contexts
Why
The reply https://starpunk.thesatelliteoflove.com/note/20261114032356 answers
an infosec.exchange post with a GIF, but the card showed a still. Mastodon
converts uploaded GIFs to a silent looping MP4 (media_attachments[].type == "gifv", here 320×240, 5.3 s, ~140 KB). Its preview_url is a PNG of the
first frame, which is all v2.19.0 kept.
Changes
| Area | Change |
|---|---|
reply_context._from_status |
A gifv attachment's url goes into the new video field (the preview stays in photo, used as the poster) |
| Migration 025 | reply_contexts.video; fediverse rows with a photo get source = NULL, so the worker's refresh_stale fetches them once more |
avatars.fetch_video |
Saves the MP4 as DATA_PATH/previews/<sha256>.mp4 (8 MB cap, must have an ftyp box); fill_missing/remove_unused cover it |
avatars._save |
Animated GIF/WebP/PNG previews are saved as animated WebP (frames narrowed to 640 px, at most 300 frames) instead of their first frame |
/previews/<name> |
Also serves <sha256>.mp4 as video/mp4 |
| Template | <video autoplay loop muted playsinline poster=…> with the alt text as aria-label, when there is a saved MP4 |
The MP4 is stored as it is: re-encoding would need ffmpeg in the image, and
gifvs are small. Like the images, it has to be served from this site
(default-src 'self' covers media).
Real videos (type == "video") and Bluesky videos still show their
thumbnail: they can be long and have sound.