There’s a C# demo that does something very similar in the LEADTOOLS Multimedia SDK. (Disclaimer: I am an employee of the vendor of this toolkit).
The SDK has a free evaluation that includes the demo, which you can download here.
After you install the SDK, you can find the demo’s source code in this folder:
Since the demo generates AVI instead of MP4, and writes text on a blue background instead of black, you need to modify 6 lines of code in 4 functions to make it match your stated requirements. Below are all the changes needed:
//original code: _tbFile.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\count.avi";
_tbFile.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\text.mp4";
//original code: double AvgTimePerFrame = (10000000 / 15);
double fps = 1.0; //1 frame per second
double AvgTimePerFrame = (10000000 / fps);
//original code: convertCtrl.VideoCompressors.MCmpMJpeg.Selected = true;
convertCtrl.TargetFormat = TargetFormatType.ISO;
convertCtrl.VideoCompressors.H264.Selected = true;
//original code: DrawCenteredText(i.ToString());
string s = "This is string number " + i.ToString();
//original code: _blueBrush = new SolidBrush(Color.Blue);
_blueBrush = new SolidBrush(Color.Black);
//original code: using(Font f = new Font("Arial", 100))
//font was large since text was only a number
//make font smaller to fit larger text
using (Font f = new Font("Arial", 12))
The toolkit has free technical support during evaluation, so if you face problems getting the code to work, you can email the details to our support team.