Reputation: 137
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 + @"\temp\videoTemp.mp4"))
{
axWindowsMediaPlayer1.URL = applicationFolder + @"\temp\videoTemp.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.
Upvotes: 0
Views: 883
Reputation: 67376
Does Windows Media Player have any feature where I can capture the current frame of the video being played?
No, it's a player. And even if it did, it certainly can't write the result. Since it's a player and all.
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#?
I generally use ffmpeg
for that, it's not terribly difficult and it has hardware acceleration both for decoding and recoding built-in.
Upvotes: 0