Audio out of 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
eon_designs
Posts: 12
Joined: Sun Jan 31, 2010 10:24 am

Audio out of Sync

Post by eon_designs »

This is a bit of an odd one - but probably simple to fix (fingers crossed)

I am trying to get my subtitles burn in, and using info from another thread (HOWTO:Blu-ray "Forced" Subtitles-Avatar, District 9, etc...)

I create a full MKV file from one of my BluRays. There are several ways - in this instance the easiest is using a different bit of software and making an MKV file under their remux option (not sure if I can mention the software in this forum?). This ouputs an MKV with uncompressed streams so it is a very big file and creates the subtitles as individual idx and sup files. It also has the advantage of being able to remove any HD audio if necessary so will make a DTS HD audio to just DTS etc (saving a little bit of space when eventually converted)

I can then merge the idx/sub files back into the MKV using MKVMerge. If I load this file into Handbrake I can then burn in the subtitles as they are visible in the subtitles tab under the track pulldown :-)

I am then selecting the High Profile, changing the audio to passthrogh, downsizing to a smaller size and RF to 19. The whole process takes about 1hr 30 mins. However the end files audio is out of sync with the video? When I play the original MKV and the newly created merged MKV they are both in perfect sync - it is only after going through Handbrake that they become out of sync.

Any suggestions why? Is it caused by the removal of the HD Audio? is it down to the original program used to create the MKV? or is it something in the merging process (compressed headers or not compressed headers etc)?

I am going to try putting the original MKV through Handbrake to see if it is the re-merging process that is creating the problem, and also going to try putting the original BluRay straight through Handbrake to see if that is ok.

Shame that we have to go through all this just to get burn in subs - surely it must be easier.

your kind comments please. ED
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Audio out of Sync

Post by phibertron »

I dont do a lot of BR encodes at the moment

But I did notice some of the audio sync issues in my past two attempts

This is what I did to solve them
1. created my MKV with MakeMKV with the title, audio, and subtitle tracks I needed
2. used mkvextract with MKVExtractGUI2 to extract only the PGS subtitle
3. used BDSup2Sub to convert the PGS to VOBSUB IDX
4. used mmg (mkmerge gui) to add the VOBSUB (idx) to the origianl MKV
( i did this by first adding the origianl untouched mkv created by makemkv and then adding the idx to it)

previously to the above I had had extracted everything, and then added it all back plus the idx
it is when i didnt mess with the original mkv and just merged the idx into it that I had success
( I suspect that in doing it this way, the fps or other references are retained from the originak mkv )

hope this helps, not saying it will or will not work, just that it is what I have been doing that seems to be working
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Audio out of Sync

Post by phibertron »

please note that in addtion to the above, when I encoded the mkv

detelecine was set to off
framrate was set to 23.976
audio track 1 aac (dts source)
audio track 2 passthrough (dts source)
mduell
Veteran User
Posts: 8196
Joined: Sat Apr 21, 2007 8:54 pm

Re: Audio out of Sync

Post by mduell »

eon_designs wrote:I can then merge the idx/sub files back into the MKV using MKVMerge. If I load this file into Handbrake I can then burn in the subtitles as they are visible in the subtitles tab under the track pulldown :-)

I am then selecting the High Profile, changing the audio to passthrogh, downsizing to a smaller size and RF to 19. The whole process takes about 1hr 30 mins. However the end files audio is out of sync with the video?

Any suggestions why? Is it caused by the removal of the HD Audio? is it down to the original program used to create the MKV? or is it something in the merging process (compressed headers or not compressed headers etc)?

your kind comments please. ED
See that big red box at the top of every forum page? It contains good ideas.
GregiBoy
Veteran User
Posts: 908
Joined: Sat Feb 12, 2011 9:23 pm

Re: Audio out of Sync

Post by GregiBoy »

Fancy seeing you here, E_D!!!!
eon_designs
Posts: 12
Joined: Sun Jan 31, 2010 10:24 am

Re: Audio out of Sync

Post by eon_designs »

Hello GregiBoy. Yes here too, causing problems. :-)
eon_designs
Posts: 12
Joined: Sun Jan 31, 2010 10:24 am

Re: Audio out of Sync

Post by eon_designs »

Apologies - Here is the log of one of the conversions that had audio sync issues:

The original file was ok
The individual mkv used were ok
The newly created merged mkv was ok

