Automatic media compression on upload, on by default

(#1441) Feature Open: Under consideration media

Current problem

Storage of Media can be expensive. In fact Fluxer has that 3 year expiration date, so.

Proposed change

Automatic Image/video compression of uploaded images. This feature can branch from the singular uploaded media in the chat, to server-IMPOSED setting, which if branched more it expand to FORCE users to go through a process of compression of their media (every uploaded media must go through the process of compression in that specific server)
  1. You can start by adding a setting on the user client side that handles this:
  • "Do you want compression to be turned on as default for every media u upload?" (can be turned off in the singular Edit Attachment) ON/Off
  • A setting to sub-choose if the compression must be on/off for image-only, video-only or both.
Note: [[ I suggest for Fluxer to have the compression of images-only to be set to ON as default, users can change it if they wish in the settings. It is a "dirty" move but storage can cost. ]]
  1. Server-side settings, where the server admin choses if users are allowed to upload Uncompressed.
-"Force the compression of media?" On/Off (users cannot turn off compression in this server, if they want to upload the must compress) -same as above, image-only, video only, or both You can work out the details, for example when the image is too small already, less than 100kb or 200kb, maybe the compression isnt needed. If a video is 10mb, and 2-4 minutes long, and with a resolution of 450p, compression is NOT needed just based on these the first two parameters. It is to not overdo the compression time on the users, which takes time. A kind of video-size/video-duration parameter to see if it is worth to compress seems very fair.

Additional information

Users dont care about the size of what they upload, nor do I. Modern phones do a screenshot and the image might be sized 800kb, 500kb. Even worse with screenvideo records. If you compress them on a basic website like this one: https://image.online-convert.com/convert-to-png a basic 700kb image can become easly 100-150kb without touching any extra setting and directly click convert, it comes out smaller, a lot smaller. So I suggest you to pick the fastest OFFLINE algorithm you can pick, and put that for the feature I described above.

7 comments

Sign in with Fluxer to comment and vote.
Comment by @Palloxin
RexSystem 2 votes originally by @Palloxin on GitHub OP 1 reply
Just compressing a screen video, it reduced its size by SO MUCH. Note that the resolution and fps and quality is almost the same image Before compression: a After compression: a2
Comment by sophie 🌸
i'd be interested to see if JXL and AV1 can be encoded entirely within the web client; even the faster preset speeds should provide decent bitrate reductions
Comment by Fullest
FullestReviewer 1 vote originally by @Emptiest on GitHub 3 replies
Video compression is pretty expensive and is always lossy. I doubt this will be feasible at scale for video, and might not have desirable outcomes for users when they see obvious degradation in the quality. Might be possible for static images, but the benefits are fairly limited at that point.
Comment by @Palloxin
RexSystem 2 votes originally by @Palloxin on GitHub OP 1 reply
That's why it should be a user preference. The expensive part is just users using their hardware to compress it. Although it is lossy, in very very few occasions I needed the video precision to show text inside videos. The length of the compression process cannot be that much since max file size is 25mb. If the user has plutonium, I dont think they need compression at all
Comment by _
_ 2 votes edited
Some other things to consider:
  • Client side compression means having to account for GPU accelerated encoder availability
  • If the goal is to perform CPU encoding to avoid that problem, there is still an issue of deciding which codec to use that can balance processing cost and quality
  • The simple answer for quality output at a lower bitrate is AV1, but pretending SVT-AV1 is the encoder of choice, a short 4K video with a lower bitrate could still be a very slow process, especially depending on the CPU and available RAM (as it multithreads by default)
That said, I do think a feature that automatically prompts to offer client side compression if a video file is too large to fit within the user's quota would be nice.
Comment by Floogle
Telegram offers a slider to compress the video client-side, so users can choose how sharp they want their video. A user might want to enable this because it lets them upload faster on a spotty connection.