Resuming playback, audio momentarily muted - keyframes?


#1

I’ve noticed that occasionally when resuming playback on a video, the audio sometimes is momentarily ‘muted’. I think there is a pattern to this on the testing I have done so far. There was a change done in Kodi (version 17 I think), where resumption of video playback was fixed to look for the previous keyframe as the resumption point (it used to look for the next keyframe). Here is the link from the libreelec forum, see post 1,244 concerning PR11713:- https://forum.libreelec.tv/thread/2156-8-0-2e-libreelec-8-0-for-s905-s905x/?pageNo=70

For example up until this change, if you stopped playback at 5:00, where the previous keyframe in the video stream was at 4:55 and the next keyframe was at 5:05, then when resuming playback, the video would start at 5:05 (5 seconds too late). After this fix, the video resumed at 4:55. With the vast majority of video streams it appears that the keyframes are very close to each other, and the time difference is negligible so you won’t notice any audio problems. I’ve found that very occasionally, the gap between keyframes can be several seconds, and what appears to be happening here is that whilst the video resumes at the previous keyframe, the audio seems to resume at the actual time playback was stopped. So, using the above example, playback between 4:55 and 5:00 would mean no audio was heard, and once we reached 5:00, the audio resumed. Audio and video are still in sync.

Phew, I hope that I’ve explained that clearly enough. I would think this is a very minor issue and was wondering if anybody else has noticed it. I’ve not bothered with logs as I’m not 100% sure if I’ve nailed down the issue. The trick is to find a video where you have a few seconds between keyframes (I don’t know how you find that out apart from trial and error).

TIA


#2

Since this is probably a Kodi thing, you should try to reproduce it on x86 Windows/Linux or Android versions of Kodi with the same videos. If it can be reproduced there, then it’s Team Kodi who should take care of issues like that.


#3

Thanks @TheCoolest. It is a Kodi thing. I tried with LibreELEC latest version and the same happens. I have one particular clip where there is no audio for 7 seconds. The resume time is 18:35, but the video resumes at previous keyframe which is at about 18:28, so there is no audio for those 7 seconds. It seems that audio resume works off the actual time the video was stopped, whereas video resume works from the previous keyframe. As I said, a lot of the time these keyframe gaps are small, but I’ll chase it up with Kodi. It works fine with LibreELEC 8.2.5.


#4

As an FYI only, I’ve uploaded a small 15Mb sample.mkv showing the issue. If you stop playback at 40 seconds, then resume from there, you should notice that playback resumes from about 33-34 seconds, and there is no audio until you hit the 40 second mark.

It does appear that audio always resumes from the resume time regardless of where the previous video keyframe is.
Link to sample:- https://mega.nz/#F!DhxBDY4L!WY62ZBT0rHSf7meo-LTTMA

(You may need to add the following to your Kodi “advancedsettings.xml” file or the video won’t be marked as in progress):-

<advancedsettings>
<video>
<ignoresecondsatstart>30</ignoresecondsatstart>
</video>
</advancedsettings>


#5

I noticed the same thing (16.1->18), but as the gaps are so little in my setup (0-2sec), I just assumed its A/V sync and leave it that way :slight_smile:


#6

The gaps between keyframes are encoded in the video stream itself and it does not matter what the audio setup is. Most keyframes seem to be only a second or two apart, whereas in some cases, like the sample I have given, they can be up to 7 or 8 seconds apart. If you playback the sample as instructed with Kodi 18 (CoreELEC 9.0), you should notice the missing audio. Whereas with Kodi 17 (LibreELEC 8.2) there is no problem.

I don’t know what determines where in the video keyframes are inserted but this link tries to explain it:-


#7

yep, I am familiar with keyframes, I just noted, that I couldnt be sure or know, that this is matter of keyframes itself. But if thats the case (and nothing else) and could be fixed easilly, thanks for good find and hopefully Team Kodi will look on this issue… Btw., correctly submitted bug via Github will take more attention than forum post.


#8

Just tried to recreate on Windows and Android using Kodi 18.1, but everything worked fine.


#9

I’m now thinking it might be a LibreELEC/CoreELEC issue.

The problem does not occur with Kodi Leia on Windows or Android - the issue is only present with LibreELEC 9.0 and CoreELEC 9.0.

Maybe some amlogic specific fixes in this area…??

I’ve posted a thread on the Amlogic Forum:-


#10

Yes this is very annoying and only an Amlogic issue afaik. No idea why


#11

