Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How do you convert a video to a memblock so you can view frames of the video? This is advanced stuff!

Author
Message
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 26th Apr 2012 06:19 Edited at: 26th Apr 2012 06:20
Hi guys,

I'm trying to do something kind of advanced. I'm trying to convert avi file by using make memblock from file 1,"my.avi." After that I need to convert the memblock file to a image memblock. Which I will stream it. I'm basically trying to fast forward a movie through a memblock. because I noticed Lee Bamber didn't add no fast forward or rewind to the load animation commands. :S

The idea is to be able to grab 1 second frame of a image from a avi or video. Anyone thinks they can help me out. It's kind of advanced though.

darkvee
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 26th Apr 2012 15:36 Edited at: 26th Apr 2012 15:37
Doing it like this is as close to impossible as you're going to get. There are many video file formats and each one can encode the video using one of thousands of different codecs available. You'd really need to write a plugin using the DirectShow API (the same as how DBPro does it) or something similar to get it to work.

[b]
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 26th Apr 2012 16:01
I don't think you can do this with vanilla DPpro code. You would need to interface with Video for Windows or some such. I do have some pascal (Delphi) code that I used to write a screen recorder last year.

I could wrap part of into a simple DLL so you can extract a video frame from any AVI file as an image.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 26th Apr 2012 16:03 Edited at: 26th Apr 2012 16:07
That may be sound stupid, but i don't know any game, that has feauture for rewinding intro's or other vid's. Even rarely seen 'pause' feauture.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2012 16:45
I've got a number of small projects on the go at the moment but extracting avi frames from any avi file is one of them I will get round to doing soon. My Video Capture Utility is only the start of it.

When it is actually done I'll be posting it. And at the moment I ain't got a clue whether or not I'll be able to add pause, rewind, etc so I can't answer that yet either.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 29th Apr 2012 21:38
Hi guys,

Thanks for the feed back The Weeping Corpse, that would be great of you could make me a dll that I an do that. One more think though I need a plugin that can enter the start frame like 20 mins in the video and it will go to 20 mins in the video and I could hit play to play it from their.

darkvee
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 30th Apr 2012 08:20 Edited at: 30th Apr 2012 08:20
Yep, you would specify the frame number you want to extract, then display that on screen, so you can play forwards by inc`ing the frame number, play it in reverse by dec'ing the frame number etc.

some pseudo code might look like this:

TWC AVI OPEN "c:\my videos\bla bla bla.avi", number_of_frames, memblock_pointer

for i = 1 to number_of_frames
TWC AVI EXTRACT i
rem do whatever you want with memblock here
next i

TWC AVI CLOSE

you will only be able to open 1 avi at a time.

I will be able to look into it in more detail next week cause I am busy listening to voice auditions for my game.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Apr 2012 13:53
@The Weeping Corpse - It'd bee interesting to see how you get on with the avi extraction. I've not even got to that point yet.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 30th Apr 2012 15:59
@WLGfx

This is my AVI reader writer code based on the Win32 Video for Windows. It's written in pascal thus probably of no use to you anyway, but it could be converted into c without too much pain. The command you need to look into is AVIStreamGetFrame.

The code is not pretty but its been used to process hours and hours of AVI footage with my screen recorder.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Apr 2012 17:23
It's weird seeing it written in another language altogether. I'll probably use that as a reference when I eventually get around to doing mine. It's the same route I was going down with both the screen capture and the reader using vfw... Cheers

If you're interested in the project for my video capture just drop me an email and I'll send the entire project over to you. At least then you'll also have something as a reference...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 8th May 2012 05:10
Hi The Weeping Corpse,

Can I get your plugin This should be very useful.

darkvee

Login to post a reply

Server time is: 2026-07-11 03:57:03
Your offset time is: 2026-07-11 03:57:03