Log in

View Full Version : MakeMKV + Eac3to = Video De-Sync?


CarlEdman
21st February 2011, 21:01
Lately, I've been trying to archive my DVD collection to my NAS.

My process has been to rip the DVDs using MakeMKV, extracting audio/video tracks using eac3to, transcoding them using x264/neroaacenc, and remuxing the tracks using mp4box.

Most of the transcoded mp4s play just fine. However, a significant number have a substantial and often growing divergence between audio and video, even though the source MKVs are fine.

At first I of course that the problem was the audio, rather than the video, but the audio remained perfectly in sync with the subtitles, suggesting that the problem might be the video instead.

At this point I noticed warnings like the following in eac3to's logs for the desynced videos:
[v01] Video has a gap of 26 frames at playtime 0:00:17. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:00:39. <WARNING>
[v01] Video has a gap of 79 frames at playtime 0:00:39. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:00:42. <WARNING>
[v01] Video has a gap of 61 frames at playtime 0:00:42. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:01:13. <WARNING>
[v01] Video has a gap of 14 frames at playtime 0:01:13. <WARNING>
[v01] Video has a gap of 70 frames at playtime 0:01:13. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:01:18. <WARNING>
[v01] Video has a gap of 1 frames at playtime 0:01:18. <WARNING>
[v01] Video has a gap of 13 frames at playtime 0:01:18. <WARNING>
[v01] Video has a gap of 43 frames at playtime 0:01:18. <WARNING>
[v01] Video has a gap of 1 frames at playtime 0:08:33. <WARNING>
[v01] Video has a gap of 6 frames at playtime 0:08:33. <WARNING>
[v01] Video has a gap of 1 frames at playtime 0:08:34. <WARNING>
[v01] Video has a gap of 81 frames at playtime 0:08:34. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:08:40. <WARNING>
[v01] Video has a gap of 56 frames at playtime 0:08:40. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:09:31. <WARNING>
[v01] Video has a gap of 84 frames at playtime 0:09:31. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:10:20. <WARNING>
[v01] Video has a gap of 58 frames at playtime 0:10:20. <WARNING>
[v01] Video has a gap of 7 frames at playtime 0:49:34. <WARNING>
[v01] Video has a gap of 74 frames at playtime 0:49:34. <WARNING>
[v01] Video has a gap of 1 frames at playtime 0:50:02. <WARNING>
[v01] Video has a gap of 6 frames at playtime 0:50:03. <WARNING>
[v01] Video has a gap of 52 frames at playtime 0:50:03. <WARNING>

I had thought that eac3to takes care to add blank frames to the resulting m2v, just like it adjusts time gaps in the audio files it outputs. But perhaps it does not? That seems consistent with my observations.

So at this point I wonder if there is any way to extract the video stream from mkv with the missing video frames replaced by blanks.

Does mkvtoolnix do this? When I originally investigated the issue, it appeared not, but I could be mistaken.

Any other possibility?

b66pak
21st February 2011, 21:10
add "-no2ndpass" to the eac3to line...
_

CarlEdman
21st February 2011, 21:24
Thanks, for the suggestion, b66pak!:thanks:

But can you explain how turning off the second pass audio encoding would help with a video desync issue?

b66pak
21st February 2011, 21:29
this switch will stop eac3to to fix any gap in the audio in a second pass...try it and post the results...
_

CarlEdman
21st February 2011, 21:40
That is a good idea, b66pak, but I don't think it will work. Indeed, many of the files I am having trouble with also exhibit audio gaps roughly aligned with the video gaps. For example, the same file for which I posted the video gaps above, has the following audio gaps:
[a02] Audio has a gap of 161ms at playtime 0:00:17. <WARNING>
[a02] Audio has a gap of 203ms at playtime 0:00:39. <WARNING>
[a02] Audio has a gap of 162ms at playtime 0:00:43. <WARNING>
[a02] Audio has a gap of 216ms at playtime 0:01:14. <WARNING>
[a02] Audio has a gap of 152ms at playtime 0:01:19. <WARNING>
[a02] Audio has a gap of 209ms at playtime 0:08:35. <WARNING>
[a02] Audio has a gap of 148ms at playtime 0:08:41. <WARNING>
[a02] Audio has a gap of 216ms at playtime 0:09:32. <WARNING>
[a02] Audio has a gap of 154ms at playtime 0:10:22. <WARNING>
[a02] Audio has a gap of 193ms at playtime 0:49:36. <WARNING>
[a02] Audio has a gap of 133ms at playtime 0:50:04. <WARNING>

As you see, they do line up reasonably well. Unfortunately, the length of the gaps is very different.

For example, there are two video gaps at 0:39, the longer of which is 79 frames or almost 3 seconds at 24 fps. There is only one audio gap at 0:39 and it is only 203ms. That pattern might not be surprising. When there are blank frames between scenes, often the audio takes longer to fade out and starts fading in sooner.

So omitting the gaps in both audio and video would not come close to aligning them. I think I need a way to insert blank frames into the video too.