Getting correct format and frame range if QuickTime movie, added via Python

Written by Antony Nasce on .

If you want to add a QuickTime movie to the DAG pythonically, here's a trick for making sure you get the correct format and frame range.
(setValue on the file knob after a node has been created does not work as expected)

1
2
filepath = myMov.mov
nuke.createNode("Read", "file {"+filePath+"}")

 

Comments   

 
+1 # Ivan Busquets 2010-08-18 02:47
Hi Antony,

In case it helps in future coding, try the fromUserText() method on the file knob instead of setValue(). That should take care of the format and frame range.

Ex.

n = nuke.createNode('Read')
n['file'].fromUserText('/path/to/your/file.mov')
 
 
0 # Jep Hill 2010-10-20 11:09
Great tip Ivan — this holds true for RED files as well...

Here's a little function that handles it:
def movieRead(nodeName,filePath):
mov=nuke.nodes.Read(name=nodeName)
mov['file'].fromUserText(filePath)

Cheers,
Jep
 
 
0 # Leo Hourvitz 2011-05-24 19:55
Thanks for the tip, this is a lifesaver.
 
 
0 # Joshua LaCross 2023-02-07 16:10
This is a really old thread but are there any solutions for building a script from scratch? I've been using python to build scripts from scratch that can be submitted to deadline in order to convert my video file to frame sequences. I've been using openCV to get the frame ranges from Quicktimes but I'm running into issues where openCV doesn't work on many of the codecs we use.
 

You have no rights to post comments

We have 2088 guests and 55 members online