Skip to content
Advertisement

How to read video file using Foundry Nuke Python interpreter?

I try to merge 2 videos in Nuke. When I’m doing it in GUI everything is OK but when I’m doing it in python interpreter the result contains only the first frames of each video. What am I doing wrong in the code below?

import nuke

content = nuke.nodes.Read(file="/content.mp4")

bg = nuke.nodes.Read(file="/bg.mov")
merged = nuke.nodes.Merge(inputs=[bg, content])

output = nuke.nodes.Write(file="/output.mov", inputs=[merged])

nuke.render(output)

Advertisement

Answer

Info for developers – ☢️ NUKE reads in video’s last frame value as 1 by default.

You must explicitly assign a value for last video frame in NUKE’s Read node:

import nuke

nuke.nodes.Read(file="/Users/swift/Desktop/myVideo.mov", last=300)
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement