How to read video file using Foundry Nuke Python interpreter?

Question:

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)
Asked By: shpindler

||

Answers:

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)
Answered By: Andy Jazz
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.