I've prepared the sample for you -
https://github.com/visioforge/directshow-samples/tree/main/Encoding%20Filters%20Pack/dotnet/MP4%20v10%20Output%20Demo
In your code, be sure that you've specified width, height, and the frame rate (avgtimeperframe) in the media type used for video output.