Open Tesla2k opened 4 years ago
This is hard to implement on a web client for things other than images. For images it is easy using browser canvases but for Audio/Video it would mean importing very large libraries if at all possible for more than a couple of file types.
Images are already tracked in https://github.com/vector-im/riot-web/issues/4144
https://stackoverflow.com/questions/9635835/solutions-to-compress-audio-in-browser Makes only one valid Suggestion for Audio which hasn't been updated in 6 years: https://github.com/jpemartins/speex.js
Cannot even find such a library for Video.
What about the desktop client? As far as I know it is just the web client with electron. But maybe there it should be easier to add. I can not find a issue tracker for it that's why I posted it here.
Sure, it'd be more reasonable to add to the desktop client given that ability for native extensions. Could add an FFmpeg dependency or whatever
FWIW, ffmpeg has been compiled to wasm: https://github.com/ffmpegwasm/ffmpeg.wasm
Lacks Safari and Firefox support seemingly according to the readme
Also, when resize image - please, save exif information (date of photo, geo-tags and etc.).
Has there been any internal progress on this feature?
Just noticed that for uploading an avatar, it supports a whole boatload of file formats. Including WebP. So modern file formats are absolutely supported, at least in "some" way.
Lacks Safari and Firefox support seemingly according to the readme
Then don't do it on those browsers? I don't see why you'd wait for that.
But also, there's some work done (or being done) on getting libvips to compile to WA so it doesn't need to only work in the desktop app.
Speaking of which, on the desktop app you could just include Sharp as it is today, and immediately start converting whatever image data to WebP. That way, you'll fix the problem for everybody that uses the desktop app (no idea how many % users that is, do we know this?)
Lacks Safari and Firefox support seemingly according to the readme
I'm assuming this was due to the wasm port using SharedArrayBuffer? Support is much better these days :-) https://caniuse.com/sharedarraybuffer
But even if videos wouldn't work, I think even image compression would be quite useful. libSquoosh even goes as far as supporting many modern formats and parameters locally (in the client browser).
Is there currently any kind of way to have Element compress images before sending them? If not, is there an alternative way to do this, e.g. on the server?
@vladh Element on the desktop can already implement this perfectly fine. As it runs on Electron, by extension it must also run Node.js in the background, and therefor Sharp can be implemented without too much effort, I reckon.
The tricky bit is the web client. The good thing, at least in my mind, is there is no law that says the web client and desktop client have to be identical. The problem is purely in compressing images to a modern format. Displaying such images has been possible for years on every browser.
Users expect to be able to just drop a video in the chat and it gets send. Often this videos are to big and so they need to be recompressed.
It would be nice if there would be a message which let you choose to recompress the video at different quality levels (with a hint how large they will be) and also without recompression. For Images there should be the same options when the image size exceeds a certain size. Same goes for audio.
I think this is absolutely needed in all Matrix clients.