Basic video editing using C# Windows Forms
![]()
I’m building a C# application (Windows Forms and .NetFramework 4.8). I use the Accord.Net framework to record a video in .mp4 format on the computer. After recording, I am using the Windows Media Player control to play the video that was recorded.
string applicationFolder = Application.StartupPath; if (File.Exists(applicationFolder + @”tempvideoTemp.mp4″)) { axWindowsMediaPlayer1.URL = applicationFolder + @”tempvideoTemp.mp4″; }
I need to edit this video by adding a text at the bottom for a specific time. During recording I can add text using the command below before saving the frame in the .mp4 file:
using (Graphics g = Graphics.FromImage(currentFrame)) { //g.DrawString(“test”…); }
I thought of doing the same with the video that is played by the Windows Media Player control. For that I looked for some event of the player where I can get a pointer to each new frame of the video playing, but no success.
When creating a Windows Media Player Graphics, the text is reproduced in the video, but only when the application is running, the saved video is not affected.
using (Graphics g = axWindowsMediaPlayer1.CreateGraphics()) { //g.DrawString(“test”…); //it’s show only when application is running }
The question: Does Windows Media Player have any feature where I can capture the current frame of the video being played? If not, is there any way to recover a video saved on the computer, edit it frame by frame and then save it by overwriting the old video using C#?
Sorry for my English. Thank you everyone.
