From what I can observed it doesn’t seem to be related to encoding issue but rather something to do with how long either the OSMC device has been up or been playing video files. Once rebooted the device seems to fix the lip sync issue for a period of time then it starts to drift.
Here you can see two log lines showing that Kodi prepares the next frame. When you diff the timestamps then you can see that there are about 42 ms between the first and second message and 27 ms between the second and third. That’s bad because the interval should be constant and it depends on the fps rate of the selected video. That’s one reason for the lipsync issues.
But you can also see the logged diff value that increases from 265689.213161 us to 294368.046161 us. This is the lipsync delay. You’ve got 0.265 seconds delay at the first line and 0.294 seconds on the 3rd line. If you’re watching all those lines over the time than you can see how the lipsync issue evolves.
You can also see that the nextFramePts values increase by a 20 ms interval, which is related to the 50 fps rate of the video that you play. Since that’s not synchron with Kodi’s playback speed you get the lipsync issue at the end.
If you look at the same messages in the other log where you didn’t experience the lipsync issue, then you see this:
Here, the Kodi playback interval is more or less constant. Every 8 to 9 ms a frame will be prepared. The diff values also stay more or less the same. Negative values mean that the frame is a bit too early, positive values indicate that the frames are too late.
The question is: why is the playback interval not constant in the first log?
I’ve already fixed some issues and I get perfect intervals now. But unfortunately, I’m now struggling a bit with dropped frames. As soon as I’ve fixed that we will provide a test build.