Bug 467986 - animated avif files stutter while being played
Summary: animated avif files stutter while being played
Status: REPORTED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: 22.12.3
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-30 23:18 UTC by sk.griffinix
Modified: 2023-04-04 22:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sk.griffinix 2023-03-30 23:18:05 UTC
STEPS TO REPRODUCE
1. Open an animated avif file. eg https://drive.google.com/file/d/1k5gT_sn6AffYWiYPoP_IwN0MIrKzsV9O/view?usp=sharing 

OBSERVED RESULT
AVIF file stutters while playing

EXPECTED RESULT
Avif file should play smoothly

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: kernel 6.2.7
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Animated AVIF file plays smoothly in firefox nightly. I think it may be a qt bug since other qt based image viewers like qview had the same issue.
Comment 1 dnovomesky 2023-04-01 06:17:01 UTC
Performance of AVIF decoding depends on how libavif library was configured.

If libavif uses both latest dav1d library and libyuv, performance is the best.

Run one of these commands and on the bottom it will display what decoders and encoders are available
avifdec
avifenc

The performance could be improved by caching decoded frames in memory but memory consumption would be high.
Comment 2 sk.griffinix 2023-04-02 15:29:04 UTC
(In reply to dnovomesky from comment #1)

> avifdec

Version: 0.11.1 (dav1d [dec]:1.1.0, aom [enc/dec]:v3.6.0, rav1e [enc]:0.6.3 (v0.6.3), svt [enc]:v1.4.1-dirty)
libyuv : available (1813)
Comment 3 sk.griffinix 2023-04-02 15:34:36 UTC
(In reply to dnovomesky from comment #1)

Does firefox (installed from repos) use separate versions of dav1d or libyuv than the system's? I get proper playback in firefox. In gwenview, it plays for 3-4 seconds than stutters for a second then plays for 3-4 seconds and so on. Also, this behaviour was present since quite long time, but I thought it was just my pc that was incapable. But apparently it is a bug since one software can play it smoothly
Comment 4 dnovomesky 2023-04-04 10:25:22 UTC
Could you test also with qimgv viewer?
Comment 5 sk.griffinix 2023-04-04 10:55:39 UTC
Same error present in qimgv (1.0.2) built against qt 5.15.8.

Attaching a recording of the same https://drive.google.com/file/d/1W-G3X4b9VcWDQeZLLBW6bcBz-x9n5ODV/view?usp=sharing
Comment 6 dnovomesky 2023-04-04 22:31:19 UTC
The animation has full HD resolution and 30fps.
It means that duration of one frame is 33,3 milliseconds.
Majority of frames take approximately 10 milliseconds to decode but there are few rare frames taking much longer to decode and convert to RGB. At these points there are delays in the animation.

It is not a problem for video players as they decode few frames in advance.

Gwenview uses QMovie class which decodes one frame at a time - it can cache everything or nothing.
Current implementation of QMovie is not ideal for big videos.