Project

General

Profile

Bug #2754

Video and Audio badly out of Sync

Added by ullix tv over 9 years ago. Updated almost 9 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
Category:
PVR / DVR
Target version:
-
Start date:
2015-04-01
Due date:
% Done:

100%

Estimated time:
Found in version:
tvheadend: version 3.9.2665~g3b92536~precise
Affected Versions:

Description

After recording with tvh and replaying via Kodi, the video and audio are sometimes very badly out of sync. The difference of audio first and matching video later can be as much as 2 seconds!

This has nothing to do with any network delay, as this happens even when the replay is done on the same machine that hosts the tvh-server and the disk, and the computer is powerful (Haswell i7 CPU, 32GBMemory, SATAIII locally connected hdds, Ubuntu 12.04).

The files are recorded from my 8 tuner SAT>IP device, and tvheadend 3.9.x as either stream-profile "pass", so files are stored with *.ts ending, or when recorded as stream-profile "matroska", so files endig with *.mkv.

These files play perfectly fine with VLC; yet with Kodi I get this video delay on playback.

After converting such a file with (xyz being either ts or mkv):

/usr/bin/HandBrakeCLI --preset 'Normal' -O -i /video.xyz -o video.mkv

they do play fully in sync on both vlc and Kodi.

I don't know where in the chain the problem lies. Currently I use tvheadend 3.9.2665~g3b92536~precise, Op-den-Kamp tvh-pvr for Kodi 1.9.40, Kodi 14.2. However, while the 2 sec delay is now a record I have this delay for a long time, always using 3.9.x, also with pvr 1.9.39, and all kodi 14.x and also late xbmc versions.

It does seem to occur an all channels and all resolution like SD, HD-, Full-HD, though the amount of delay varies, although I don't see a pattern.

History

#1

Updated by B C over 9 years ago

ullix tv wrote:

These files play perfectly fine with VLC; yet with Kodi I get this video delay on playback.
After converting such a file with (xyz being either ts or mkv):
they do play fully in sync on both vlc and Kodi.

as they play fine in VLC and after conversion you should open a ticket on trac.kodi.tv

#2

Updated by ullix tv over 9 years ago

Well, in between tvh and Kodi is the pvr-client. How do I know that this is not the culprit?

#3

Updated by Jaroslav Kysela over 9 years ago

You may try to move the recordings to another directory which is accessible by kodi (standard media file access) and try to replay it without any pvr plugin.. So, we can rule out the tvh with this test, because recordings are served like standard file streams.

#4

Updated by ullix tv over 9 years ago

Duh. it is almost embarrassing to mis such an obvious idea.

And you guessed right: When Kodi plays the file directly from disc, it has the same sync problem! So, it is Kodi after all, and both on ubuntu 12.04 and on Androis (Amazone's Fire TV).

#5

Updated by ullix tv over 9 years ago

Kodi bug report is here:

http://trac.kodi.tv/ticket/15893

#6

Updated by ullix tv over 9 years ago

The discussion on the kodi site http://trac.kodi.tv/ticket/15893 has shown that the out-of-sync problem results from kodi attempting to play the AC3 track, which it considers to be the "best" track. When switched over to the mpegt2 track, kodi is playing fully in sync.

On the other hand, the reason VLC and other players are playing in sync is that they have defaulted to the mpeg2 track. When they are switched to the AC3 track they are also out of sync, or not even playing sound at all!

So the question now is whether tvheadend is messing up the AC3 track by some modification of what the TV station is delivering, or whether the TV station is delivering the bad track, and tvh is only truthfully storing whatever it gets?

Hope it is tvh, as that has a better chance of becoming corrected. See the kodi bug tracker for downloads of the problematic video file.

#7

Updated by Jaroslav Kysela over 9 years ago

Compile tvh with --enable-trace , and provide "--trace parser -l <log_file_output>" (for 30 seconds) when you record the problematic audio.

#8

Updated by ullix tv over 9 years ago

This gives two problems.

1) compiling.
Not my forte. I need advice of what to download from where and what to do then :-/

2) Recording
As I had mentioned, the sync problem does not occur always and on all channels. It does seem to occur mostly on (German TV on Astra 19.2) ZDF-HD and 3SAT-HD. However, my recordings during the last few days were clean.

I am mostly updating tvheadend when a new version is in the ppa. Has anything been changed in the recent days with respect to AC3 storage, which could explain clean files now?

Furthermore, as I now do mostly record and view later, I'd probably never be able to jump up and do a trace when I notice sync issues.

Is there nothing you can deduce from the existing video file? Because there the sync issue is VERY prominent.

#10

Updated by ullix tv over 9 years ago

OK, compiling does work with everything default. Now where do I put the " --enable-trace "?

And what do I need to do to keep it parallel from my existing configuration, and is not messing it up?

#11

Updated by Jaroslav Kysela over 9 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset commit:tvheadend|a00a3da84dc0f41bf5ec733ed7a64cf6f19289ef.

#12

Updated by Marco Jakobs almost 9 years ago

I still see the same issues as described above with AC3 coded sound with TVH 4.1-1163 which should contain an 8 month old fix?

Kodi is 15.2 on Raspi2 with XBian.

#13

Updated by ullix tv almost 9 years ago

It seems that the sync issue is even more complicated than already described. Just yesterday I discovered the following problem:

I use tvheadend 4.1-1284 and replay SAT-TV HD recordings on Kodi 15.2 hosted on Amazon Fire-TV (the old, 2014 version) via an GB ethernet nfs network. It generally works very good, but in the last few days the audio-video sync got really bad. Yesterday the delay was up to several seconds!

The sync was correct initially after starting the play, but became increasingly bad. Likewise, when at later times during the movie I stopped replay in Kodi and restarted, it always played in sync in the first moments, but again quickly degenerated. Fiddling with the audio track (see my comment #6 above) did NOT help. Changing the audio delay in Kodi had no effect at all, neither in the olus nor in the minus direction. And playing directly from the NFS-file system - so skipping tvheadend and the pvr client altogether - still resulted in the same bad sync problem.

That already meant that at least this time it is not the fault of tvheadend and/or its pvr !

Restarting Kodi also did not help.

My last resort was pulling the power plug on Fire TV, saying a prayer, then repowering Fire TV, then restarting Kodi and replaying via tvheadend. Worked smoothly and in perfect sync, and continues to do so for the 10+ hours since pulling the plug. Strange.

What is happening? Is that all the effect of the Android and/or its hardware getting messed up?

#14

Updated by Bengt Madeberg almost 9 years ago

I have also the issue with sync between audio and video on live Tv in kodi. I upgraded to HTS Tvheadend 4.1-1258~gb480c92 recently and don't think I had it before. It's a short delay but no problem to se it.

#15

Updated by peter fox almost 9 years ago

Can somebody please reopen this thread. The audio interruption after channel switch after 3-10 sec is very annoying. I hope its not such a big deal to fix this issue again.

Also available in: Atom PDF