Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(server): 画像圧縮周り(主にサムネイルの仕様)の変更 #10287

Merged
merged 8 commits into from
Mar 11, 2023

Conversation

tamaina
Copy link
Contributor

@tamaina tamaina commented Mar 10, 2023

#9283 (アニメーション画像以外)
Resolve #10149
Resolve #10283
Resolve #6626
Fix #10274

What

ファイルアップロード

  • thumbnail
    • sharp.jsが扱えるファイルであれば全てサムネイルを生成するように
    • アニメーション画像はAnimated Webpに、静止画はAvifに変換するように
    • 高さを280から422に
  • webpublic
    • Mastodonはv4であってもAvifが扱えないようなので、webpにする
    • jpegのwebpublicはwebpにするように
    • ロスレスはpngのまま(ロスレスwebpが微妙なため)

メディアプロキシ

  • staticはAvifに、高さを422に
  • previewはAvifに
  • svgはwebpに変換していたのをavifにする

画像処理系

  • webpのquality, effortを落とす(サーバー軽量化)
  • avif処理系を追加
  • リファクタリング
  • sharp.jsはtiffを扱えるため、isMimeImageでtiffを弾かない

API

サムネイル専用の画像が生成されていなければ、thumbnailUrlはnullにするように
(現状、thumbnailがなければwebpublic, オリジナルが突っ込まれることになっている)

クライアントでフォールバックするように

Why

通信量削減

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR labels Mar 10, 2023
@github-actions github-actions bot requested a review from rinsuki March 10, 2023 07:51
@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Merging #10287 (e9197d5) into develop (cc7fd2f) will increase coverage by 5.73%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop   #10287      +/-   ##
===========================================
+ Coverage    73.41%   79.15%   +5.73%     
===========================================
  Files          809       94     -715     
  Lines        77526    11372   -66154     
  Branches      5413      119    -5294     
===========================================
- Hits         56915     9001   -47914     
+ Misses       20611     2371   -18240     
Impacted Files Coverage Δ
packages/frontend/src/components/MkMediaImage.vue 92.70% <0.00%> (ø)
packages/frontend/src/scripts/media-proxy.ts 18.75% <0.00%> (-1.25%) ⬇️

... and 715 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@saschanaz
Copy link
Member

saschanaz commented Mar 10, 2023

アニメーション画像はAnimated Webpに

AV1にしちゃダメですか?

@tamaina
Copy link
Contributor Author

tamaina commented Mar 10, 2023

AV1

  • 重くない?(いやAnimated Webpも重そうだけど
  • 画像から動画にするというのはクライアントの書き換えが面倒そう

@tamaina
Copy link
Contributor Author

tamaina commented Mar 10, 2023

p1.a9z.devに適用したけどアップロードのavifの生成がうまくいってない

@saschanaz
Copy link
Member

AV1

* 重くない?(いやAnimated Webpも重そうだけど

* 画像から動画にするというのはクライアントの書き換えが面倒そう

SafariがAV1もVP9もVP8 WebMさえもサポートしてないのでanimated webpでいいかもです

こんなせかい

@Mogyuchi
Copy link

(参考情報)
iOS/iPadOS 16.4 で AV1 コーデックのサポートが追加されるようです。

@saschanaz
Copy link
Member

saschanaz commented Mar 10, 2023

(参考情報)
iOS/iPadOS 16.4 で AV1 コーデックのサポートが追加されるようです。

あれはWebRTC用で<video>でのサポートはないようです(macOSでは確実に再生できません)

@Mogyuchi
Copy link

(参考情報)
iOS/iPadOS 16.4 で AV1 コーデックのサポートが追加されるようです。

あれはWebRTC用で<video>でのサポートはないようです(macOSでは確実に再生できません)

マジすか
情報ありがとうございます🙇

@@ -16,7 +16,7 @@ block og
meta(property='og:title' content= title)
meta(property='og:description' content= post.description)
meta(property='og:url' content= url)
meta(property='og:image' content= post.files[0].thumbnailUrl)
meta(property='og:image' content= post.files[0].thumbnailUrl ?? post.files[0].url)
Copy link
Member

@saschanaz saschanaz Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thumbnailがない場合thumbnailUrlがurlになるようにするのはどうです?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

サムネイルがアニメーションするようになったのでthumbnailUrlをフォールバックしないようにする必要はなくなったのか

@syuilo syuilo merged commit 88e3d3e into misskey-dev:develop Mar 11, 2023
@syuilo
Copy link
Member

syuilo commented Mar 11, 2023

👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR
Projects
None yet
4 participants