How to load a particular frame from video

Hello,

I can see how to use “image.load” to load an image file that I can then assign to a texture. If I use a video file as the source it will use the first frame. How do I load a particular frame in the video?

I realize that this is probably a simple question, but I’ve looked all over and can’t find the answer anywhere…

Harley

I think that in the texture panel, if you set the file to be considered as a movie, there you can set the frame number. What you should do is set the frame you want in the ¨StrartFr¨ field, and set the ¨Frames¨ field to 1 (the field right at the right of the ¨premul¨ button…

PD: sorry, I didn´t see in which section I was posting!! I think this might not be the answer you were looking for! :frowning:

Convert your video to an image sequence then you can pull in any frame you need by simply constructing the filename for any given frame number.

If you are stuck with an AVI or MOV, you could try the obvious of simply move to the frame number for the frame you want.


Blender.Set("curframe",900)

One thing you will probably have to insure is that the Autorefresh button for the texture is enabled. But quite frankly, auto refresh is flaky and only works if the objects that is receiving the animated texture is selected.

In python, this is translated with the setStart method of the image object.
See this detailson this page :
http://www.zoo-logique.org/3D.Blender/scripts_python/API/Image.Image-class.html#setStart

Thanks!

I’ve never actually had any luck at all with that “setStart” when I’ve tried before, and just assumed it didn’t work. The docs even mention that it only takes a number between 0 and 128, which always seemed a bit odd. I would expect it to take any integer greater than 0.

I normally use still images extracted from videos, but the file size expansion is so huge that I was hoping to use video sources more often. I guess I was looking for something like hooks into ffmpeg.

This thread is partially related to this thread:
http://blenderartists.org/forum/showthread.php?t=154515

Someone had asked why a video texture was not updating automatically in the 3D window as he changed frames. I was hoping there might be some python-related solution.

Thanks again.

Harley

Curious, it works in background image but not in simple image texture.

jms,

Yes, you can get it really close to working as you expect it to. With GLSL on you see the current frame in the 3D window. You can change frames in your animation, and only if you have the texture panels open you can see the change in the preview. But the 3D window won’t update unless you press the “reload” button for the texture.

I just want the reload to happen automatically and without having to have the texture panels open. I tried using a framechanged script but that behaviour was odd in that it always refreshed the previous frame instead of the one you moved to.

Then I thought I would do it all by hand in python in framechanged, but have had no luck there either.

Harley