0

As above, I'm looking to create a basic Windows.Forms GUI with two video players, one showing the original video and the other showing an edited version. Looking at using C#, but I'm open to using C/C++ if there's a particular reason to, it also doesn't have to be Windows.Forms but since it doesn't need to be particularly impressive visually I thought it would be the best due to simplicity/I have a little experience in it (although not for years).

At the moment I'm using AxWindowsMediaPlayer controls:

    private void loadMedia_btn_Click(object sender, EventArgs e)
    {         
        OpenFileDialog openFileDialog1 = new OpenFileDialog();
        openFileDialog1.AddExtension = true;
        openFileDialog1.DefaultExt = "*.*";
        openFileDialog1.ShowDialog();

        initialVideoPlayer.URL = openFileDialog1.FileName;
        string fileName = openFileDialog1.FileName;
    }

Had a quick look at others such as DirectShow and OpenCV (mainly for the editing) but I'm not sure the best way to do it, since I can't seem to extract frames from the WMP control very easily, I didn't know if there was a neater way of doing it? One issue is that the computers in the labs don't seem to have DirectX (or at least not a new version) and so I'm not sure DirectShow will work.

I've looked at various questions like:

Take image from video playing on windows media player in C#

C# Windows Forms capture a image from embeded Windows Media Player

But they seem to create images which doesn't seem ideal since I'll be wanting to extract each frame in order to process them (applying interpolation, hopefully motion estimation, edge detection maybe).

So I'm looking to play the video, extract the frames and perform some processing, then putting everything back together to play in the 2nd player.

Thanks for any advice :)

Community
  • 1
  • 1
GeorgeStorm
  • 15
  • 1
  • 8

1 Answers1

0

You can use custom transform DirectShow filter to perform video processing or Sample Grabber filter with callback to perform processing directly in your code (can be slow in C#, but you can use Intel IPP invokes to make it very fast).

To edit video you can use simple graph with source, sample grabber and encoders/muxer or DirectShow Editing Services (if you are planning to provide more functionality in the future).

roman.minyaylov
  • 203
  • 1
  • 9
  • So you would recommend just using DirectShow, trying to get around the lab PCs not having it (can you locally install Directx/the libraries it needs?) I'm looking to implement the processing on the PC and then on a dev. board over ethernet later on. So would you suggest using DirectShow for the displaying of the video as well, get rid of the AxWMP completely? – GeorgeStorm Dec 09 '14 at 11:36
  • I thought it required a certain version of DirectX which I wasn't sure was installed, my mistake :) – GeorgeStorm Dec 22 '14 at 14:18
  • well, 9.0 or later required, I think you're not able to find PC with older DirectX version today. – roman.minyaylov Dec 22 '14 at 18:13
  • I see I can use getcurrentbuffer to extract the raw pixel data, and I've edited an example so I extract the frame, convert to bitmap then perform bilinear interpolation to check the algorithm works fine which it seems to. However I'm not sure how to go about extracting the frame, performing the interpolation then playing it in another video player afterwards, any recommendations? Don't really want to convert to bitmap each time to perform the interpolation but I think I may be able to work that out, but also don't want to save a new video file to play. – GeorgeStorm Dec 28 '14 at 14:49