This is how i'm doing it in the command prompt:
ffmpeg -f gdigrab -framerate 24 -i desktop -preset ultrafast -pix_fmt yuv420p out.mp4
And in csharp code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
namespace Ffmpeg_App
{
class Ffmpeg
{
Process process;
public void Start(string FileName, int Framerate)
{
process = new System.Diagnostics.Process();
process.StartInfo.FileName = @"D:\ffmpegx86\ffmpeg.exe"; // Change the directory where ffmpeg.exe is.
process.EnableRaisingEvents = false;
process.StartInfo.WorkingDirectory = @"D:\ffmpegx86"; // The output directory
process.StartInfo.Arguments = @"-f gdigrab -framerate " + Framerate + " -i desktop -preset ultrafast - pix_fmt yuv420p " + FileName;
process.Start();
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = false;
Close();
}
public void Close()
{
process.Close();
}
}
}
In form1 top:
Ffmpeg fpeg = new Ffmpeg();
Start button:
private void Start_Click(object sender, EventArgs e)
{
fpeg.Start("test.mp4", 24);
}
Stop button:
private void Stop_Click(object sender, EventArgs e)
{
fpeg.Close();
}
The problem is when i start recording it also recording first few seconds the console window of the ffmpeg too same when i stop the recording.
How can i make in both cases using only command prompt or using with csharp that it will not show the console window of the ffmpeg ?