Kodi Community Forum

Full Version: ActiveAE - large audio sync error with "sync playback to display" enabled
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am experiencing a/v sync errors when I enable "Sync playback to display" which occur whether or not I use the TempoUp feature. 
  • Latest commit from nexus branch
  • kodi-gbm
  • Playing this clip
  • Debug log
Playback is fine if I disable the "sync playback to display" option but then, TempoUp is not possible.  This bug is present regardless of media format.  Do I need to have another setting enabled to prevent this?
video framerate 24.000 FPS and audio framerate 46.875 FPS (1024 SPF) might explain something
https://paste.kodi.tv/osimeqetoy
(2023-01-28, 21:23)graysky Wrote: [ -> ]I am experiencing a/v sync errors when I enable "Sync playback to display" which occur whether or not I use the TempoUp feature. 
  • Latest commit from nexus branch
  • kodi-gbm
  • Playing this clip
  • Debug log
Playback is fine if I disable the "sync playback to display" option but then, TempoUp is not possible.  This bug is present regardless of media format.  Do I need to have another setting enabled to prevent this?

Nope. Should exactly work like this. Can you post without TempoUp in same constellation as well? Hint: if you open the PlayerDebug -> what does "RR" say?
(2023-01-28, 22:00)fritsch Wrote: [ -> ]Nope. Should exactly work like this. Can you post without TempoUp in same constellation as well? Hint: if you open the PlayerDebug -> what does "RR" say?

Playback without using TempoUp is in progress. The sync issue takes some time to manifest at 1.00 speed.  Sometimes it never manifests.  Other times it does.   I will post the debug log if it happens. I did hit Ctrl+Shift+O during playback. Initially RR was 0.98500 and then 0.98539 then 0.99932 and after 10 seconds or so it stayed around 1.00021. This was without using TempoUp.

If I added TempoUp to 1.5x speed, the RR values took about 10 seconds to approach approx 1.50000. For examples, 1.46330 then 1.55367 then 1.51905.
What is /mnt/media - a local disk? Something with bandwidth limitations?
And additionally: Could you change the scaling method to bilinear? I want to exclude bottlnecks with high quality upscaling while screen runs in 2560x1440. For the record: No difference when you run in 1080p60? right?

After the rr has reached the 1.5 - does it "nicely work" then? Or audio does not come back?
Firstly, I could not get the audio/video sync to reproduce when playing back without using TempoUp.  Like I said, it is hit-or-miss.

To answer your questions:
Yes, /mnt/media is a local disk/No bandwidth limitations.
The scaling method was step to bilinear.
I am test playback now at 1.5x via TempoUp in 1080p60 with a 1080p clip that is different from the royalty-free one I used initially.  I will post back when I get a result.  I will also pay attention to the rr value.

Just to be clear, the entries in the log are present at times when the audio is REALLY out of sync with the video.  The words playing are no where near what the actors are saying.  I hope that makes sense.
OK, the 1080p clip in 1080p @ 60Hz mode is playing at 1.3x.  The rr is very close to 1.30000 and everything looks to be in sync but the log is getting filled with entries like this:
 
Code:
2023-01-28 17:18:14.821 T:837   warning <general>: ActiveAE - large audio sync error: -89408.444267
2023-01-28 17:18:14.821 T:837   warning <general>: ActiveAE - large audio sync error: -89409.470104
2023-01-28 17:18:20.871 T:837   warning <general>: ActiveAE - large audio sync error: -89446.349357
2023-01-28 17:18:20.871 T:837   warning <general>: ActiveAE - large audio sync error: -89446.859024

If I hook the system up to a 4k monitor, WITHOUT enabling TempoUp, I see audio/video sync issues with "sync playback to display" enabled. If I disable it, the same file plays back fine. Note that the rr value when I see the errors is 1.0000.

I should add that I never saw that problem under X11. I recently switched to GBM and am seeing it consistently.
(2023-01-29, 00:20)graysky Wrote: [ -> ]OK, the 1080p clip in 1080p @ 60Hz mode is playing at 1.3x.  The rr is very close to 1.30000 and everything looks to be in sync but the log is getting filled with entries like this:
 
Code:
2023-01-28 17:18:14.821 T:837   warning <general>: ActiveAE - large audio sync error: -89408.444267
2023-01-28 17:18:14.821 T:837   warning <general>: ActiveAE - large audio sync error: -89409.470104
2023-01-28 17:18:20.871 T:837   warning <general>: ActiveAE - large audio sync error: -89446.349357
2023-01-28 17:18:20.871 T:837   warning <general>: ActiveAE - large audio sync error: -89446.859024

If I hook the system up to a 4k monitor, WITHOUT enabling TempoUp, I see audio/video sync issues with "sync playback to display" enabled. If I disable it, the same file plays back fine. Note that the rr value when I see the errors is 1.0000.

I should add that I never saw that problem under X11. I recently switched to GBM and am seeing it consistently.

