100% CPU usage

Hello,
I'm running a simple program for record (using FFMPEG H264 compress) and preview - a 1920x1080 aprox. 50FPS capture device - and i'm constantly getting 100 % of the cpu. I already tested on other pc (not MAC) and same result. Is it normal ?! This is a problem because, when 100% of usage the program drop frames, because it can't handle more..
My specs:
MacBook Pro Early 2015 (native Windows installed)
Intel Core i5 dual-core 2,7 GHz
My Code:
I'm running a simple program for record (using FFMPEG H264 compress) and preview - a 1920x1080 aprox. 50FPS capture device - and i'm constantly getting 100 % of the cpu. I already tested on other pc (not MAC) and same result. Is it normal ?! This is a problem because, when 100% of usage the program drop frames, because it can't handle more..
My specs:
MacBook Pro Early 2015 (native Windows installed)
Intel Core i5 dual-core 2,7 GHz
My Code:
- Code: Select all
(...)
// start camera and preview
VideoCaptureDevice videoSourceEndo = new VideoCaptureDevice(videoDevices[cb_endo.SelectedIndex].MonikerString);
AsyncVideoSource asyncVideoSourceEndo = new AsyncVideoSource(videoSourceEndo);
asyncVideoSourceEndo.SkipFramesIfBusy = false;
videoSourcePlayer1.VideoSource = asyncVideoSourceEndo;
videoSourcePlayer1.Start();
videoSourceEndo.NewFrame += VideoSourceEndo_NewFrame;
(...)
private void VideoSourceEndo_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
if (isRecording && writer1 != null && writer1.IsOpen)
{
Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
writer1.WriteVideoFrame(bitmap);
bitmap.Dispose();
}
}