Problem with sound sync, where VLC has no problem
#1
(Mentioned VLC because it would seem to indicate the data is there in the file somewhere to help get it right...)

Short description: An MPEG2 TS file remuxed by VLC from an EyeTV recording of a BBC HD programme - plays perfectly in VLC (Linux and Mac), but in XBMC (Linux with VDPAU and Mac) playback is perfect but the sound is consistently off by a fraction of a second, which is quite noticeable when someone talks in-vision.

I notice when I play the file in VLC that the sound starts playing a moment before the video window opens, and wonder if the problem is that XBMC isn't doing that - isn't, perhaps, taking note of the start of the video and audio tracks being offset in time? (Wild guess.)

Background / Long Description:

Given in case someone can see a better way to achieve what I'm actually after! :-)

Objective:
I want to record BBC HD programming using EyeTV on the Mac and play it back in its original transmission quality (ie: not transcoded down) on XBMC. Transcoding down (eg: to AppleTV) already works perfectly; this is all for when I don't want to compromise.

What used to work:
For a while I was able to simply export from EyeTV using its "Native Formats (No Re-encoding)" export option (ie: to remux the video and audio into an MPEG4 container). XBMC would then play back the resulting .mp4 files perfectly.

What went wrong:
But near the beginning of August the BBC changed the encoder they're using on BBC HD, and ever since then, the "Native Formats" export has produced a file which XBMC and VLC cannot play.