Yes. That is where I am aiming at. Can you correlate with the CPU used? If you have a chance, can you triple verify with X11? I think we have a rendering bottleneck here.
For both tests:
  • Identical hardware running Kodi (intel CPU + Radeon RX 550) connected to 4k TV running in 4k @ 60 Hz
  • Playback set to 1.3x via TempoUp playing the identical video clip (h264, 1080p, ac3 audio)
  • videodebug rr value is steady around 1.30000 but does move around a little

On GBM:
  • CPU use is 7-8% (htop)
  • GPU use is 7-12% (radeontop)
  • Clear intermittent audio/video sync problems
  • Log file also detected this with lines like warning <general>: ActiveAE - large audio sync error: -89466.472232

On X11:
  • CPU use is 3-4% (htop)
  • GPU use is 7-12% (radeontop)
  • No signs of audio/video sync problems
  • Log file shows some lines like warning <general>: ActiveAE - large audio sync error: -89466.472232
@fritsch - I am thinking to open a ticket.  Do you concur?
Jep, please go ahead. Also provide the relevant logs from both working revisions, please.
Seen it, assigned it. Thanks much.
You're welcome; thank you for helping to diagnose.
I'm using Kodi mainly for playing internet radio (add-ons) and watching Live TV (PVR HTS & tvheadend 4.2.8) and have been struggling for some time to switch from the perfectly working Kodi 17.x with OpenMAX acceleration (MMAL is usless for PVR) on Raspberry (PiZero/Pi2B) to Kodi 19.5 on x86.
Recently abandoned the Raspberry platform because I found it useless for playing PVR with Kodi 18.x & Kodi 19.x - more details in the second half of this post:
https://forum.kodi.tv/showthread.php?tid...pid3135685

Now, I bought a quite powerful (and recent architecture) second hand x86 thin client - powered by a Gemini Lake dual Celeron N4000 & UHD Graphics 600 with 4 GB DDR4 RAM, considering it sufficient for my multimedia needs.
https://ark.intel.com/products/128988/In...o-2_60-GHz

I built Kodi 19.5 and found it running very fast and "smooth", everything except the PVR playback, which suffers from the same issues - audio speeding up / slowing down only when starting the PVR playback. Worse on SD Channels (MPEG2) where I also often get the error presented in this thread - namely: "ActiveAE - large audio sync error"
Here is a small snippet from the Kodi log - presenting the ActiveAE - large audio sync error - when switching to a SD Channel (MPEG2 video & audio MP2 - 2 channels), debugging was not activated since there are no useful additional details:
https://pastebin.pl/view/8b6383da

Interestingly, the audio speed-up & slow-down process on starting PVR playback is more  "accentuated" on MPG2 channels (average 4Mbitps TS streams) where it takes around 10 seconds to settle, than for FullHD - MPEG4 (average 10Mbitps TS streams). And again, the ActiveAE - large audio sync error occurs solely on playing back the SD channels - MPEG2 - MP2 - 2 channels audio.
In my case I don't have "sync playback to display" enabled and the "threshold for pitch correction" has the default value of 2. Enabling "sync playback to display" or setting "threshold for pitch correction" on 0 doesn't seem to help at all.
The playback is done on a Dell monitor - 1920x1080-60Hz and I employ a HDMI switcher because I use only a monitor for both my workstation and the Kodi Thin Client box.
During playback of PVR, if I switch the HDMI back and forth, first the audio stops for 1 second and then the audio speed-up/slow down starts again and I also get often ActiveAE - large audio sync errors. Weird, how Kodi reinitialize the playback when the monitor becomes present again.
Additionally, the audio speed-up/slow down and the ActiveAE - large audio sync errors occur with all audio outputs  - that's HDMI digital output (I used a HDMI audio extractor - has it's own DAC), internal Intel HD audio card (which I disabled in BIOS - crappy DAC) and the Creative USB sound card I'm currently using.
Some last details - I learned that Kodi doesn't enable HW decoding of MPEG2 & VC-1 by default and I enabled them both in the Player settings menu because I found out that my GPU supports them. That didn't help with the audio problems but eased up the the CPU load with ~10%.
 
Code:
$ vainfo
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Gemini Lake - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSlice
      VAProfileVP9Profile2            : VAEntrypointVLD

And the average CPU usage for playing PVR (both SD - MPEG2 & HD - MPEG4) stays around 25-35% - htop ASCII screenshot:
Code:
    0[||||||||||||||||||||||||||||                                                                 23.9% 1338MHz 40°C] Tasks: 45, 88 thr, 89 kthr; 1 running
    1[|||||||||||||||||||||||                                                                      20.4% 1100MHz 40°C] Load average: 2.09 0.99 0.50
  Mem[|||||||||||||||||||||||||||||||||||||||                                                              363M/3.45G] Uptime: 13:27:03
  Swp[                                                                                                       0K/1.63G] Disk IO: 1.2% read: 0K write: 12K
                                                                                                                       Network: rx: 0KiB/s tx: 0KiB/s (3/13 packets)


P.S.
Forgot to mention that I tested an old Kodi 17.4 build (I built & packaged for X86-64 some years ago - can't rebuild Kodi 17.x on my actual GCC 11) on this Thin Client box and it plays perfectly fine PVR (HTS), no audio speedup/slowdown and ActiveAE - large audio sync errors, whatever settings I tried to change.
Pages: 1 2