It does not depend to which codec he codes, the file will always be out of sync. It's because DosBox presumably records every frame. Since DosBox generally outputs 70 Frames per Second, it records 70fps to the video file.
Now for some unknown reason, e.g. Media Player 6.4 (and other players) will only play 60 frames per second, but will not skip the remaining 10 frames, but append them to the next second. Therefore you will notice that whenever you skip to the middle of a movie, audio will be in sync for a little while, but the longer it plays, the farer it goes out of sync (until you click again). It's a really very annoing problem.
You can circumvent it by useing the Video - Frame Rate feature in Virtual Dub. There, select "Process every other frame". This will reduce the overall framerate to 35/second and therefore produce a perfectly good synched video file (no matter what codec you use in the end to encode). Also, it's no problem that you essentially rip out 35frames of the video, it will still be fluid and there will be no resulting audio off-set (thanks to virtual dubs ingenious programming^^)
You can also use the Frameskip function (because then, there will be lesser frames outputted at all). This is not a very useful solution though, as it makes the overall game choppy e.g. the mouse movement). Sot better stick to the first solution^^
Hope that helps.
Note: Since not everyone is expieriencing this problem, I assume that you also can make certain players (or all of them) to actually process more than 60fps. I haven't found such a setting yet though. Possibly, Linux (or other O/S) users don't have this problem (may be windows-related, some directdraw thingor stupid stuff like that).
Best regards.