๐ฏ
My main thing I like to complain about is media. Lack of optimization makes Nostr perform badly and use huge amounts of bandwidth it doesn't have to. Images & video on Nostr need a lot of love.
Login to reply
Replies (4)
Please tell me all the media things I should fix I'll do it this weekend, idk much about this subject.
Easy ones:
PFP optimization. They don't need huge res, 400x400 is ok as they are used for tiny icon sized images. You can crank down the jpeg quality too for massive size savings. A few kB vs a few MB.
Similar for images. Have some sensible default presets for uploads, one dropping the res to 2k on the long side and applying more compression can drop a 6MB image down to a few dozen kB and still look fine for phone size display. Keeping the same resolution but dropping jpeg quality can save a lot too, without much image degradation.
Harder
Video is still a WIP, but huge savings are possible. The videos taken on a phone are meant for archival purposes, and there is a lot of fat to trim.
Example video from my phone. The compressed 1080p version is almost indistinguishable from the original, but it's 93% smaller in file size.
View quoted note โ
This takes time and power to do client side. It would be better done server side, but those solutions haven't materialized yet.
With multiple res available in the m3u8 playlist you can play the small res version in the feed, and switch to higher res in full screen. This saves BW & battery. I've been playing with client side stuff, check the #chonkr feed for samples.
@The Fishcake (nostr.build) is an expert when it comes to this stuff too, he might have some input and good ideas. He's been trying to get this to happen for years, maybe team up and push other clients ๐ค๐
@Enki is working on server side stuff right now too, there's some posts in his feed today.
One more: converting GIF to MP4. A multi MB GIF can be compressed to a few kB of MP4. Most clients play them in the same fashion, so it's an easy win, orders of magnitude less data. Most modern software does this already. If I download a gif posted in Signal it is converted to an MP4.
@โก Dee Kay โก has put in a lot of work on the media code in Amethyst. Aiming your agent at his work there could teach it a lot. He's good to talk with too, he might have some tips.
Deekay's native video compression library for Android. It compresses to single file & playlists with multiple resolutions already. It might make your life easier.

GitHub
GitHub - davotoula/LightCompressor-enhanced: A powerful and easy-to-use video compression library and app (LCe) for android that uses the native MediaCodec API. It supports H.264/H2.65 hardware accelerated encoding and configurable resolution, bitrate, fast-start (streamable), and Gif to Mp4 conversion.
A powerful and easy-to-use video compression library and app (LCe) for android that uses the native MediaCodec API. It supports H.264/H2.65 hardwar...