Sound and video asynchronous for H.264 with AAC on raspberry pi3

I’m running the current version of OSMC based upon kodi 19.4 on a raspberry pi 3. Everything works fine, except that I there is a big offset between sound and video - I’d say the sound is ~2…3s ahead. Input is from German media libraries from public service. Those videos are H.264 in 720p with AAC sound.

It doesn’t matter which addon I use - typically I’d like to use ARDundZDF from kodinerds in Germany. But the same offset is there for the 3sat plugin from standard repository. It must be related with the used hardware. I’ve checked the same addons/videos on my tumbleweed laptop running kodi 19.4 - perfect synchrounous.

But watching videos from the addon ctuplink on my pi3 is perfectly in sync - and those videos are also H.264 / AAC.

I’ve asked on the kodinerds forum [RELEASE] Kodi-Addon-ARDundZDF - Seite 129 - Addon releases - Kodinerds.net - Deutschsprachiges Forum zum Kodi Entertainment Center , and the addon author has replied that videos are in sync on pi3+ using libreelec 20.0

I’ve tried with many different setting within osmc without any improvement.
I’ve appended some log from my problem https://paste.osmc.tv/idibexexag.xml

Any hints?

Regards, Michael

Can you upload a full set of logs, not just the Kodi log.

Just a short information - right now I’m quite busy, thus it might take some days till I’ll upload more detailed logs.

Regards, Michael

Now I had time to create a full log - see https://paste.osmc.tv/udapohuwub

BTW: There seems to be a minor bug within OSMC when displaying the final URL. It seems to print a blank just in front of the final token “tv/ uda”.

Does the issue go away if you lower the resolution of the video your grabbing to 720p?

On a side note, you may want settings>player>videos>adjust display refresh rate> set to on start/stop.

How can I reduce the resolution within kodi? Or did you mean that I should use a different source with lower resolution?

On the other hand I’ve done two experiments:
1.Run an recording via NFS from the same German network, and I experience the same offset (BTW around 4s).
2. Press Pause during playback: Sound stops immediately, while video runs for some seconds. Resuming the playback, and it’s in sync for some seconds to become more and more asynchronous.

From that I’d conclude that the raspberry pi3 might have not enough horsepower to run 720p H.264 videos from within OSMC. That did work on kodi leia, but of course I know that due to matrix there was a major redesign within video processing.

Regards, Michael

I don’t have any problem playing stuff with ‘3sat Mediathek’ plug-in. Are you using HW decoding?

I meant by changing the settings in the InputStream Adaptive add-on so it was grabbing a 720p stream instead of the 1080 it shows in your logs. That or lower the max bandwidth there. It was looking like the default was 4mb/s and it showing you only getting around 3mb/s. But, I really don’t know anything about add-ons like this so don’t take what I post as authoritative.

Yes, I think so. HW acceleration should be enabled. My guess is that there is some setting which might trigger my problems.

Regards, Michael

@darwindesign: I’ll check that. When I display the playback resolution (info button) it tells me 720p as expected. And of course the raspi shouldn’t upscale.

I’ll look for those settings.

Regards, Michael

There seems to be no addon named Inputstream adaptive. I’ve tried to follow How to Install InputStream Adaptive on Kodi Matrix and Leia
But I can’t follow step 6 - there is no menue Video Inputstream. I also couldn’t locate that addon by searching the addon database from within kodi.

But there is an option within ARDundZDF to select a resolution. It was set to 1920x1080. Changing it to 1280x720 didn’t help.

Any ideas?

Regards, Michael

It’s included in OSMC. On my RPi it’s under My Add-ons->VideoPlayer InputStream and I think it’s automatically activated by add-ons that need it (I have iPlayer and YouTube, eg).

Thanks for that hint. Thus I could locate this addon. I limited both max resolution settings to 720p, but still sound is around 5s ahead.

Additionally there is the addon “Inputstream FFmpeg Direct” being deactivated. I did activate it. Again no improvement.

Is it necessary to restart kodi to activate such changes?

Regards, Michael

Addendum: One can select within the addon ARDandZDF the stream quality. If I go down to 960x540 video, sound is in sync within 3sat streams.

To my surprise the SWR streams are also available as 1920x1080. But SWR streams are out of sync at all resolutions!?! Does it matter wether one uses mp4 or hls (mp4 streams are mostly not available)?

Have you tried this with Kodi on another platform (e.g. Your PC?)

Yes, just verified it on my laptop. All videos from all stations (ok, 3sat and SWR) in all resolutions are in sync (maybe apart by some ms). I hav tried the most recent kodi 19.4 as available within linux tumbleweed. Of course ma laptop uses a different hardware acceleration…

Regards, Michael

Do you have one particular stream that you can reproduce the issue with so that we can try the same here?
Best would be one without geoblocking.

Also would then be interesting if you have the same issue using a different Addon to play the Stream (like the Mediathekview Addon Aktuelle Release Ankündigungen | MediathekView-Forum)

I encounter that problem with any stream. I’ve also tried the 3sat addon as provided within the standard repository with the same problem. For testing I typically select some news show.

But I don’t have this issue with the addon ctuplink. It, too, is H.264/AAC.

I was in contact with the developer of ARDundZDF - nobody seems to suffer under my offset issue.

Regards, Michael

Ok I just installed that Addon and played the first episode of “Die Anstalt” and the audio was perfect in sync.

May I suggest you do a fresh install on a second SD Card and test with that.

I tested “Die Anstalt” just now (I selected the first in the list being the most recent one - “simulating” star trek enterprise). And there was the long delay of the video by around 5s.

I’ll have to do a fresh install anyhow when OSMC’s bullseye release will become available. I’ll report then…

Regards, Michael

I’ve discovered a solution (better a workaround)!

To my surprise there is no offset between sound and video when I DEACTIVATE HW acceleration. Then all videos are played fine (but the processor is more busy). But I seem to be limited to 720p - that’s not an isue in Germany since all our HD channels are 720p.

These are my settings:

System>Player>Videos>adjust display refresh rate> set to on start/stop
System>Player>Videos>use DRM PRIME decoder> set to no

Addons>User Addons>Video player InputStream Addons>InputStream Adaptive>max. resolution> set both to 720p

Addons>ARDundZDF>Allgemein>Sofortstart> set to on
Addons>ARDundZDF>Modul-Einstellungen>Videoformat> set to HLS(adaptive)
Addons>ARDundZDF>Modul-Einstellungen>Videoqualität> set to 1280x720

I guess that the settings within ARDundZDF are overrruled by the settings for InputStream adaptive.

Thanks to darwindesign for bringing InputStream Adaptive into my mind.

Regards, Michael

1 Like