Oct 4, 2016

Nuke studio edit export to mrviewer

Hi, new post again, whoooa! Sorry for the delay! But we had a big-big project in the first half of the year: we had the honor to work on the new feature movie made for the Final Fantasy XV game, called "Kingsglaive". It was an extreme effort for our studio, to do the more than 13 minutes of photorealistic cg animation, from previz to compositing, but at the end we managed to complete 433 shots! I took part as lead compositor, and I can say we learned a lot on this show. Thanks to Square Enix for getting us on board, despite of that at the end we had our most rough and challenging weeks of all time, in terms of workload and the lack of sleep :)
So for this tip: we are using nuke studio for handling our editing work. That means usually from previz, every editorial job is done in this software. Without this, and its export system, would have been much much harder to deliver all the shots in all the requested formats for Square. The problem was that we have only a few licenses, and a lot of artist should be looking at the cut. Exporting the cut to quicktimes is not a perfect solution, because it's color, quality, can't zoom in, and it's not showing always the latest state of the work, just in the moment of exporting. So I searched and found a solution: mrviewer! Its brilliand piece of open source player, with a lot of options. (Sometimes it crashes, but which software doesn't? :)
Here is a code snippet, you can export the edit from nuke studio, to mrviewer. Its not handling dissolves or anything fancy, just putting the clips one after the other, with the provided in and out points. But usually that's what we need.


# MRPLAYER REEL GENERATOR:
from hiero.core import *
import os.path
import re
myProject = projects()[-1]
clipsBin = myProject.clipsBin()
selItems = hiero.selectedItems
try:
  len_selitems = len(selItems)
except:
  len_selitems = 1
print len_selitems
clipsPaths = []
if len_selitems > 1:
  for item in hiero.selectedItems:
    if type(item) == TrackItem:
      print "\n-----------\n%s"% item.name()
      filepath = item.source().mediaSource().firstpath()
      ssin = item.source().sourceIn()
      print 'Clip source (version) in: %s ' % str(ssin)
      ssout = item.source().sourceOut()
      print 'Clip source (version) out: %s ' % str(ssout)
      usedSInRelative = item.sourceIn()
      print 'Clip (shot) in: %s ' % str(usedSInRelative)
      usedSOutRelative = item.sourceOut()
      print 'Clip (shot) out: %s ' % str(usedSOutRelative)
      usedSourceInResult = ssin + usedSInRelative
      usedSourceOutResult = ssin + usedSOutRelative
      print 'Clip source startTime: %s' % item.source().mediaSource().startTime()

      clipsPaths.append([filepath, usedSourceInResult, usedSourceOutResult, ssin, ssout ])
path = 'c:/temp/XY_editorial_COMP.reel'
fileh = open(path, 'w')
fileh.write('Version 2.0\n')
for line in clipsPaths:
  fileh.write('"%s" %s %s %s %s\n' % (line[0], int(line[1]), int(line[2]), line[3], line[4]))
fileh.write('EDL')
fileh.close()
#---------------------------------------

You will need this pythonscript installed for studio.
So the workflow is: in studio select the needed clips, prefereably cut one after the other in one track. Use the getpythonselection script, that store the clips in python objects. 
Edit the output path to the desired path in the script at line which now says:path = 'c:/temp/XY_editorial_COMP.reel'
Keep the extension ".reel"
Run this script. It writes out the reel file to the provided path. In mrviewer you can now open this as an image. It will load the clip list, but in order to see the entire cut, you need to press the edl button in the "reels" dialog.
Hope this helps for you. If you have problems, or find a bug, or just used this script without any problems, let me know.


1 comment: