Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
13.05k stars 1.5k forks source link

Support more formats (PNG…) for thumbnail and preview image #1953

Open mmuman opened 5 years ago

mmuman commented 5 years ago

On low resolution videos (like, capture of old computer emulators), using jpeg for thumbnails makes them very blurry. Supporting PNG would fix this.

Even though it might be a wanted effect, it's not always the case. Example: vlcsnap-2019-07-02-04h05m46s703 vs treize

Chocobozzz commented 5 years ago

You mean when you upload a specific image for a video thumbnail? Or when PeerTube automatically created the thumbnail from the video?

We can't support png images for thumbnails because they are federated and it could create storage/bandwidth issues. But maybe we can improve the jpeg compression or ffmpeg thumbnail generation :thinking:

mmuman commented 5 years ago

I mean uploading an existing png file. I didn't try letting it make a thumbnail from the video, but I suspect it wouldn't be any better than a jpeg.

I don't really see the problem with PNG, the size really depends on the content, a simple graphic can probably be smaller in a PNG than JPEG.

Chocobozzz commented 5 years ago

I don't really see the problem with PNG, the size really depends on the content, a simple graphic can probably be smaller in a PNG than JPEG.

Good point. We would just have to check the PNG thumbnail file is not bigger than a limit (~10ko for example) after sharp resizing.

notthewave commented 3 years ago

2280

similar issue

aschaap commented 3 years ago

What about WebP? Lossless WebP tends to be significantly smaller than PNG, and has become well-supported across browsers.

notthewave commented 3 years ago

Didn’t know webP could be lossless. I spin up ImageMagick real quick and make a comparison.

notthewave commented 3 years ago

magick wizard.png -quality 50 -define webp:lossless=true wizard.webp

webp whielded some amazing results.

spin up ImageMagick real quick

9h later... sorry lol

notthewave commented 3 years ago

ironically the jpeg above seems to be 27K big Lel

aschaap commented 3 years ago

I think part of the reason the JPEG is 27 KB is that its quality is set at 95 rather than something like 80.

I can confirm the lossless WebP equivalent of the PNG is 1.8 KB. The PNG itself could be optimized to around 2 KB, but at that point conversion seems like the better choice unless compatibility is a concern for a certain use case.

Agorise commented 3 years ago

WebP is awesome, especially little animated webp images. They load fast, look great and enable the designer to really do some eye-catching work.