Bad A/V synchronization encoding some DVDs

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
Smash
Posts: 5
Joined: Sun Apr 08, 2007 7:15 pm

A/V Sync Issue

Post by Smash »

This is the same problem I'm having with my Stargate SG1 episodes. (Starting with season 6). I like ripping them at the high 720x400, and then coping them over to my AppleTV.

So can this Sync issue be resolved?
Using OSeX and Diva I can't make MP4s? So is there really a work around?
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: A/V Sync Issue

Post by jbrjake »

Smash wrote:This is the same problem I'm having with my Stargate SG1 episodes. (Starting with season 6). I like ripping them at the high 720x400, and then coping them over to my AppleTV.
What ever are you talking about? Did you even read the thread first? The original poster's bug report is for an audio desync with RTP streaming. Considering you're talking about copying files over to an ATV, you're certainly not streaming....and the original poster wasn't talking about streaming from iTunes, anyway, but using something like QTSS with hinted RTP streaming.
Smash
Posts: 5
Joined: Sun Apr 08, 2007 7:15 pm

Re: A/V Sync Issue

Post by Smash »

Then you are correct, my issue has nothing to do with streaming.

What I am seeing is a 1 to 3 second out of sync with the Audio and the Video. (With the audio leading). My framerate is Same as source, and the encoder is FFmpeg, ave bit 1000kbps.

This issue is very frustrating, and it is a new problem to me. As I have been using Handbrake for many months now, with no issues before.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Ok, split it off to its own thread.

I'll see if I can excavate my copies of the season 6 dvds to try to reproduce this.
Smash
Posts: 5
Joined: Sun Apr 08, 2007 7:15 pm

Post by Smash »

If this helps:
If I skip the first chapter there is no a/v sync issue, or if I encode at 15 frames/sec there is no sync issue. It is just painfull to watch. :roll:
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Sorry this took me so long to get back to.

I just checked with Season 6 Disc 1 Episode 1. Encoding in the CLI with verbose on produced this log output, indicating the problem is happening in sync.c code:

Code: Select all

[09:06:07] sync: first pts is 31263
Encoding: task 1 of 1, 0.36 %
[09:06:09] sync: trashing late audio
[09:06:09] sync: trashing late audio
and then this later on:

Code: Select all

Encoding: task 1 of 1, 88.08 % (11.05 fps, avg 61.30 fps, ETA 00h00m53s)
[09:12:42] sync: trashing late audio
[09:12:42] sync: trashing late audio
[09:12:42] sync: adding 50 ms of silence for track 80bd
[09:12:42] sync: trashing late audio
[09:12:42] sync: adding 50 ms of silence for track 80bd
[09:12:43] sync: trashing late audio
So I ripped the disc to disk and looked around in Streamclip. Sure enough...

Code: Select all

File: VTS_01_1.VOB
Wednesday, 09:41:46: Fix Timecode started
timecode break at 0:00:05
timecode break at 0:44:04
timecode break at 1:28:00
timecode break at 2:11:58
timecode break at 2:55:55
Wednesday, 09:44:51: Done
Anotherwords, the problem is a (intentionally? It is Sony/MGM after all) badly mastered DVD, not HandBrake.
Smash
Posts: 5
Joined: Sun Apr 08, 2007 7:15 pm

Post by Smash »

Sorry this took me so long to get back to.
No problem, I'd like to think we are all very busy.

I agree this problem is intentional, because I have found this problem to be true through season eight. (I don't have season nine, and season ten I can purchase from iTunes)

Have you seen any other DVD with this a/v sync issue? Could there be a work around?

Thanks again for your efforts.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Smash wrote:Have you seen any other DVD with this a/v sync issue? Could there be a work around?
It happens with a lot of DVDs. That epic audio drop-out thread in the support forum is caused by the same thing; the time codes for the audio on the DVD don't go in order, and HB tries to compensate by dropping some or adding in silence.

The solution is to do what I did--fix the timecode breaks in Mpeg Streamclip.

But there are many downsides.

1: HandBrake can't read output from Streamclip yet. Awk has a working patch to do it, but it's not checked into the source yet, so you have to compile yourself.

2: You'll have to have double the storage space available, because you need to rip the dvd to the hard drive, then fix the time codes and save as a copy.

3: You have to buy the MPEG-2 quicktime component from Apple

4: Fixing the timecodes only takes like 5 minutes, but saving the fixed copy can take like 30-45 minutes.

5: Those SG-1 episodes aren't split up by .vob file, so you'll have to fix the breaks on the entire disk in one go. That means you'll end up with 1 giant .vob with all the episodes in it, with no chapter breaks. You'd have to trim the output by hand in streamclip to edit back down to individual episode sized chunks. EDIT: Or you could try fixing the individual vobs, substituting the corrected ones in the VIDEO_TS directory, and see what happens with a current build of handbrake. I might try this later if I have a chance.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Using a newer build, with Cyander's chapter work included, I noticed something else...

Right at the beginning of the encode, the CLI reports:

Code: Select all

DVD: Beginning of Cell
DVD: End of Cell
DVD: Beginning of Cell
So it looks like it might be an empty-cell problem...the audio timecode breaks might be incidental.

You might want to try running the DVD through DVD2OneX and removing the first cell there.
Post Reply