Video Playback Question

This forum is currently in read-only mode.
From the Asset Store
8-bit retro-style music and sound effects: 10 loops-able music tracks and 301 individual SFX!
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • If you're placing static things over the video then perhaps the simplest method is to edit the video itself <img src="smileys/smiley6.gif" border="0" align="middle" />

  • 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...

  • 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.

  • Does this method have any advantages over using construct's built-in sprite animation capabilities?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)