Ask Lemmy
A Fediverse community for open-ended, thought provoking questions
Rules: (interactive)
1) Be nice and; have fun
Doxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them
2) All posts must end with a '?'
This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?
3) No spam
Please do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.
4) NSFW is okay, within reason
Just remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either !asklemmyafterdark@lemmy.world or !asklemmynsfw@lemmynsfw.com.
NSFW comments should be restricted to posts tagged [NSFW].
5) This is not a support community.
It is not a place for 'how do I?', type questions.
If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email info@lemmy.world. For other questions check our partnered communities list, or use the search function.
6) No US Politics.
Please don't post about current US Politics. If you need to do this, try !politicaldiscussion@lemmy.world or !askusa@discuss.online
Reminder: The terms of service apply here too.
Partnered Communities:
Logo design credit goes to: tubbadu
view the rest of the comments
On size, Lemmy uses pict-rs to handle image uploads. There's a per-instance-settable byte limit max on the max file size that can be uploaded to a pict-rs instance. I've got no idea whether it supports animated gifs.
EDIT: So, a bit of experimentation later, Pict-rs does take WebM. And WebM can contain AV1-encoded stuff, which can be lossless. But AV1 doesn't appear to be optimized for GIF-style flat color images, the way MNG and APNG are. Still, you can get a (larger) file which a pict-rs instance will accept as long as it doesn't hit the filesize limit, which represents the video in the GIF file without loss:
collapsed inline media
That slightly more than doubles the filesize.
That being said, I will point out that GIF itself really isn't a great format for this. Like, the reason that many codecs won't do well with this is because they deal poorly with dithered images. The original data (the original original data, pre-GIF-encoding) isn't dithered, and got smashed down to 256 colors and an ordered dither when it was encoded as a GIF, and it'd probably be preferable to not dither it; using that would probably result in a better-quality and smaller video.
EDIT2: It's too bad that pict-rs doesn't support APNG, which it looks like can clamp down on it further:
That's still enlarging it compared to the GIF. But then if we give it a pass through
apngopt
:And now it's 36% smaller than the original GIF. But presently, pict-rs doesn't accept APNGs.
We can upload it to catbox.moe, though:
collapsed inline media
EDIT3: I also apparently yanked the loop setting off somewhere in there, but I'm sure that it's technically possible to have an APNG loop.
EDIT4: Ah, apparently one needs the
-plays 0
flag for infinite looping on ffmpeg; ffmpeg apparently doesn't read that from the source:And there we go:
collapsed inline media
EDIT5: It looks like, while the stock Lemmy Web UI displays WebM and one can see the one I posted on lemmy.today's pict-rs instance above along with the two APNGs on catbox.moe, the alternative Alexandrite Web UI apparently omits showing WebMs. So I don't know what the client support matrix is for all this
gotta worry about pict-rs, the client, and if it's a Web client, the Web browser accessing the client.
EDIT6: Piefed's Web UI looks like it's fine with displaying both the APNGs and the WebM. Searching for a public mbin server
apparently fedia.io stopped allowing anonymous access
based on kbin.earth, it looks like mbin's Web UI doesn't show any of the images inline, though it does provide links to them (which may be a good idea from a privacy standpoint. I've pointed out before that external inline images have privacy implications for users).
EDIT7: Hmm. While pict-rs doesn't accept uploads of APNG on lemmy.today, looking at the pict-rs crate, it says that it does support APNG (and GIF, for that matter).
"Curiouser and curiouser", said Alice.
EDIT8: And based on the
docker/docker-compose.yml
in the Lemmy git repository, the version of pict-rs being used with Lemmy should support it.https://github.com/LemmyNet/lemmy/blob/main/docker/docker-compose.yml
It looks like pictrs's APNG support should have been done as of commit 719626de07cfed793bf6b2b812ce988c8f6acd4c. pict-rs's 0.5.17-pre.9 tag was commit 2c84bb20923f6562c79d0684dc8736965e70a3da, much later, so it should be in. Dunno; maybe there's some restriction in Lemmy that I couldn't find quickly.
EDIT9: And it's not that it was only recently that Lemmy pulled in that version of pict-rs. On the pict-rs repo, checking which releases had the pict-rs APNG support:
The output there includes v0.5.7. In the lemmy repo:
So while they did pull in pict-rs 0.5.17-pre.9 pretty recently, and it's only to be in the 1.0 release (and lemmy.today is running 0.19.11), they pulled in pict-rs 0.5.16, which should contain the APNG support, way back for the lemmy 0.19.4 release. That does sort of suggest that either there's a bug in Lemmy or that there's some intentional restriction that I'm not promptly finding in the Lemmy codebase to prevent GIF and APNG uploads.