Nathan,

This is fantastic, thanks!

I've made a few changes:

--
import os, re, shlex, subprocess 

def sendToFFmpeg():
# grabs the write node's file value and makes sure the path uses printf style 
filenames 
    imgSeqPath = nukescripts.replaceHashes(nuke.thisNode()['file'].value())
    # generate mov path   
    base, ext = os.path.splitext(os.path.basename(imgSeqPath))
    movPath =  os.path.dirname(os.path.dirname(imgSeqPath)) + '/' + 
re.sub('\.?%0\d+d$', '', base) + '.mov'
    # make shell command    
    enc = 'ffmpeg -y -r 24 -i \'%s\' -an -vcodec libx264 -vpre slow -crf 22 
-threads 0 \'%s\'' % (imgSeqPath, movPath) 
    subprocess.Popen(shlex.split(enc), stdout=subprocess.PIPE, 
stderr=subprocess.PIPE) 
--

Specifically,
         Updated the mov path to write the mov one directory up from the image 
sequence

         Added escaped quotations marks around the shell path

         Updated the ffmpeg call for the default compile on ubuntu 11.10


It works well, though I have a couple questions:

        Why did you use 
[^A-Za-z0-9]? instead of just \. in the re.sub() call?
        If the file value passed from the Write node has any TCL, ffmpeg 
obviously fails. Is there a way around this?

Lastly, for anyone else attempting this, remember that ffmpeg assumes the image 
sequence starts at frame 0. At some point, I'll have to work out a way to pass 
any offset to the command.

-
Richard



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to