C ⸝⸝𓏗 ` | ')
/)(\
i made this to use as a pfp but i couldn't find a way to export it as an animated image smaller than a MB ; ;
@pebble does sharkey support webm?
@pebble does it uhhhh support webp

@pebble in case it does, this looks okay at pfp scale i think

ffmpeg command: ffmpeg -i mp4.mp4 -vf scale=300:300,fps=30 -vcodec libwebp_anim -lossless 0 -compression_level 6 -quality 60 -loop 0 -preset picture -an b.webp

@pebble otherwise here’s a gif. both are 300x300@30fps, both around 950KB

gifski command: gifski mp4.mp4 -o a.gif -W 300 -H 300 --repeat 0 --fps 30 --extra --motion-quality 50 -Q 60

@pebble sorry I’m autistic about encoding and squeezing quality in encoding the art is very cute my brain just went monkey mode the moment i read that you’re struggling to compress it ssjsidhsud
@[email protected] kjhd omg !! this is so helpful thank u !!

would it be difficult to make an optimized gif like this from a sequence of PNGs? bc this was originally rendered with a transparent background which mp4 doesn't support
@pebble gifski also takes sequence of pngs :> I’m outside so i cant do it myself but gifski is pretty easy to use in the cli
@[email protected] i'll mess around with it! thank u
@[email protected] idk what you did differently but with the exact same parameters (except framerate being 25 instead of 30) the webp ends up being 1.7MB while the gif ends up being 2.3MB :/ maybe it's the transparency?
@pebble that’s really funky!! i can try messing with it in about 2h if u give me the pngs
@[email protected] https://f.pebb.in/frames-11kmyDkn.zip here u go ! no pressure though don't feel like u have to
@pebble don’t worry about pressuring me :> I’m just autistic about it you’re not pressuring at all 🩷

@pebble ah, well, as i’m beginning to find out, it is very hard to optimize gifs with transparency because gif optimisation heavily relies on not discarding the previous frame (because gif has very basic tools for “only discard pixels in this rectangle please”). ive done everything i can to squeeze it while not losing too much quality. here’s 160x160@25fps for around 1MB

and the commands:

ffmpeg -framerate 25 -i ./frames/%04d.png -c:v libvpx-vp9 -filter_complex "[0]lutrgb=a=val+val*maxval" -crf 15 -b:v 0 -pix_fmt gbrap -strict experimental ./a.webm -y ffmpeg -c:v libvpx-vp9 -i a.webm ./new-frames/%04d.png -y gifski ./new-frames/*.png -o a.gif -W 160 -H 160 --fps 25 --repeat 0 -Q 50 --extra

@pebble literally the 2 ffmpeg commands just do the following 2 things:

  • slightly reduce quality by converting it to vp9 (vp9 might have something better to say about quantising the colours :P)
  • replace all alpha that’s not 0 to 255 i.e. remove all semi-transparent pixels. this just helps gifski
@[email protected] that makes sense.. thanks a lot for helping out with this !! i really appreciate it