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\DVD8
registry key. This has a DWORD value called NOVideoDrop
which 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 Common
folder which contains sub folders called AUDIODEC
and VIDEODEC
which I assume stand for audio and video decoder. The VIDEODEC
folder contains sub folders for a number of programs including Windows Media Player and Windows Media Encoder. So I took a guess and added the NOVideoDrop
entry 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.
HKEY_CURRENT_USER\Software\InterVideo\Common\VIDEODEC\cscript\NoVideoDrop
HKEY_CURRENT_USER\Software\InterVideo\Common\VIDEODEC\wmenc\NoVideoDrop
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
NoVideoDrop
DWORD in other folders as well.
This is useful stuff. I have to admit I gave up trying to encode videos a few years back due to similar issues.
It just makes no sense that a non-real time encoder is allowed to drop frames, and even more insane that there isn't a command line argument to prevent it.
I'm almost tempted to get back into video encoding... almost!
Post a Comment