Feature requst: video support through Python

I hope this is an okay spot to put this:

I’ve looked through the Blender source code and I’ve done some research into video playback. And it looks to me that it wouldn’t be too hard to add video playback, except for the fact that I don’t know C++. I’m able to read through some of it, but I can’t really code in it.

Anyways, I was thinking that ffmpeg could be used (it already is elsewhere in Blender so extra libraries wouldn’t be needed) to add video functionality possibly to the Rasterizer module.

Here would be a PyDoc example:

def playVideo(file, plays):
    Plays back a video (file) with ffmpeg. And is played plays times.
    A negative value for plays is interpreted as 0.
    @type file: string
    @type plays: integer

A video could be played back like so:

import Rasterizer

Rasterizer.playVideo("videos/vid.mpg") #Plays videos/vid.mpg 1 time
Rasterizer.playVideo("videos/vid2.mpg", 2) #Plays videos/vid2.mpg 2 times

This method could be used for cutscenes/fmvs, opening credits, etc.

Here is some information about using libavformat and libavcodec:

So, would this be possible if we could find someone nice enough to code it? Or am I just being hopeful/stupid? :stuck_out_tongue:

If this should be posted elsewhere, please let me know. I would really like to see this happen.


That sounds like a really cool idea. I don’t know C++ either but I’d love to see that in the GE.

FMV´s in BGE would be great. But I fear that if it would be so simple to implement, this feature would be in BGE already :).

Anyway, I am for this feature too.

Well, this might be stupid of me, but I think I might try to implement it myself :confused:.

If found another tutorial here:

And I think if I tread carefully, I might be able to do this ^^.

Wish me luck,

Hi, Moguri.

That tutorial seems very usable and all that comments will help for sure. Dont forget that in that tutorial you will make video player. If you want to use some things in it in BGE, you will probably need to implement all this in Rasterizer module in Blender source and make Python methods for calling functions like Rasterizer.playVideo(). -Correct me if I am wrong-

Or are going to make this player as standalone and make some functions, which will be calling this app from BGE?

Edit: I am only trying to help :slight_smile:

As I though, this was too much for me :P. Well, I got stuck just following the tutorial. Either the tutorial has errors, or I should really find something besides vc++ ><.

I guess I’ll go back to waiting and hoping a very nice coder tries to implement this :smiley:

If someone could handle the actual video playback, I could handle the exposing it to python part :wink:

Well, instead of just giving up (like I should have :P) I kept going (sorting out most of the errors). I have a mostly finished version of the file that I’m going to use to play the video. All that is left is to fix a few more errors and add a call to this file from my c++ function that I’m going to expose to Python.

So, hopefully I’ll get a working build made in the next few days :D.

And by the way, my brain is fried :spin:


I am really looking forward to it :). Was there errors in tutorial or have you done some typos?

The errors weren’t typos (well, not all of them :D) but they were more related to me using MSVC++ which the ffmpeg devs don’t really support. Also, from my understanding, that tutorial is C, and I’ve been trying to convert it to C++ :stuck_out_tongue:

I hope this becomes a feature… that would be awesome!