it is only after going through Handbrake that there is a sync issue: I used MKVmerge version 4.5.0 with no compression set on the Audio, Video and Subtitle tracks when merging.

# Windows GUI 0.9.5 2011010300
# Running: Microsoft Windows NT 6.1.7600.0
# CPU: Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
# Ram: 12279 MB
# Screen: 1680x1050
# Temp Dir: C:\Users\AppData\Local\Temp\
# Install Dir: C:\Program Files (x86)\Handbrake\Snapshot
# Data Dir: C:\Users\AppData\Roaming\HandBrake\HandBrake\0.9.5.3728

# CLI Query: -i "C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv" -t 1 -c 1 -o "C:\UsersDesktop\Merged 4.5 no compression.mkv" -f mkv -w 1280 -l 528 -e x264 -q 20 -a 1 -E copy:dts -6 auto -R Auto -B auto -D 0 --subtitle 1 --subtitle-burn=1 -x b-adapt=2:rc-lookahead=50 --verbose=1
# User Query: False
-------------------------------------------

[08:19:54] hb_init: checking cpu count
[08:19:54] hb_init: starting libhb thread
HandBrake 0.9.5 (2011010300) - MinGW i386 - http://handbrake.fr
8 CPUs detected
Opening C:\UsersDesktop\Remux\Merged ex HD 4.5.0 no compression.mkv...
[08:19:54] hb_scan: path=C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv/BDMV/index.bdmv
libbluray/bluray.c:960: nav_get_title_list(C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv) failed (0x184a778)
[08:19:54] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[08:19:54] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv':
Duration: 02:20:00.72, start: 0.000000, bitrate: 1536 kb/s
Chapter #0.0: start 0.000000, end 626.250000
Metadata:
title : (01)00:00:00:000
Chapter #0.1: start 626.250000, end 906.322000
Metadata:
title : (02)00:10:26:250
Chapter #0.2: start 906.322000, end 1467.215000
Metadata:
title : (03)00:15:06:322
Chapter #0.3: start 1467.215000, end 2389.303000
Metadata:
title : (04)00:24:27:215
Chapter #0.4: start 2389.303000, end 2992.406000
Metadata:
title : (05)00:39:49:303
Chapter #0.5: start 2992.406000, end 3295.000000
Metadata:
title : (06)00:49:52:406
Chapter #0.6: start 3295.000000, end 3877.623000
Metadata:
title : (07)00:54:55:000
Chapter #0.7: start 3877.623000, end 4187.057000
Metadata:
title : (08)01:04:37:623
Chapter #0.8: start 4187.057000, end 4824.569000
Metadata:
title : (09)01:09:47:057
Chapter #0.9: start 4824.569000, end 5443.479000
Metadata:
title : (10)01:20:24:569
Chapter #0.10: start 5443.479000, end 6104.098000
Metadata:
title : (11)01:30:43:479
Chapter #0.11: start 6104.098000, end 6417.661000
Metadata:
title : (12)01:41:44:098
Chapter #0.12: start 6417.661000, end 6624.576000
Metadata:
title : (13)01:46:57:661
Chapter #0.13: start 6624.576000, end 7139.674000
Metadata:
title : (14)01:50:24:576
Chapter #0.14: start 7139.674000, end 7437.179000
Metadata:
title : (15)01:58:59:674
Chapter #0.15: start 7437.179000, end 8400.726000
Metadata:
title : (16)02:03:57:179
Stream #0.0(eng): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
Metadata:
title : Video
Stream #0.1(eng): Audio: dca, 48000 Hz, 5.1, s16, 1536 kb/s
Metadata:
title : Audio
Stream #0.2(eng): Subtitle: dvdsub
Metadata:
title : Subs
[08:19:54] scan: decoding previews for title 1
[08:19:54] scan: audio 0x1: DCA, rate=48000Hz, bitrate=1536000 English (DTS) (5.1 ch)
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
[08:19:55] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 140/140/0/0, aspect 16:9, PAR 1:1
[08:19:55] scan: title (0) job->width:1920, job->height:800
[08:19:55] libhb: scan thread found 1 valid title(s)
+ title 1:
+ stream: C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv
+ duration: 02:20:00
+ size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 23.976 fps
+ autocrop: 140/140/0/0
+ chapters:
+ 1: cells 0->0, 0 blocks, duration 00:10:26
+ 2: cells 0->0, 0 blocks, duration 00:04:40
+ 3: cells 0->0, 0 blocks, duration 00:09:20
+ 4: cells 0->0, 0 blocks, duration 00:15:22
+ 5: cells 0->0, 0 blocks, duration 00:10:03
+ 6: cells 0->0, 0 blocks, duration 00:05:02
+ 7: cells 0->0, 0 blocks, duration 00:09:42
+ 8: cells 0->0, 0 blocks, duration 00:05:09
+ 9: cells 0->0, 0 blocks, duration 00:10:37
+ 10: cells 0->0, 0 blocks, duration 00:10:18
+ 11: cells 0->0, 0 blocks, duration 00:11:00
+ 12: cells 0->0, 0 blocks, duration 00:05:13
+ 13: cells 0->0, 0 blocks, duration 00:03:26
+ 14: cells 0->0, 0 blocks, duration 00:08:35
+ 15: cells 0->0, 0 blocks, duration 00:04:57
+ 16: cells 0->0, 0 blocks, duration 00:16:03
+ audio tracks:
+ 1, English (DTS) (5.1 ch) (iso639-2: eng), 48000Hz, 1536000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
[08:19:55] 1 job(s) to process
[08:19:55] starting job
[08:19:55] sync: expecting 15038 video frames
[08:19:55] job configuration:
[08:19:55] * source
[08:19:55] + C:\Users\Desktop\Remux\Merged ex HD 4.5.0 no compression.mkv
[08:19:55] + title 1, chapter(s) 1 to 1
[08:19:55] + container: matroska,webm
[08:19:55] + data rate: 1536 kbps
[08:19:55] * destination
[08:19:55] + C:\Users\Desktop\Merged 4.5 no compression.mkv
[08:19:55] + container: Matroska (.mkv)
[08:19:55] * video track
[08:19:55] + decoder: h264
[08:19:55] + frame rate: same as source (around 23.976 fps)
[08:19:55] + dimensions: 1920 * 1080 -> 1280 * 528, crop 140/140/0/0, mod 0
[08:19:55] + encoder: x264
[08:19:55] + options: b-adapt=2:rc-lookahead=50
[08:19:55] + quality: 20.00 (RF)
[08:19:55] * subtitle track 0, English (id 2) Picture [VOBSUB] -> Render/Burn in
[08:19:55] * audio track 0
[08:19:55] + decoder: English (DTS) (5.1 ch) (track 1, id 1)
[08:19:55] + bitrate: 1536 kbps, samplerate: 48000 Hz
[08:19:55] + DCA passthrough
[08:19:55] encx264: min-keyint: auto (23), keyint: 240
[08:19:55] encx264: Encoding at constant RF 20.000000
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
x264 [info]: profile High, level 3.1
[08:19:55] reader: first SCR 0 id 0 DTS 0
[08:19:55] sync: audio 1 time went backwards 0 ms, dropped 3 frames (next 230400, current 230400)
[08:19:56] sync: audio 1 time went backwards 0 ms, dropped 4 frames (next 402240, current 402240)
[08:19:56] sync: audio gap 74 ms. Skipping frames. Audio 1 start 436770, next 430080
[08:20:00] sync: audio 1 time went backwards 0 ms, dropped 6 frames (next 1155840, current 1155840)
[08:20:00] sync: audio gap 75 ms. Skipping frames. Audio 1 start 1180860, next 1174080
[08:20:03] sync: audio 1 time went backwards 0 ms, dropped 7 frames (next 1674240, current 1674240)
[08:20:03] sync: audio gap 85 ms. Skipping frames. Audio 1 start 1706880, next 1699200
[08:20:08] sync: audio 1 time went backwards 0 ms, dropped 5 frames (next 2784000, current 2784000)
[08:26:43] reader: end of chapter 1 (media 1) reached at media chapter 2
[08:26:43] reader: done. 1 scr changes
[08:26:46] work: average encoding speed for job is 36.684071 fps
[08:26:46] sync: got 15016 frames, 15038 expected
[08:26:46] h264-decoder done: 15016 frames, 0 decoder errors, 0 drops
[08:26:46] render: lost time: 0 (0 frames)
[08:26:46] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:129 Avg QP:17.96 size: 89982 PSNR Mean Y:45.57 U:47.29 V:47.41 Avg:46.07 Global:45.69
x264 [info]: frame P:4192 Avg QP:21.26 size: 25651 PSNR Mean Y:43.42 U:45.88 V:45.73 Avg:44.05 Global:43.44
x264 [info]: frame B:10695 Avg QP:23.52 size: 7519 PSNR Mean Y:42.69 U:45.48 V:45.25 Avg:43.38 Global:42.77
x264 [info]: consecutive B-frames: 1.4% 4.6% 11.1% 82.8%
x264 [info]: mb I I16..4: 7.9% 70.3% 21.9%
x264 [info]: mb P I16..4: 2.0% 10.6% 2.4% P16..4: 39.8% 20.8% 12.3% 0.0% 0.0% skip:12.2%
x264 [info]: mb B I16..4: 0.1% 1.2% 0.2% B16..8: 46.9% 6.9% 1.7% direct: 3.5% skip:39.3% L0:41.1% L1:50.1% BI: 8.8%
x264 [info]: 8x8 transform intra:71.7% inter:75.5%
x264 [info]: coded y,uvDC,uvAC intra: 77.4% 87.1% 63.8% inter: 24.3% 28.7% 4.9%
x264 [info]: i16 v,h,dc,p: 50% 14% 4% 31%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 16% 15% 6% 9% 9% 9% 9% 9%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 18% 12% 6% 10% 10% 9% 7% 6%
x264 [info]: i8c dc,h,v,p: 47% 18% 24% 11%
x264 [info]: Weighted P-Frames: Y:4.2% UV:2.6%
x264 [info]: ref P L0: 59.4% 17.5% 16.4% 6.6% 0.1%
x264 [info]: ref B L0: 90.1% 8.1% 1.9%
x264 [info]: ref B L1: 95.6% 4.4%
x264 [info]: SSIM Mean Y:0.9733051 (15.736db)
x264 [info]: PSNR Mean Y:42.916 U:45.611 V:45.399 Avg:43.586 Global:42.963 kb/s:2549.04
[08:26:46] mux: track 0, 15016 frames, 199550727 bytes, 2548.81 kbps, fifo 8
[08:26:46] mux: track 1, 58691 frames, 118086292 bytes, 1508.29 kbps, fifo 1024
[08:26:46] libhb: work result = 0
Rip done!
HandBrake has exited.
eon_designs
Posts: 12
Joined: Sun Jan 31, 2010 10:24 am

