WriteNode Class Reference

The WriteNode JavaScript object. Provide information about rendered images and the movie to generate. More...

Public Slots

StringList imageFiles ()
 Return list of generated images. More...
 
String imageFilesPattern ()
 Return the pattern of generated images. More...
 
bool hasSound ()
 Return true if exported scene contains sounds. More...
 
String exportSound (int channelSize, int channelCount, int sampleRate)
 Return the scene's soundtrack in a temporary file in the WAV format. More...
 
int startFrame ()
 Returns the start frame to be exported. More...
 
int stopFrame ()
 Returns the stop frame to be exported. More...
 
double frameRate ()
 Returns the frame rate, as frames per second. More...
 
String movieDir ()
 Return movie folder. More...
 
String movieName ()
 Return movie name. More...
 

Detailed Description

The WriteNode JavaScript object. Provide information about rendered images and the movie to generate.

try
{
var images = WriteNode.imageFiles();
for (var i = 0; i < images.length; i++)
{
MessageLog.trace("generated image : " + images[i]);
}
var outputFile = WriteNode.movieDir() + "/" + WriteNode.movieName() + ".mov";
var soundFile;
{
soundFile = WriteNode.exportSound(16, 2, 22050);
}
// Use ffmpeg to generate movie from rendered images.
var args = [
"ffmpeg",
"-y",
"-start_number",
"-i",
];
if (soundFile)
{
args = args.concat([
"-i",
soundFile,
"-c:a",
"copy"
]);
}
args = args.concat([
"-vframes",
"-r",
"-c:v",
"mpeg4",
"-pix_fmt",
"yuv420p",
outputFile
]);
MessageLog.trace("execute : " + args.join(" "));
var process = new Process2(args.join(" "));
var retCode = process.launch();
if (retCode != 0)
{
MessageLog.trace("Process return code: " + retCode);
if (process.errorMessage())
{
MessageLog.trace("Error: " + process.errorMessage());
}
MessageLog.error("Movie generation script error");
}
}
catch(err)
{
MessageLog.error("Movie generation script error: " + err);
}

Member Function Documentation

◆ exportSound

String WriteNode::exportSound ( int  channelSize,
int  channelCount,
int  sampleRate 
)
slot

Return the scene's soundtrack in a temporary file in the WAV format.

Note
The generated temporary audio file is removed at the end of export.
Parameters
channelSizethe audio channel size (i.e. 8 or 16 bit).
channelCountthe number of audio channels (i.e 1 for mono and 2 for stereo).
sampleRatethe audio sample rate in Hz (i.e. 22050, 44100, ...)..
Returns
the name of generated temporary audio WAV file or empty string if no sound tracks or any error.

◆ frameRate

double WriteNode::frameRate ( )
slot

Returns the frame rate, as frames per second.

Returns
The frame rate, as frames per second.

◆ hasSound

bool WriteNode::hasSound ( )
slot

Return true if exported scene contains sounds.

Returns
true if exported scene contains sounds and script movie mode was activated.

◆ imageFiles

StringList WriteNode::imageFiles ( )
slot

Return list of generated images.

Note
Images are automatically removed at the end of export.
Returns
StringList of full path names of generated images.

◆ imageFilesPattern

String WriteNode::imageFilesPattern ( )
slot

Return the pattern of generated images.

Note
Images are automatically removed at the end of export.
Returns
Pattern of generated images (ex "Write_tmp-%06d.sgi"), which could be used as ffmpeg parameter.

◆ movieDir

String WriteNode::movieDir ( )
slot

Return movie folder.

Returns
Return movie folder absolute path

◆ movieName

String WriteNode::movieName ( )
slot

Return movie name.

Returns
Return movie name without extension

◆ startFrame

int WriteNode::startFrame ( )
slot

Returns the start frame to be exported.

Returns
The start frame to be exported.

◆ stopFrame

int WriteNode::stopFrame ( )
slot

Returns the stop frame to be exported.

Returns
The stop frame to be exported.