LGFae / swww

A Solution to your Wayland Wallpaper Woes
GNU General Public License v3.0
2.23k stars 67 forks source link

Support other animated wallpaper formats #171

Open nametable opened 1 year ago

nametable commented 1 year ago

It seems like most places that provide animated wallpapers are providing mp4 downloads rather than gif. Is it feasible to add support for mp4/webm/etc?

Or is there a performance reason for using gif, in which case the best solution would be to convert mp4/webm to gif?

LGFae commented 11 months ago

Decoding mp4 would increase our dependencies significantly. Maybe I will be able to do something about it by changing from the image crate to a system dependency on ffmpeg. That would let us support mp4, but it would take a while for me to implement, I believe.

nonetrix commented 9 months ago

Also it uses CPU currently to my understanding as well, so GPU decoding would be ideal for cards that actually support it well unlike mine (thanks AMD real cool)

LGFae commented 9 months ago

I mean, we only decode once, in the client (we read all frames at once). If we were to support entire videos, then yeah, we would probably need the GPU to do stream decoding, but that would never be the goal (there's mpvpaper for that). Even if we were to support mp4, it would only be for small short videos, if anything.

Right now, the best way to use animated wallpapers would be gifs that don't change a lot. This was on purpose, since those are the type of images I believe work best as wallpapers. I have no intention of having great support for absolutely any kind of video, since that would be very hard (because we wouldn't be able to read all frames of a long video at once -- too much memory usage) and increase our dependencies.

So I don't think CPU decoding is a problem; swww doesn't really have to be that fast at decoding.

KAGEYAM4 commented 7 months ago

@LGFae Do you have some automation setup for -> getting wallpapers/gifs > rotating through them > deleting old ones > loop

Any resource you can point for gifs?

NaiveInvestigator commented 6 months ago

I have found this awesome tool which converts mp4s into gifs fairly well! It is not a solution but atleast it works for now: https://github.com/ImageOptim/gifski

Do you have some automation setup for -> getting wallpapers/gifs > rotating through them > deleting old ones > loop

I dont have anything that complex, but i do have a simple script which just cycles randomly in my wallpaper dir

#!/bin/bash

# Get a random file from ~/Pictures
random_file=$(find ~/Pictures -type f -follow | shuf -n 1)

# Check if a file was selected
if [[ -z "$random_file" ]]; then
    echo "No files found in ~/Pictures directory"
    exit 0
fi

# Execute swww with the random file
swww img "$random_file"
KAGEYAM4 commented 6 months ago

I have found this awesome tool which converts mp4s into gifs fairly well! It is not a solution but atleast it works for now: https://github.com/ImageOptim/gifski

Do you have some automation setup for -> getting wallpapers/gifs > rotating through them > deleting old ones > loop

I dont have anything that complex, but i do have a simple script which just cycles randomly in my wallpaper dir

#!/bin/bash

# Get a random file from ~/Pictures
random_file=$(find ~/Pictures -type f -follow | shuf -n 1)

# Check if a file was selected
if [[ -z "$random_file" ]]; then
    echo "No files found in ~/Pictures directory"
    exit 0
fi

# Execute swww with the random file
swww img "$random_file"

anything for automating gettings images/videos/gifs ( mostly gifs )

I-Am-Xil commented 3 days ago

Decoding mp4 would increase our dependencies significantly. Maybe I will be able to do something about it by changing from the image crate to a system dependency on ffmpeg. That would let us support mp4, but it would take a while for me to implement, I believe.

How feasible could it be to instead add support for avif? It's a format 20 times smaller than gif, a size which would make it comparable to that of a png, while still providing fluid animations with less quality loss overall.

This could drop the "need" of GPU acceleration in order to make the cache phase faster for animated wallpapers.

A bit out of scope, but it's the recommended format for Firefox animated wallpapers. Making the change from gif to avif reduced the size of the wallpaper from a 50mb mp4 to a 20mb gif to a 1.5mb avif. A great thing since anything above 2mb for a firefox animated wallpaper means constant lag to older computers.

I think the support for avif could be a good addition. Since it is mildly annoying to boot my system and having to wait around 30 seconds to see my wallpaper.

Edit:

I just saw the other issue regarding avif support. I still think it'll be a nice addition. Since it's a wallpaper for digital and therefore with an sRGB colorspace, 8bit encoding is just what it's needed. Although I don't know if this could be a problem with filters since I haven't looked at the implementation we have for it and don't use them myself.

Edit 2:

I know we have webp support but lossy webp can cause dithering and blurring while lossy avif doesn't have perceivable visual artifacts.