View Full Version : Tsmuxer is desyncing my MKV - help!
ikantspelwurdz
14th April 2013, 15:49
Here's a broad level outline of what I have done.
1: Ripped an MKV from a Blu-Ray without the sound. I'm not entirely sure how long it is, but going by VLC, it's 1:47:03. Milliseconds unknown, and other tools have reported slightly different runtimes.
2: Created a 6-channel WAV file using sources other than the Blu-Ray and edited in Audacity. Runtime is 1:47:03 and 130ms.
3: Used AviDemux to make a new MKV, using the video from MKV in step 1 and the audio from step 2.
This new MKV syncs fine, though I have noticed that if I jump to a random part in VLC, the sound cuts out for about a second. I haven't known VLC to do this.
Specs are:
-Stream 0
--Type: Video
--Codec: H264 - MPEG-4 AVC part 10 avc1
--Resolution: 1920x1080
--Frame rate: 23.976215
--Decoded format: Planar 4:2:0 YUV
-Stream 1
--Type: Audio
--Codec: PCM S16 LE (araw)
--Channels: 3F2R/LFE
--Sample rate: 48000 Hz
--Bits per sample: 16
Now, if I run Tsmuxer to try to turn this MKV into a Blu-Ray image, it loses its sync. I don't remember all of the settings tweaks I've tried, but I've tried a bunch of them.
QBhd
14th April 2013, 16:28
I would hazard a guess and say the mkv is not in sync either... the pause in audio when skipping is probably vlc trying to compensate for this. Quick question... why the audio from "sources other than the Blu-Ray"?
To find the exact time of the video all you need to do is find the frame count and do the math [n frames * 24 / 1.001] = time in seconds (your audio is 6423.13 seconds long)
QB
ikantspelwurdz
14th April 2013, 16:35
I haven't watched the MKV from start to finish, but I have checked it in 10 or so different places, several times, and it might not be perfect, but it's consistently close enough. The m2ts is clearly out of sync worse than the MKV.
The audio came from a DVD. I want the DVD's audio with the BD's video. This is because the BD uses an unauthentic remix. I did do some tweaking to the DVD audio in audacity.
How would I get the exact frame count of the video? Also, is there any possibility that the MKV has a variable frame rate?
tebasuna51
15th April 2013, 10:27
...
How would I get the exact frame count of the video? Also, is there any possibility that the MKV has a variable frame rate?
You can use MediaInfo (Debug -> Advanced mode) to know both answers.
You can also try suply video and audio in two files (instead muxed) to your Authoring BluRay software.
Use the wav 2.1 file like I say you here (http://forum.doom9.org/showthread.php?p=1624209#post1624209).
Ghitulescu
15th April 2013, 12:51
1: Ripped an MKV from a Blu-Ray without the sound. I'm not entirely sure how long it is, but going by VLC, it's 1:47:03. Milliseconds unknown, and other tools have reported slightly different runtimes.
2: Created a 6-channel WAV file using sources other than the Blu-Ray and edited in Audacity. Runtime is 1:47:03 and 130ms.
3: Used AviDemux to make a new MKV, using the video from MKV in step 1 and the audio from step 2.
Now, if I run Tsmuxer to try to turn this MKV into a Blu-Ray image, it loses its sync. I don't remember all of the settings tweaks I've tried, but I've tried a bunch of them.
Stupid question (or maybe not :))
Why did you need to go through MKV if your goal was to make a BD? Wasn't tsMuxer not good enough?
ikantspelwurdz
16th April 2013, 03:35
You can use MediaInfo (Debug -> Advanced mode) to know both answers.
Thanks for that. Here's the frame info I see in the text view:
Frame rate mode : CFR
Frame rate mode : Constant
Frame rate : 23.976
Frame rate : 23.976 fps
Frame count : 154009
I also see a bunch of references to "CABAC / 4 Ref Frames" if that means anything.
So I guess the correct runtime for the video is 1:47:03 and 459ms, or 329ms longer than the audio.
I just tried playing the TS file in VLC, going into the Effects->Synchronization menu and applying a -0.329s offset to the audio track synchronization (the audio was playing too late). The result was a lot better - there still seemed to be a very subtle lip-flapping effect, but I might just live with it. I checked at two places, one near the beginning, one near the end, and both were acceptably close.
So I have a hypothesis, but no way of proving it beyond the evidence I've already seen. My hypothesis is that when the audio and video differ by length, Avidemux syncs it to the beginning, while Tsmuxer syncs it to the end. Or possibly one of them (but not the other) stretches it. This is the only guess I can think of that would explain the discrepancy. I'll try to remake that 2.1 file, this time adding 329ms of silence at the end, and then I'll see what happens when I Tsmuxer it.
Stupid question (or maybe not )
Why did you need to go through MKV if your goal was to make a BD?
I actually went directly with MultiAVCHD the first time, and was disappointed that it didn't sync according to my calculations. I went through MKV after that to see if the results were different, and they were... until I made the TS again.
QBhd
16th April 2013, 06:32
So you know the audio is different length than video... but now you need to determine if the is silence at the beginning, end OR both (100ms at the beginning and 229 at the end could still be a possibility) ... tough job. Just more food for thought.
QB
Ghitulescu
16th April 2013, 09:19
329 ms is not a second :rolleyes:
Are you sure your video is ok?
tebasuna51
16th April 2013, 15:00
If mkv play in sync maybe the audio track have a delay in the container not translated to ts by tsMuxeR.
Whit MediaInfo you can know also if the audio track have a initial delay:
Audio #1
...
Delay relative to video : 999ms
Put the same delay in the audio track in tsMuxeR
You must ignore the total length of video/audio tracks, only initial delay must change the sync.
Ghitulescu
16th April 2013, 16:55
The last time I checked, 999 is bigger than 300 :)
ikantspelwurdz
18th April 2013, 05:16
Ok, update on my progress. I've added 329ms of silence to the end of the WAVs, and made that 2.1 mix. Tsmuxer reported it as a 2.1 audio track when it made a BD image.
Mounted the BD image... and it's reported as LPCM 3.0 and plays as such. Not only that, but it's still desynced, in exactly the same way that the shorter track was. Argh!
So I went back to the 5.1 WAV. Used Tsmuxer again, and this time, I got the bright idea to apply a -329ms time offset to the WAV in Tsmuxer, and the final result syncs reasonably well. I think at this point I'm not going to try all that hard to improve what I've got, but I'd still like to hear ideas, for next time.
One very annoying thing, though. I made a BD image in MultiAVCHD with menus and such, and when I mount it and run PowerDVD, 4 times out of 5 PowerDVD crashes while loading. And when it doesn't crash, trying to navigate the menus makes it crash, and even playing the main feature usually makes it crash - I only succeeded once. Any ideas what might be wrong here? Again, I don't feel like re-creating the image repeatedly with loads of different options enabled/disabled, since it takes 45 minutes each time, but any insights are welcome. If not, I might just live with it until free BD authoring software improves.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.