[RPi4] AV1 Capabilities

  • I've read comments from people saying they can play AV1 media on their rpi4 (no LE, just raspbian) while others say they are choppy.

    I'm using LE 11 and I'm one of the later ones. On slow scenes you can see it drags, while on fast action scenes you can definitely see the jumps.

    I've noticed that there have been recent improvements in the AV1 decoder dav1d with latest 1.5.0 even saying "Optimize Armv8.0 NEON"

    And LE HEAD has been updated to use that latest version https://github.com/LibreELEC/Libr…av1d/package.mk


    What I'd like to know is if anyone running nightly LE12 (note LE 12.0.1 doesn't have latest dav1d) can play 1080p AV1 smoothly?

    Is there hope for the RPi4 or should I just stop dreaming and move on to the RPi5?


    For AV1 video samples:

    http://download.opencontent.netflix.com.s3.amazonaws.com/AV1/Sparks/Spa…80-2194kbps.mp4 (slow scene)

    https://test-videos.co.uk/vids/sintel/mp…080_10s_2MB.mp4 (fast scene)

    https://test-videos.co.uk/vids/sintel/mp…080_10s_5MB.mp4 (fast scene)

    more bitrates on https://test-videos.co.uk/sintel/mp4-av1


    Thanks

  • Go to Best Answer
  • Random test samples is a waste of time.

    Video codecs have standard levels and profiles. You need to find the technical details of those, and encode clips in such a way that they use the maximum allowed frame size, bitrate, tiles etc for that level and profile. Then you test each clip and depending on which plays perfectly you can say you are Main Profile Level 3.1 compliant (or whatever). Then you know in future how to encode compatible content.

  • With latest nightly, you can enable NUMA to get better performance. See numa thread.

    Make sure bootloader is updated to latest and set:

    SDRAM_BANKLOW=1 (for pi5)

    SDRAM_BANKLOW=3 (for pi4)

    using using rpi-eeprom-config.


    From previous testing, on a pi5 I'd expect any 8-bit 1080p60 AV1 to play fine, and most 10-bit 1080p60.

    1080p24/1080p30 will have no problems.

    NUMA likely means any 10-bit 1080p60 will play on a Pi5.


    Pi5 is around 2 to 2.5x the speed of Pi4, so Pi4 abilities will be lower.

    I'd predict any 720p60 AV1 files to play okay, and some 1080p30 on a Pi4.

  • With latest nightly, you can enable NUMA to get better performance. See numa thread.

    Make sure bootloader is updated to latest and set:

    SDRAM_BANKLOW=1 (for pi5)

    SDRAM_BANKLOW=3 (for pi4)

    using using rpi-eeprom-config.

    I'm always up for an increase in performance, especially when it's for free!

    Does this apply to the latest le12 nightly (LibreELEC-RPi5.aarch64-12.0-nightly-20241114-f000f3c.img.gz) or is it just the latest le13 nightly?

    Thanks.

  • Thank you for the replies.

    I've upgraded to the latest LE12 daily https://test.libreelec.tv/12.0/RPi/RPi4/…-37e4458.img.gz and performance has definitely improved. Only getting a few frame drop/skips now. Difference between night and day but still not 100% smooth.


    I can see that this daily uses dav1d 1.4.1 https://github.com/LibreELEC/Libr…av1d/package.mk

    But I can also see that in the past few days HEAD now has dav1d 1.5.1 and kodi 21 omega has had a minor update too (not affecting AV1 mind you but still nice to have fixes).

    Can we expect a LE12 daily to include these updates? Or should I give up and move on to LE13?

    I'm trying to avoid upgrading to LE13 due to my current theme not being available to kodi 22 piers yet.

    EDIT: ok I found this thread explaining the nightly builds Nightly Builds So hopefully a new build should be out in next days.


    However something doesn't add up. Because even though the above linked LE12 nightly is one week old it is still using dav1d 1.4.1 which is almost one year old. But meanwhile other versions have been released before but have not been included https://github.com/LibreELEC/Libr…av1d/package.mk

    I guess I was expecting a github dependabot type of thing but maybe these are manually updated. I've gone full circle and back to my original question :)

    Can we expect a LE12 daily to include an update to dav1d? Or should I give up and move on to LE13?

    Thanks

    Edited 4 times, last by elim_garak (January 22, 2025 at 9:27 PM).

  • TLDR:

    LE 12 nightly-20250116-37e4458 - dav1d 1.4.1, Kodi 21 --> played fine on slow scenes, some "lag/drops" on fast paced scenes
    LE 13 nightly-20250205-562de9e - dav1d 1.5.1, Kodi 22, NUMA --> playback keeps jumping every 4 seconds


    I've now updated LE from LE 12 nightly-20250116-37e4458 to LE 13 nightly-20250205-562de9e and enabled NUMA but AV1 media playback got way worse.
    I suspect this is either a regression in dav1d or some (internal?) LE/kodi config or kodi 22 Piers itself.
    I don't think it's caused by the bootloader or NUMA setting because I first updated to the LE 13 nightly and playback was as bad as after the bootloader and numa changes.

    Previously with LE 12 nightly version the playback of my AV1 file was almost perfect. There was lagging in fast paced scenes and frame drops/skips but it was "tolerable".

    What happens now during playback of my AV1 video file playback starts lagging and then it skips/jumps forward a few seconds.
    From the Player Debug Info I can see the vq is saturated at 99% at 4 seconds. But the Player a/v keeps increasing from 0 to 4 seconds and when that happens the video jumps forward to catch up and this value is reset to 0. The forward caching increases if I pause the video, reaching up to 60%, but doesn't seem to make any difference when I resume playback.
    If I pause the video and wait a few seconds I get something like:

    Code
    aq: 16% 0.620s, Kb/s:113, a/v corrections (50ms): 0
    vq: 99% 3.9s, Mb/s:0.88, fr: 23.9, drop:0, skip:0, pc:none
    Player: a/v:-0.03, forward: 150 MB / 39% / 214.123s / 47%
    VsyncOff: 0.0 latency 0.166

    Weirdly enough I can see drop: 0, skip: 0, pc: none. Shouldn't this behavior reflect in frame skips or drops?
    My video file is yuv420p10le. As for CPU it's always 80%+ but seems to vary a lot.
    ffmpeg says:
       Stream #0:0: Video: av1 (Main), yuv420p10le(tv, bt709), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)


    With the netflix sample file , which is also yuv420p10le it plays "fine" although there are quite a few frame drops/skips. Strangely enough this number can vary wildly per play through. As for CPU it varies a lot from 50% to 95%.
    ffmpeg says:
       Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p10le(tv), 1920x1080, 914 kb/s, 25 fps, 25 tbr, 25k tbn, 25k tbc (default)


    Just to be clear all these files are in a disk connected over USB. No networking involved.


    My configs:


    Any suggestions?

    I'm wondering is there any way to increase that "4 seconds" buffer that kodi uses? My RAM usage is underutilized at only 15%. Does kodi supports any form of video decoding cache like mpv?

    Thanks


    EDIT:

    Ok now I understand better what's happening: it's the aq (audio queue) that gets depleted to 0 and when it happens the media file playback jumps forward. I'm guessing that happens because the video decoding threads get priority and because the CPU is getting hammered the thread(s) for decoding audio are not getting CPU time. Nonetheless my original points and questions still stand.

    Edited 3 times, last by elim_garak (February 14, 2025 at 2:04 AM).

  • Yes, the jumping is likely because video decode cannot keep up.

    What you find is audio plays at correct speed, but video is playing slower, so a/v sink drifts apart.

    Once a/v sync reaches a set threshold, kodi will seek (jump) to restart with audio back in sync (but it will obviously drift again).


    Your bootloader version does pre-date automatic NUMA settings and SDRAM_BANKLOW will be ignored.

    However looks like you are on a Pi4, so SDRAM_BANKLOW=3 was the default so it may not be critical, but it may be worth updating that to be sure.

    Setting numa=fake=1 should get you back to pre-numa performance (which I'd expect to be a little lower, but may be worth a test).

    Quote

    LE 12 nightly-20250116-37e4458 - dav1d 1.4.1, Kodi 21 --> played fine on slow scenes, some "lag/drops" on fast paced scenes
    LE 13 nightly-20250205-562de9e - dav1d 1.5.1, Kodi 22, NUMA --> playback keeps jumping every 4 seconds

    It might be best to try and find a file that plays well on one of the systems but not the other (something where you can check a/v sync is accurate throughout). If the answer is "struggles on both", then it might just be slightly different thresholds in kodi makes one appear better (but really you can't easily judge which is better when both fail to keep up).

    Note: Pi5 benefits significantly more from NUMA than Pi4 (and it's much faster to start with).

  • elim_garak I'm normally loathe to suggest it, but have you tried overclocking the board?

    It seems one of the causes for the poor performance is "local warming" despite being winter season.
    My rpi4 has an idle temperature of 55'C. By playing the AV1 file the rpi4 reaches 85'C and gets throttled with both Arm frequency capped and Soft temperature limit active.
    I discovered this as I went to overclock it; which I still did. But as expected the same thing happened. At first it seemed the playthrough was smoother but then the rpi4 started making noises I've never heard before. And I don't even have a fan. Nor heatsink. Just using the official case with the top off.
    FWIW these were my settings:
    over_voltage=6
    arm_freq=2000
    gpu_freq=700
    I've been looking into a case and will probably go with the Argon One which is both a massive heatsink and includes a configurable fan. I'll have to endure the fan for AV1 playback. Hopefully it won't be too annoying.
    OTOH maybe the smarter alternative would be just to invest in a rpi5 instead of burning 25£ on an additional case.


    Your bootloader version does pre-date automatic NUMA settings and SDRAM_BANKLOW will be ignored.

    However looks like you are on a Pi4, so SDRAM_BANKLOW=3 was the default so it may not be critical, but it may be worth updating that to be sure.

    I'm using PINN with Raspbian and LE. But I haven't updated Raspbian to Bookworm.

    But when booting to LE isn't the bootloader firmware tied to the LE version? I'm not sure how to update it since that is the latest version shown to me.

    It might be best to try and find a file that plays well on one of the systems but not the other (something where you can check a/v sync is accurate throughout). If the answer is "struggles on both", then it might just be slightly different thresholds in kodi makes one appear better (but really you can't easily judge which is better when both fail to keep up).

    After discovering my rpi4 is being throttled I'm wondering if the effect of one player better than the other wasn't just chance due to throttling effects.

    Edited once, last by elim_garak: Merged a post created by elim_garak into this post. (February 15, 2025 at 6:22 PM).

  • Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link
  • I've been looking into a case and will probably go with the Argon One which is both a massive heatsink and includes a configurable fan. I'll have to endure the fan for AV1 playback. Hopefully it won't be too annoying.
    OTOH maybe the smarter alternative would be just to invest in a rpi5 instead of burning 25£ on an additional case.

    But when booting to LE isn't the bootloader firmware tied to the LE version? I'm not sure how to update it since that is the latest version shown to me.

    I've had success with completely passive heatsink cases like the flirc one (which has a kodi branded variant).

    There should be no tie between LE and bootloader. Latest bootloader will typically be fine for any images (even old ones).