FossifyOrg / Gallery

Browse your memories without any interruptions with this photo and video gallery
https://www.fossify.org
GNU General Public License v3.0
1.78k stars 61 forks source link

[BUG] AV1 playback is having serious performance issues (~10FPS) #251

Open ThomasBaruzier opened 5 months ago

ThomasBaruzier commented 5 months ago

Checklist

Affected app version

1.1.3

Affected Android/Custom ROM version

Android 14 / HyperOS 1.0.2.0

Affected device model

Mi 11 Ultra / SD888

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug

Download this video: video.webm Change the extention from webm to mkv (because github is letting me upload mkv) Play the video in Fossify Gallery

Expected behavior

60 FPS playback

Actual behavior

10 FPS playback

Screenshots/Screen recordings

Fossify: https://github.com/FossifyOrg/Gallery/assets/119688458/948b2e3f-70aa-4b06-ab1e-abdddcc6f2e3

Mpv: https://github.com/FossifyOrg/Gallery/assets/119688458/f5c562a2-f13b-4d98-a39e-bf498b6c8d13

Additional information

Video file was encoded with SVT AV1 PSY SVT-AV1-PSY 37a5609 (release 2.1.0-A), default settings + crf 40 + tune 3 + sharpness 2 + keyint 600 (10s) + preset 2 + 10 bits + 2 threads. Plays fine in other video players. Please update the video player library used in this project. Dav1d would be a great choice.

Quackdoc commented 5 months ago

seems like fossify is relying on glide for avif decode, and it in turn is relying on a quite old build of libavif, which in turn seems to be relying on dav1d 1.1.0 there is a significant chance that this is the cause of the performance issues, bumping glide's libavif build would probably fix this issue mostly.

ThomasBaruzier commented 5 months ago

relying on a quite old build of libavif

Seems related to #252

kairusds commented 1 month ago

This is because the video player uses ExoPlayer, as seen here and the app doesn't include any av1 decoder extensions. Also, the libgav1 decoder extension for ExoPlayer is very slow, or doesn't work at all. Chromium/Chrome on the other hand, uses libdav1d for AV1 playback, which is why loading AV1 videos on that browser is usually very fast. There's no libdav1d decoder extension for ExoPlayer yet. The only viable alternatives I can think of are: replacing ExoPlayer with LibVLC, which uses libdav1d and loads AV1 videos pretty fast, but a lot more complex to setup, or, create a dav1d decoder extension for ExoPlayer.

kairusds commented 1 month ago

This is because the video player uses ExoPlayer, as seen here and the app doesn't include any av1 decoder extensions. Also, the libgav1 decoder extension for ExoPlayer is very slow, or doesn't work at all. Chromium/Chrome on the other hand, uses libdav1d for AV1 playback, which is why loading AV1 videos on that browser is usually very fast. There's no libdav1d decoder extension for ExoPlayer yet. The only viable alternatives I can think of are: replacing ExoPlayer with LibVLC, which uses libdav1d and loads AV1 videos pretty fast, but a lot more complex to setup, or, create a dav1d decoder extension for ExoPlayer.

Nvm, some screen recorder videos recorded at 90 fps or higher are having stutters in VLC, while in ExoPlayer it works just fine and doesn't stutter. LibVLC also adds 30-40MB to the app size, so it's generally not worth it. mpv-android might be a better choice.