Hello everyone!
I want to extract some frames from a video file and save them in a variable so I can then use them in my project as still images. I have been looking for some way to do that but i did not find anything at all ... Is there any way of doing that? (I use VB.NET)
Thanks!
Extract frame from video (VB.NET)
Started by sakishrist, Mar 28 2008 08:19 AM
13 replies to this topic
#1
Posted 28 March 2008 - 08:19 AM
|
|
|
#2
Posted 01 April 2008 - 06:01 AM
I don't know about programming one, but you can do this with the normal Windows functions. Just open up the video file in Windows Movie Maker, move the marker to the place in the video you want, then click the little camera icon in the preview box. This will prompt you to save the image.
Otherwise, just load it up in Windows Media Player (WMP) and take a screenshot of it. In some cases the video will not be captured in the screenshot, in which case you need to switch Hardware Acceleration on/off (you can do this inside the Options menus).
If you use Winamp, you can slow the video dow to see the individual frames, for greater control. Once you have saved them as images, you can load them like this:
If you want to show them, you can load them into a picture box:
Or, you can draw them straight to the screen with Me.CreateGraphics().DrawImage().
Xav
Otherwise, just load it up in Windows Media Player (WMP) and take a screenshot of it. In some cases the video will not be captured in the screenshot, in which case you need to switch Hardware Acceleration on/off (you can do this inside the Options menus).
If you use Winamp, you can slow the video dow to see the individual frames, for greater control. Once you have saved them as images, you can load them like this:
Dim bmp As Bitmap = Image.FromFile("C:/thepicture.jpg")
If you want to show them, you can load them into a picture box:
PictureBox1.Image = bmp
Or, you can draw them straight to the screen with Me.CreateGraphics().DrawImage().
Xav
#3
Posted 01 April 2008 - 10:04 AM
Thank you but that's not what I meant. The frames must not be saved in the HDD but just loaded in the ram and all this has to be done withe my application. Anyway, thank you.
#5
Posted 21 April 2008 - 09:16 AM
Yes i did but this wont really help me because i don't want to store the frames in the HDD but just put them in the memory for future use. And there should be some way of taking it from the memory of the "controlled" program but i think it would take me much time to find out some way of doing this. But ... if you have something in mind that would help me i would appreciate it if you tel me!
Thanks really!
Thanks really!
#6
Posted 21 April 2008 - 09:51 AM
#7
Posted 21 April 2008 - 09:57 AM
What I mean by Future use: After extracting about 50 frames i want to get some pixel information and then delete them from the memory ... I don't mean to use them after some weeks. So what i want is just compare a few frames and see if there is any movement ... maybe I wasn't clear enough at the beginning ... Sorry.
#9
Posted 21 April 2008 - 11:28 PM
So that means that I have to display it on a control to get the pixels ... I could try it! Otherwise ill make my own decoder! :)
#10
Posted 22 April 2008 - 09:54 AM
Actually, you don't even need to do that! All you need is to store the current frame as some sort of image, like a Bitmap or Image file. Then, you use this code:
Replace 'myBitmap' with your image. Then, just use g.GetPixel() to get the pixel. I think you have to pass in two parameters when you call the method - the x and y co-ordinates of the pixel. Remember that pixels start in the top-left corner of the image, and progress to the right and downwards.
You might use a loop to put each frame in a slot of a Bitmap() array, then just access them from there.
Quote
Dim g As System.Graphics = Graphics.FromImage(myBitmap)
Replace 'myBitmap' with your image. Then, just use g.GetPixel() to get the pixel. I think you have to pass in two parameters when you call the method - the x and y co-ordinates of the pixel. Remember that pixels start in the top-left corner of the image, and progress to the right and downwards.
You might use a loop to put each frame in a slot of a Bitmap() array, then just access them from there.
#11
Posted 24 April 2008 - 01:53 AM
But can this be done for mpg files?


Sign In
Create Account


Back to top









