AWS Thinkbox Discussion Forums

Frame Length from .mov or .avi?

Is there an operation in Draft for getting a frame range from a .mov or .avi?

Actually, I am not sure there is. If we don’t, we should…

It would be nice for the cookbook if it was the same function for everything.

getframerange(inputFilePath)

then you could feed it:

EWD_QIT-0060_A01.01.%04d.exr
or
EWD_QIT-0060_A01.01.mov

and get a range() python type.

Currently I think you’d need to do something like:

frameCount = 0 dec = Draft.VideoDecoder( r"\\path\to\movie.mov" ) img = Draft.Image.CreateImage( 1, 1 ) while( dec.DecodeNextFrame( img ) ): frameCount += 1 print frameCount
May I ask why you need the frame count? I’m thinking about how we should handle this.

If I’m converting an uncompressed quicktime to an h264 don’t I need to know how many frames there are?

Ahhh, I see you just “While” the problem away. That works too. Which leads to the next question. How do I then get the dimensions for the mov? So that I can set the “CreateImage” specs properly?

EDIT: + framerate from incoming .mov

The DecodeNextFrame() function will automatically resize the image for you.

Good point, we definitely need to add that!

We should probably let you directly read the width and height too, to make the script a bit simpler (so you don’t need to read a frame before making the VideoEncoder).

Privacy | Site terms | Cookie preferences