Re: Audio out of Sync

Post by eon_designs »

I just did a further test - looks like the version of MKVMerge could be the issue.

I tried an older version 4.0.0 (that was the last one that did not introduce the compression choice) and when this is used to remux the subs back into the MKV file and put into Handbrake the output seems to be perfect.

I will do some more tests just to make sure.
Deleted User 11865

Re: Audio out of Sync

Post by Deleted User 11865 »

Did you disable header removal compression in mkvmerge?
eon_designs
Posts: 12
Joined: Sun Jan 31, 2010 10:24 am

Re: Audio out of Sync

Post by eon_designs »

Hello Rodeo

Yes, when using the latest version 4.5 I manually went through each of the tracks (audio, video) and set the compression in MKVMerge to None - When this version was used with Handbrake it was out of sync.

When using version 4.0, that does not have the setting for compression the Handbrake conversion was fine.
Deleted User 11865

Re: Audio out of Sync

Post by Deleted User 11865 »

I'm not familiar with Mkvtoolnix under Windows, but there should be an mmg (mkvmerge GUI) preference to disable header removal compression by default (while leaving other compression schemes enabled - IIRC, VOBSUB in MKV is compressed by default, for example). Not sure whether it'll help though.
Under OS X, this option seem to require a relaunch of the GUI to take effect.
match
Enlightened
Posts: 111
Joined: Sun Mar 14, 2010 5:08 pm

Re: Audio out of Sync

Post by match »

Yeah, I had a huge problem with my files after moving past mkvmerge 4.0. It was due to the header compression as mentioned, which was turned on by default in later versions. There is a way to turn it off by default as suggested. Open Mkvmerge gui and go to File->Options, then check off the box for "disable header removal compression for audio and video tracks by default".
Deleted User 11865

Re: Audio out of Sync

Post by Deleted User 11865 »

I wonder if the nightlies (with the newer FFmpeg) fare any better with such MKVs.
Post Reply