Suddenly audio no longer in sync

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
sqlbob
Posts: 4
Joined: Tue May 15, 2018 12:29 am

Suddenly audio no longer in sync

Post by sqlbob » Tue May 15, 2018 12:34 am

Description of problem or question:
I've been using handbrake for years to convert .avi video to H.264 in .mp4. All of a sudden, as of last week, audio is no longer in sync. I've been doing my best to troubleshoot this with no luck.

Last week my PC upgraded from Windows 10 version 1709 to version 1803. I also made the mistake of upgrading from Handbrake 1.0.7 to 1.1.0. At some point in there, my encoded videos started losing sync. Yes, I know I created multiple variables and that's never good...

I've since rolled back both the handbrake and Windows updates, neither of these have fixed it. Yes, I have checked, and audio sync is fine in the source .avi files.

If anyone else has ideas of what can be done to troubleshoot this, I am open to all suggestions.

For those who might be curious about my setup:
- Lenovo W520 with Intel i7-2720QM processor (quad core, 2.2Ghz)
- 32GB memory
- Dual SSDs
- Windows 10 64-bit

I realize it's an older machine, but still does quite well for video transcoding, or it did until this latest issue. I highly doubt this PC is too slow to encode anymore.

(Yes, I also posted this question to reddit. I am happy to update both posts with solutions if one is found.)

HandBrake version (e.g., 1.0.0):
1.1.0



Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Windows 10 v. 1709



HandBrake Activity Log ***required*** (see How-to get an activity log)

You can find a log of it here:
https://pastebin.com/1fhSyUGM

User avatar
BradleyS
Moderator
Posts: 1298
Joined: Thu Aug 09, 2007 12:16 pm

Re: Suddenly audio no longer in sync

Post by BradleyS » Tue May 15, 2018 12:15 pm

Nothing too obvious in the log. If you can provide a small sample that exhibits the problem we can investigate further.

sqlbob
Posts: 4
Joined: Tue May 15, 2018 12:29 am

Re: Suddenly audio no longer in sync

Post by sqlbob » Tue May 15, 2018 4:11 pm

Well this is interesting. I tried trimming off a small sample of this file to share here, and no matter how I do it, it also loses sync. I've never seen anything like this.

To recap:
- Original file (Type 1 AVI containing DV video) has audio in sync just fine
- Tried using ffmpeg to trim a portion of this video (maintaining audio/video codecs) and it loses sync
- I also tried this on 2 other PCs with more resources, same result

It really appears this issue is not limited to just Handbrake, as I'm seeing it in ffmpeg as well. Are there any common libraries shared between the two that may have changed recently? I'm happy to dig and troubleshoot as much as possible to resolve this, but if anyone can help point me in a direction I would really appreciate it.

Woodstock
Veteran User
Posts: 2602
Joined: Tue Aug 27, 2013 6:39 am

Re: Suddenly audio no longer in sync

Post by Woodstock » Tue May 15, 2018 6:14 pm

Experiment: If you have mkvtoolnix, try loading the original AVI in mkvmerge, and simply write it out as an MKV file. This makes no changes to the encoding.

Is the audio in sync when you play the MKV file?

sqlbob
Posts: 4
Joined: Tue May 15, 2018 12:29 am

Re: Suddenly audio no longer in sync

Post by sqlbob » Wed May 16, 2018 2:04 pm

So, indirectly, I think this got me to a solution.

I've never used mkvtoolnix before, but was happy to try. I tried running the simple convert to MKV using mkvmerge as you suggested, and it errored out because apparently mkvmerge doesn't like Type-1 AVI files. I re-captured as a Type-2 AVI file, converted to MKV, and everything was in sync just fine.

This made me wonder how a Type-2 AVI file might convert to H.264 with Handbrake. I tried this and the output was in sync. I made several other trials with other files and it now appears that the issue I describe above only applies to Type-1 AVI files. Type-2 convert with sync just fine. I had been using Type-1 because I am archiving the capture files and was attempting to save a little space as Type-1 are smaller, but now I must re-think this.

User avatar
BradleyS
Moderator
Posts: 1298
Joined: Thu Aug 09, 2007 12:16 pm

Re: Suddenly audio no longer in sync

Post by BradleyS » Wed May 16, 2018 2:08 pm

Could even be the capture software generating bad type-1 avi. Anyway, glad you got it sorted.

In 2018 I consider MKV a better archival container than AVI.

sqlbob
Posts: 4
Joined: Tue May 15, 2018 12:29 am

Re: Suddenly audio no longer in sync

Post by sqlbob » Wed May 16, 2018 2:13 pm

I actually tried 3 different capture programs while experimenting. While I guess it's possible they're all generating bad Type-1 AVI, I'd consider that rather unlikely.

Every tool I've found so far captures DV as AVI. Is there something else I should be using to capture directly to MKV? Or should I be converting AVI to MKV before archiving?

User avatar
BradleyS
Moderator
Posts: 1298
Joined: Thu Aug 09, 2007 12:16 pm

Re: Suddenly audio no longer in sync

Post by BradleyS » Wed May 16, 2018 2:35 pm

Personally, since DV is an old interlaced format, I would probably capture as Type-2 to avoid the issues you're having, and do an archival quality transcode to MP4 or MKV with HandBrake, employing the Decomb filter to remove the interlacing and optionally NLMeans denoising with its Tape tune, if restoration is needed.

Aside from this, DV in MKV is the same as DV in AVI except MKV is less old and problematic.

User avatar
BradleyS
Moderator
Posts: 1298
Joined: Thu Aug 09, 2007 12:16 pm

Re: Suddenly audio no longer in sync

Post by BradleyS » Wed May 16, 2018 2:39 pm

So, perhaps the Super HQ 480p30 preset and remove the second (surround) audio track. See https://handbrake.fr/docs/en/1.1.0/work ... ality.html for information on adjusting quality further. I imagine you will not see any difference between the source and destination at RF 16.

Post Reply