(I have a ticket open with Elgato about this but even when I opened it I didn't really think it was their fault; just that they were possibly best-placed to fix it. I also doubt there's much use complaining to the BBC - they're already inundated with complaints since the new encoders went on-stream, which they're pretty much staunchly denying are causing any real problems - I imagine they'd be even less bothered when the only problem someone has is with playing recordings!)

It turns out that whatever tools I use to try to remux that h.264 data into an MPEG4 container, VLC and XBMC won't play it, even though they can both play the original transport stream.

(NB: I can't use the original transport stream directly because BBC HD also broadcast as the first audio track a narration for visually-impaired people; and XBMC naturally chooses this track to play. It also tries to render the transmitted subtitles, but it goes horribly wrong.)

In the end, the nearest to success I got to, was to use VLC on Linux (didn't work on the Mac version) to remux the video and desired audio track into a new MPEG2 TS file. An example commandline to do this is:

Code:
vlc /net/melusine.local/Volumes/Vault/Remux\ Workspace/Source/Desperate\ Romantics\ -\ 4\:6\,\ Drama.eyetv/0000000010320415.mpg --audio-track 1 --sout 'file/ts://dr4.mpg'

VLC on either platform (Mac or Linux) will then play this back with perfect lipsync. But the audio starts slightly early, or the video starts slightly late, depending on your point of view.

XBMC on either platform (Mac or Linux) will play it back; picture and sound are each perfect, but off by a fraction of a second, with the audio lagging slightly, I think. (If I sound unsure it's because it's close; just off by enough to be able to tell it's wrong.)

NB: mplayer on my Linux workstation (not the xbmc-live box) can't play the video at full frame rate, and the video quickly lags very badly, so I couldn't use that to compare. Slightly surprising as VLC was able to play it back at full frame rate even scaled down to the 1680x1050 screen. (that machine has an old nVidia interface, GeForce 6100 - not VDPAU-capable)

XBMC on the Mac is the latest released version, ie 9.04.1

XBMC with VDPAU on the box under the TV is from the svn ubuntu repository thus:

Code:
xbmc@spriggan:~$ apt-cache policy xbmc
xbmc:
  Installed: 9.04.3+svn22528-jaunty2
  Candidate: 9.04.3+svn22528-jaunty2
  Version table:
*** 9.04.3+svn22528-jaunty2 0
        500 http://ppa.launchpad.net jaunty/main Packages
        100 /var/lib/dpkg/status

They're both showing the same audio offset so my guess is whatever's behind it hasn't been addressed since the last stable release and isn't affected by platform specifics.
Reply
#2
Can you put a log on pastebin and upload a sample of a file that has the poor a/v sync?
Reply
#3
bobo1on1 Wrote:Can you put a log on pastebin and upload a sample of a file that has the poor a/v sync?

As I'm uploading the video to my own webspace anyway I might as well put the log there as well:

http://strangenoises.org/~rachel/xbmc.log

This xbmc.log is a session from startup to attempting to play one media file: lcts2-bit.mpg, a 5 minute segment of a program - I created the clip in EyeTV and ran the clip through the same vlc command I'd used for the whole programme. This converted 5-min clip is the file I'm still uploading; it's still going to take a while... I'll post up when it's complete; in the meantime posting this now on the offchance it's useful on its own.

Anyone would think the programme-makers are trying to avoid lipsync; there's just not that much in-vision talking, which is why it took me a while to even notice the problem on the whole programme. Still, the clip being used here has a bit, plus a couple of door-slams where the off-sync is noticeable.

Looks like playback starts at

Code:
16:18:43 T:3040929680 M:1468747776

To my untutored eye the suspicious part is - nah, forget that, there's plenty of suspicious parts no point trying to extract one. :-)
Reply
#4
Extra thought, having another look at it in VLC (on a Mac, FWIW)...

The delay in playing video once the audio has started playing is longer than the audio offset detectable in XBMC - *starting* to play these videos is thus a bit of a glitchy experience; otoh once it's over that, it's in sync and the rest of the programme can be enjoyed, so whatever it's doing the VLC behaviour is more desirable as the "rough" bit is over with quickly rather than affecting the entire programme. :-)
Reply
#5
Disable dynamic twinview in the nvidia drivers, it messes with the RandR refreshrates.
Reply
#6
bobo1on1 Wrote:Disable dynamic twinview in the nvidia drivers, it messes with the RandR refreshrates.

Hm, wasn't aware it was enabled; not mentioned in /etc/X11/xorg.conf (which is just as generated using nvidia-xconfig).

BTW, the audio sync issue is only affecting these files; not anything else I play; older HD content, AppleTV content, any SD content, DVD images... all are fine. It's just these.

I'll look for it anyway; as the system's set for xbmc-live it looks like I'll have to fiddle a bit to be able to run nvidia-settings...

(You don't mean it has to be disabled in the machine doing the remuxing do you? As that *does* have it enabled, and I can see the options to enable it in its xorg.conf.)

Anyway, in the meantime I saw your reply just as I came on to announce that the file I was uploading has uploaded, and is at http://strangenoises.org/~rachel/lcts2-bit.mpg
Reply
#7
Rachel Wrote:Hm, wasn't aware it was enabled; not mentioned in /etc/X11/xorg.conf (which is just as generated using nvidia-xconfig).

BTW, the audio sync issue is only affecting these files; not anything else I play; older HD content, AppleTV content, any SD content, DVD images... all are fine. It's just these.

Oh yes, and (as reported originally) I get the same issue when playing the same video using XBMC on the Mac. If anything the offset is slightly worse, I now suspect. Logfile for that session is uploaded to http://strangenoises.org/~rachel/xbmc-mac.log.

(However, the Mac does also have NVidia - in this case a GeForce 8800 GS; but I don't think there's a way for me to turn twinview off on that. Smile)

But yeah, if it was only affecting the Linux version I'd have reported it in the Linux subforum. Smile
Reply
#8
The problem is that it's a 25 fps file, but the codec says it's 50 fps and that messes a bit with our synchronize mechanisms.

You can manually adjust the a/v offset in the audio and subtitle settings dialog until this gets fixed.
Reply
#9
bobo1on1 Wrote:The problem is that it's a 25 fps file, but the codec says it's 50 fps and that messes a bit with our synchronize mechanisms.

That would presumably be because it's interlaced, ie: 1080i. Smile. Hm. Obviously XBMC is deinterlacing, but it gives me a thought that I might try some of the other options for doing so. Or possibly to see if I can find a way to deinterlace during the remux process (but that presumably means de/re/encoding and thus would be a lossy operation?)

Quote:You can manually adjust the a/v offset in the audio and subtitle settings dialog until this gets fixed.

Hm, that'll then presumably make it wrong for the other material, that's currently correct?

BTW, have now also uploaded the source .mpg from the EyeTV clip. FYI it seems XBMC plays this in sync (but with other problems, subtitles, wrong audio track).

To be found at http://strangenoises.org/~rachel/lcts2-eyetvbit.mpg.
Reply
#10
XBMC saves the audio delay setting per movie, unless you choose "apply to all movies".

You don't have read permissions set on the second sample, so I can't download it.
Reply
#11
Rachel Wrote:That would presumably be because it's interlaced, ie: 1080i. Smile. Hm. Obviously XBMC is deinterlacing, but it gives me a thought that I might try some of the other options for doing so. Or possibly to see if I can find a way to deinterlace during the remux process (but that presumably means de/re/encoding and thus would be a lossy operation?)

OK, I just set the deinterlacing method back to "Auto-Select" (it had been on "De-interlace") and I *think* the problem is solved! Or at least much improved, and close enough that I really have to concentrate to *think* it might be off. If it is, it's by such a small number of frames now that it's borderline to my vision.

... just checking some of the older material to see if that isn't broken by this...

... well that's not good because now it's crashing when I try to access a folder with videos I only played (perfectly) a few days ago...

OK, that little hissy fit past, it seems to be happy now. I guess it just needed some state reset.

So in summary, your mention of the 50fps issue made me try setting deinterlacing back to "Auto-Select" as a default for all media, and it now appears to be playing everything, new and old, fine now.

I don't know if you still think there's an underlying timing issue to be fixed, and I'll leave the video files mentioned above on my webspace for a while if they're useful... but for me it feels fixed now and I can get on with converting all the other recordings I've made in the last month... Smile Especially if the ultimate fix goes in the player and my exports will be OK.

(NB: I haven't tried XBMC on the Mac with different deinterlacing settings. The Linux box is the one under my TV and that's the one I care about. Smile)
Reply
#12
bobo1on1 Wrote:XBMC saves the audio delay setting per movie, unless you choose "apply to all movies".

You don't have read permissions set on the second sample, so I can't download it.

Sorry about that permissions error; fixed.

I had a feeling it could be set per movie though I didn't find it straight away, but I'm much happier if the auto-select deinterlace option just works for everything. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with sound sync, where VLC has no problem0