So the ffdshow filters may not drop frames but something was still going wrong so I decided to have another look at the InterVideo codec that is used by the DVD player software (I use WinDVD, specifically version 8 which was developed by InterVideo although new versions are now branded as Corel) and which was originally decoding the MPEG-2 files before all this trouble started. My wild guess was that there would be a way to force it to output all the frames even if that meant running slower than real time. I couldn't find anything on the web so instead started digging around in the registry.
I eventually came across the
HKEY_CURRENT_USER\Software\InterVideo\DVD8registry key. This has a DWORD value called
NOVideoDropwhich was set to 0 which I assume means false. Changing this to 1 didn't make any difference during the encoding but I felt I was getting closer to a solution. Next to the key for WinDVD 8 there is a
Commonfolder which contains sub folders called
VIDEODECwhich I assume stand for audio and video decoder. The
VIDEODECfolder contains sub folders for a number of programs including Windows Media Player and Windows Media Encoder. So I took a guess and added the
NOVideoDropentry to the folder for the encoder and hey presto I now always get 25 fps and the video and audio are in sync!
So to summarise, to make sure that the MPEG-2 decoding does not drop frames when using the InterVideo MPEG-2 codec add the following two DWORD entries to the registry, setting the value of both to 1.
The first entry makes sure that the command line interface (which is run via cscript) encodes without dropping frames. The second entry does the same for the main graphical interface to the Windows Media Encoder. Of course if you are using a different program then you may need to add the
NoVideoDropDWORD in other folders as well.