View Full Version : Changing aspect ratio of mpeg2 within mkv container

12th October 2009, 21:09
Hi all,

I have ripped all of my DVD's to mkv and have a very neat movie collection. Recent builds of ffdshow and mpc-hc play these at the correct aspect ratio (some tricks and if statements I believe to get around inaccurate mpeg2 aspect ratio flags).

Well I have one movie, James Bond - The World Is Not Enough. This movie plays in 4:3 instead of the 16:9 that is seen when playing from the original DVD.

To get around this, I had to

1) Extract the mpeg2 video file from my mkv using mkvextract 2) Use DVDPatcher to change the Horizontal + Vertical Size + Aspect Ratio settings and apply to "entire file"
3) Deselect the original mpeg2 stream from my mkv, and use the "fixed" mpeg2 file that was output from dvd patcher.
4) Mux this to the final file

This is fine, the aspect ratio is perfect now, image quality all fine etc, but the audio and video is out of sync by approx 2 seconds.

I can't understand why. I have made sure this mpeg2 track within the mkv has the ID of 1 (just like the original mkv file) but nothing seems to get rid of the audio / video sync problem.

Does anyone know what I might be doing wrong, or is there a nicer way to do what I did above. I notice the audio and video is perfectly in sync at the start, and seems to get worse as the time goes on. I can seek back and forth to compare the sync from beginnning to end and the start seems almost perfect.... Even merging back in the original mpeg2 stream gives the same effect so its not dvdpatchers fault.

13th October 2009, 06:05
You can use the "header editor" feature in recent mkvmerge GUI to set the aspect flag manually (and a lot faster than remuxing a bunch of MPEG-2).

File -> Header Editor
File -> Open
Video track N -> Video display width/height

Nominally, this sets the preferred size for windowed mode, but pretty much every player just interprets this as the DAR in fractional form.

As for the synchronization, I have no idea as MPEG-2 is not my usual subject matter.

13th October 2009, 09:35
Just rerip the DVD into a new folder, then use PGCdemux to get the video + audio streams. You can safely delete the problematic MKV file and build a new one using the ESs PGCdemux just produced.

13th October 2009, 12:14
Cheers for that guys. Managed to get audio / video back to sync using a file that must have been made by mkvmerge, a text file containing time codes.....

New problem now in that my mkv (even the original created by makemkv, gives slight audio glitches at certain points, using mpc-hc and even vlc). Reconverting to .ts gets rid of this.... I guess this isn't mpeg2 related so will post elsewhere, thanks alot.