RenderJob
data-variant=info
data-slots=text
Since: 27.0
A RenderJob represents a single job in the render queue. It is obtained via RenderQueue.getJob, rather than constructed directly.
const app = require("mediaencoder");
const result = await app.RenderQueue.enqueueFile(
"path/to/source.mov",
"path/to/preset.epr",
"path/to/out.mp4",
);
const job = app.RenderQueue.getJob(result.jobId);
Constants
These Constants are used to interpret getStatus and as parameters to setWorkAreaType. All Constants are class properties, accessed via the RenderJob object:
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getStatus() === app.RenderQueue.getJob(jobId).STATUS_ENCODING;
WORKAREATYPE_CUSTOM
Work area type value for custom in / out points.
Type: int
Since: 27.0
WORKAREATYPE_DEFAULT
Work area type value for the default in / out points from the sequence.
Type: int
Since: 27.0
WORKAREATYPE_ENTIRE_SEQUENCE
Work area type value for the entire duration of the sequence.
Type: int
Since: 27.0
WORKAREATYPE_IN_TO_OUT_POINTS
Work area type value for the set in / out points of the sequence.
Type: int
Since: 27.0
WORKAREATYPE_WORKAREA
Work area type value for the entire workarea of the sequence.
Type: int
Since: 27.0
STATUS_WAITING
Job is waiting to be processed.
Type: int
Since: 27.0
STATUS_ENCODING
Job is currently encoding.
Type: int
Since: 27.0
STATUS_DONE
Job finished successfully.
Type: int
Since: 27.0
STATUS_DONE_WARNING
Job finished with warnings.
Type: int
Since: 27.0
STATUS_FAILED
Job failed.
Type: int
Since: 27.0
STATUS_PAUSED
Job is paused.
Type: int
Since: 27.0
STATUS_STOPPED
Job was stopped.
Type: int
Since: 27.0
STATUS_SKIPPED
Job was skipped.
Type: int
Since: 27.0
STATUS_INVALID
The job handle is no longer valid, for example if the job was removed from the queue. Returned by getStatus instead of throwing.
Type: int
Since: 27.0
Properties
These read-only properties are available on any RenderJob instance.
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.batchItemID; // "1b814929-65b6-4d83-b822-68ce5cd2f741"
batchItemID
GUID of the job.
Type: string (readonly)
Since: 27.0
groupID
GUID of the containing job group.
Type: string (readonly)
Since: 27.0
encodingTime
Elapsed encoding time, in seconds.
Type: number (readonly)
Since: 27.0
Methods
setCustomInAndOutPoints
Sets custom in and out points in the sequence. Note that the WORKAREATYPE_CUSTOM work area type will be set implicitly here.
Since: 27.0
Parameters
Returns
RenderJob objectconst app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
const startTime = app.TickTime.createWithSeconds(0);
const endTime = app.TickTime.createWithSeconds(1);
job.setCustomInAndOutPoints(startTime, endTime);
setRotation
Sets the rotation of the job (in a 360-degree system).
Since: 27.0
Parameters
Returns
RenderJob objectconst app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.setRotation(45); // Rotate 45 degrees
setWorkAreaType
Sets the designated type of work area. Use the WORKAREATYPE_* constants to specify the desired type of work area.
Works only with project files that contain sequences. If the input sequence has a predefined work area or in and out points, this method will set them properly. Note that the custom work area type will only function correctly if you have previously called setCustomInAndOutPoints.
Since: 27.0
Parameters
WORKAREATYPE_* constant valuesReturns
RenderJob objectconst app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.setWorkAreaType(job.WORKAREATYPE_ENTIRE_SEQUENCE);
getStatus
Gets the current status of the job.
Since: 27.0
Parameters
none
Returns
STATUS_* constantsconst app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getStatus();
isInFinalState
Checks whether the job has reached a terminal state (done, failed, or stopped).
Since: 27.0
Parameters
none
Returns
true if the job has reached a terminal stateconst app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.isInFinalState();
getEncodeProgress
Gets the encoding progress as a percentage.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getEncodeProgress();
getEncodeProgressMessage
Gets a human-readable progress message for the job.
Since: 27.0
Parameters
none
Returns
"Analyzing audio..."const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getEncodeProgressMessage();
getErrorText
Gets a single-line error string for the job, if it failed.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getErrorText();
getLogOutput
Get the log output of the job.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getLogOutput();
getOutputFilePath
Gets the output file path for the job.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getOutputFilePath();
getOutputFilesAfterExport
Gets the list of files written by the encoder after export completes.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getOutputFilesAfterExport();
getPresetName
Gets the name of the preset applied to this job.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getPresetName();
getVideoSummary
Gets a video format summary string for the job.
Since: 27.0
Parameters
none
Returns
"H.264 1920x1080"const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getVideoSummary();
getAudioSummary
Gets an audio format summary string for the job.
Since: 27.0
Parameters
none
Returns
"AAC, 320 kbps"const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getAudioSummary();
getBitrateSummary
Gets a bitrate summary string for the job.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.getBitrateSummary();
moveToTop
Moves this job's containing group to the top of the render queue so it encodes next, raising its priority.
Since: 27.0
Parameters
none
Returns
true on success (or if the job is already at the top); false if the job handle is no longer valid, or the job has no groupconst app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
job.moveToTop();
getGroup
Returns the RenderJobGroup that contains this job (its shared source). Use it to add more outputs to the same source via RenderJobGroup.addOutput.
Since: 27.0
Parameters
none
Returns
RenderJobGroup, or null if the job handle is no longer valid or it has no group.
const app = require("mediaencoder");
const job = app.RenderQueue.getJob(jobId);
const group = job.getGroup();