I noticed the same.
If I’m correct, it appeared somewhere between CoreELEC-S905.arm-8.95.3 (not present) and CoreELEC-S905.arm-8.99.2 (present).
Hope that helps in finding the breaking change.


#12

My guess is something related to amlogic specific patches. However, the sample could be used to test any changes as it happens every time with that sample on LE or CE v9


#13

It alsp happens without any kodi patches.


#14

I’ve submitted a bug report on the LibreELEC site, as this happens on both LE and CE.

Here is link:-


#15

Btw, I just watch this a little today, and for me, it seems that audio pauses little bit delayed after video. And when unpaused, reverse order to be in sync… (some h264 video…)


#16

Thanks. Did you try playing back the HEVC sample in the link on the Amlogic bug report page? With that sample, you should get about 5-6 seconds of no audio if you resume it from 40 seconds? If you don’t get the same result then maybe it’s something in my setup, but the missing audio is very noticeable.


#17

I just tried your sample ( Link to sample:- https://mega.nz/#F!DhxBDY4L!WY62ZBT0rHSf7meo-LTTMA , on two installations, and both acts the same (maybe on Win the delay was a tiiiiny bit shorter - doesnt matter I think) as I am used from other videos. Video pauses immediatelly, sound a few moments (200-400ms? guessing) later. Resume: video plays immediatelly, sound next after the same delay.

I tried it on Windows 7 + Kodi 18.1, and Odroid C2 + CE 8.99.2 (Kodi 18.0). The behaviour is the same (so I believe its maybe Kodi code, not ELEC…) but too simple testing to claim that, just letting know my results.

On Win - no sync monitor to video, on C2 also. I could test it also on other C2 setup, where I use one freq and syncing videos to it, but I dont think its needed, as I experience slightly delay also on Win platform (and you not?) and also I didnt hit the *sec delay anywhere… (and also, with CE, I am waiting for official version with 18.1, until that I would be propably behind your nightly and I can see, there was some minor (and most propably doesnt affect pausing) frame code change between 8.99.2 and 9.0 final).

Basically, I dont mint that short delay and I still believe, there is some reason for it (as it is same on all platform I using). But it could be we are talking about two different things, where I dont have your symptoms.

and btw., I use network share for media… Hmm, I can see, that there is so many things in setup which could affects test reports (audio sync, buffering, type of TV, resolution, connections/AVR…), that maybe it would be usefull describe my configs somewhere to pastebin and include them to every report… :smiley:


#18

Thanks for your thorough feedback and your time! I’d already tried Windows and Android (latest Kodi on both) and they work fine. The big audio silence (for me) comes using latest LibreELEC/CoreELEC on Android TV box. I believe @Nostalgist in a previous post in this thread suggested that the problem was introduced at 8.99.2 but before that (8.95.3) it was ok - but it does seem specific to CE/LE and running on Linux.

I have a basic setup - box directly connected to TV via HDMI and all media stored on USB 2TB external HDD. I’m sticking with LE 8.2.5 for now - I have had zero issues with that build for well over a year.


#19

Hmm, I must admit I can see this couple of times now (CE 9.0.1, updated couple a days ago from 8.99.2). Its was occured at least few times, and log says

2019-03-08 14:47:33.805 T:4070638448 WARNING: ActiveAE - large audio sync error: 5582.446207
2019-03-08 14:47:33.890 T:4070638448 WARNING: ActiveAE - large audio sync error: 5496.855332
2019-03-08 14:47:33.976 T:4070638448 WARNING: ActiveAE - large audio sync error: 5411.909018
2019-03-08 14:47:34.061 T:4070638448 WARNING: ActiveAE - large audio sync error: 5326.371226
2019-03-08 14:47:34.147 T:4070638448 WARNING: ActiveAE - large audio sync error: 5241.172644
2019-03-08 14:47:34.232 T:4070638448 WARNING: ActiveAE - large audio sync error: 5155.707477
2019-03-08 14:47:34.318 T:4070638448 WARNING: ActiveAE - large audio sync error: 5070.714476

There is propably more variables (HEVC skipping fix or not, media file, fps…) and I cant tell if that happens when because I switched from 8.99.2 to the 9.0.1, if its related only to (some?) x265 content… But I can confirm this is happening now with 9.0.1 in certain circumstances (sync to playback on start+stop, no adjust framerate to display, no passthrough audio, HEVC seek fix ON, maybe only on pause/play). Need more testing.


#20

yes, quite annoying, happens very often since CE 9
resume and skip affected, many kinds of codecs … don’t know if is a start also affected