Clip module API
Accessing clips
The number of clips being passed into the node can be found:
num= pfpy.getNumClips()
print "node has", num, "input clips"
A reference to a clip can be obtained as follows:
c= pfpy.getClipRef(input)
where input is an integer indicating which input to fetch a clip from, in the range 0 to N-1 inclusive, where N is the number of clips returned by pfpy.getNumClips().
A reference to the source clip (i.e. the clip at the top of the tracking tree, before any adjustments such as lens undistort or rolling shutter removal have been performed) can be obtained as follows
c= pfpy.getClipRef(input, True)
API functions
Examples of these functions in use are provided by the python scripts available in the exports, macros and nodes installation folders.
getFrameRate()
Parameters:
none
Description:
Returns the frame rate of the clip, measured in frames-per-second.
Example:
c= pfpy.getClipRef(0)
print "frame rate is", c.getFrameRate(), "fps"
getInPoint()
Parameters:
none
Description:
Returns the in-point of the clip
Example:
c= pfpy.getClipRef(0)
print "clip runs from frame", c.getInPoint(), "to frame", c.getOutPoint()
getOutPoint()
Parameters:
none
Description:
Returns the out-point of the clip
Example:
c= pfpy.getClipRef(0)
print "clip runs from frame", c.getInPoint(), "to frame", c.getOutPoint()
getPixelAspect()
Parameters:
none
Description:
Returns the pixel aspect ratio of the clip
Example:
c= pfpy.getClipRef(0)
print "pixel aspect is", c.getPixelAspect()
getFrameWidth()
Parameters:
none
Description:
Returns the width of the clip's image frame
Example:
c= pfpy.getClipRef(0)
print "frame is", c.getFrameWidth(), " x ", c.getFrameHeight()
getFrameHeight()
Parameters:
none
Description:
Returns the height of the clip's image frame
Example:
c= pfpy.getClipRef(0)
print "frame is", c.getFrameWidth(), " x ", c.getFrameHeight()
getFilename()
Parameters:
string component name:
- 'dir' to return the directory path
- 'file' to return the filename
- 'sep' to return the directory separator
- 'num' to return the frame number template
- 'ext' to return the file extension
- 'all' to return the entire filename
Description:
Returns part or all of the clip filename. Note that unless this function is called by an export script, only the source clip, as obtained by pfpy.getClipRef(index, True), will contain a valid filename.
Example:
c= pfpy.getClipRef(0)
print "filename is", c.getFilename('all')
isMovieFile()
Parameters:
none
Description:
Returns a boolean indicating whether the clip source is a movie file (as opposed to an image sequence).
Example:
c= pfpy.getClipRef(0)
if c.isMovieFile():
# do something