Video Playback Question

For questions about using Classic.

Post » Sun Mar 31, 2013 9:45 pm

I've looked around for a while and as far as I can tell, there is no way to play a video in construct classic without it rendering on top of all other elements.

I have tried the python methods proposed by R0J0hound as well as the built-in AVI Object.

I thought I would check here though, to confirm that no one has found a solution yet to this problem.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Mon Apr 01, 2013 1:20 am

I'm not sure if R0J0hound's Texture Setter plugin would help here, but if it can pull the texture off the video and then copy it to a Sprite you might be able to get around this.
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Mon Apr 01, 2013 6:47 am

There isn't a simple solution to this.
I was looking into solving this when I made the python examples and I didn't like how much work it looked like it would take to do it the correct way. AKA writing a plugin using directshow. Besides that solution my thought is the problem boils down to two things:
1. Read a frame from a video
2. Get that frame to a texture so that Construct can draw it.

One (1) is easy, there are many python libraries that can do this. Two (2) is the problematic step. Existing ways in Construct to draw video aren't drawn by Constructs rendering engine but instead are drawn by other means to a child window. That's why the video is on top and has the side issue of not having a texture that textureSetter can get.

One idea I have is to use python with pyffmpeg to read individual frames from a video and write them to a temporary file. Then load that file with the "load frame from file" action to a sprite every frame. This may work but will kill the framerate because of the constant hardrive (hd) access. This could be helped a bit with a plugin and saving and loading a file in memory to avoid hd access.

Even if it's working to that point it's not going to be optimal. Loading a image to a texture stalls Construct's renderer, and still there is the audio of the video to deal with.

SHORT ANSWER:
The solution is to write a plugin to do it, which will be time consuming.
or use existing methods and scratch the need for the video to not be on the top.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Apr 01, 2013 6:51 am

That sounds/sounded like a great idea.

I may be doing this wrong, but when I attempt to use the texture setter plugin to give a sprite the texture of an AVI Object, I get a runtime error on application start,

"Construct encountered an error in the display engine. Please report this problem to the application developer."

"Cannot set a multisampled rendertarget as texture (0x80004005)"

It may just not be possible using this method. Still, many thanks for the suggestion, it was a good idea.



I just noticed R0J0hound's reply. It looks like I do not have the capability to do this at the moment.

Thanks to the both of you for taking the time to confirm this for me at least.WarpedOldMan2013-04-01 06:55:04
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Mon Apr 01, 2013 9:42 am

If you're placing static things over the video then perhaps the simplest method is to edit the video itself
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Mon Apr 01, 2013 11:35 am

Indeed. Though what I was attempting to do here was use a small looped video segment as a background for a main menu of sorts.

Seeing that I can run an swf file makes me wonder if I could possibly build the menu in flash, and embed that to serve as the main menu. Then all I need to do is figure out how to make it communicate with construct...WarpedOldMan2013-04-01 11:35:53
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Mon Apr 01, 2013 11:28 pm

I managed to get something working with python.
http://dl.dropbox.com/u/5426011/examples17/ffmpeg.zip

It extracts frames to a file and then loads it into a sprite. I'm getting about 15 fps on my machine.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Wed Apr 03, 2013 8:27 pm

Does this method have any advantages over using construct's built-in sprite animation capabilities?
B
17
S
2
Posts: 66
Reputation: 1,382


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests