Basic transcode
Task
The transcode
Task allows you to specify the type(s) of transcode that you would like to perform in a job. A single transcode
Task can specify more than one output Target. For example, a single transcode
Task can create all 10 layers of an HLS package in a single task. All of the transcode targets will be processed at the same time, meaning there will be one decode pipeline feeding all of the outputs. Therefore if you have 10 output targets, the fastest and the slowest will both complete at the same time since they are being fed by the same decode pipeline. Alternatively, you may use the split_task
option to instruct Hybrik to divide a transcode
Task into separate tasks to be distributed to multiple machines.
A very basic transcode
Task example is shown below. In a case such as this, when hardly any parameters are given for the transcode, Hybrik will apply some default values in order to produce an output.
Anatomy of a transcode
Task
{
"uid": "transcode_task",
"kind": "transcode",
"payload": {
"location": {
"storage_provider": "s3",
"path": "{{destination_path}}"
},
"targets": [
{
"file_pattern": "output.mov",
"container": {
"kind": "mov"
},
"video": {
"codec": "h264",
"width": 720
},
"audio": [
{
"codec": "aac"
}
]
}
]
}
}
Within the payload
of the transcode
task, you will find the options to define your job’s output. Let’s look at the most basic parameters you might expect to see.
Location
The location
object is common in Hybrik tasks. In this case, we specify the destination location directory to write our files to.
Targets Array
The targets
array is the key area of the transcode_task
for defining the components and properties of the output(s) you want to produce. Each object in this array will produce an output file. You can choose to have just one target, or many. Within each target object, there are some required elements (such as file_pattern
for the output file name, and container
to specify how to multiplex your file), as well as other elements that could be included depending on the type of output you want.
Container
The container is the method used to “wrap” the video and/or audio components in a file. Typical containers used are: mp4
, mov
, mpegts
, mxf
. The one container type that actually produces an output that is not in a container is elementary
. Certain file formats can be produced as elementary streams, which would usually be packaged or multiplexed downstream in another process.
The full list of available container types is here.
Video
The video object defines the codec, frame dimensions (height
, width
), frame_rate
, etc. for a video component. There can be only one video object per target. This is also where settings are applied for inclusion of closed captions or video filters in your output file.
The full list of video properties is on our API page.
Audio
Audio tracks are defined in an array, since a single output can have multiple audio tracks. Each object in the array represents an audio track, and can be considered independent from any other audio tracks in the same array. For example, you may have two audio tracks in your output; the first could use ac3
as the codec, and the second could use aac
. As long as the container type allows the configuration, this would be a valid setup.
The full list of audio properties is on our API page.
Timecode
Your output file can also include a timecode track. Since certain file formats allow multiple timecode tracks, they are added to a target by means of an array.
The full list of timecode properties is on our API page.
search: transcode.targets.timecode
Subtitles
In cases when you want to output a subtitle file from a transcode_task
, as long as your source is or includes a subtitle or closed caption element, a subtitle file output target can be produced. A common use case is when your goal is to produce a full set of HLS media including webvtt subtitles. For this, you would need to define your source audio/video media along with one of the subtitle or closed caption source types that Hybrik accepts. The transcode
Task will produce all of the media components, which would be packaged for HLS in a follow-on package
task.
The full list of subtitle properties is on our API page.
search: transcode.targets.subtitle
A more complex transcode
Task Example
The following example is a typical transcode
Task including a commonly used set of objects. Links to the tutorials for some of these objects can be found below, following the code example. The target here is designed to produce a standard XDCAM output from a 23.976fps source.
{
"uid": "transcode_task",
"kind": "transcode",
"task": {
"tags": [
"high_performance"
],
"name": "taskname",
"retry_method": "retry",
"retry": {
"count": 2,
"delay_sec": 10
}
},
"payload": {
"targets": [
{
"uid": "xdcam",
"location": {
"storage_provider": "s3",
"path": "{{destination_path}}"
},
"file_pattern": "{{output_file}}{default_extension}",
"existing_files": "replace",
"compliance": "xdcam_hd_422",
"container": {
"kind": "mxf"
},
"video": {
"width": 1920,
"height": 1080,
"interlace_mode": "tff",
"frame_rate": 29.97,
"closed_captions": {
"enable_cea608": true,
"enable_cea708": true,
"enable_smpte436m": true,
"enable_a53": true
},
"filters": [
{
"kind": "telecine",
"payload": {
"interlace_mode": "tff",
"pattern": "23"
}
}
]
},
"audio": [
{
"codec": "pcm",
"channels": 1,
"sample_size": 24,
"sample_rate": 48000,
"language": "eng",
"track_name": "5.1 - L",
"channel_designators": [
"left"
]
},
{
"codec": "pcm",
"channels": 1,
"sample_size": 24,
"sample_rate": 48000,
"language": "eng",
"track_name": "5.1 - R",
"channel_designators": [
"right"
]
},
{
"codec": "pcm",
"channels": 1,
"sample_size": 24,
"sample_rate": 48000,
"language": "eng",
"track_name": "5.1 - C",
"channel_designators": [
"center"
]
},
{
"codec": "pcm",
"channels": 1,
"sample_size": 24,
"sample_rate": 48000,
"language": "eng",
"track_name": "5.1 - LFE",
"channel_designators": [
"lfe_screen"
]
},
{
"codec": "pcm",
"channels": 1,
"sample_size": 24,
"sample_rate": 48000,
"language": "eng",
"track_name": "5.1 - Ls",
"channel_designators": [
"left_surround"
]
},
{
"codec": "pcm",
"channels": 1,
"sample_size": 24,
"sample_rate": 48000,
"language": "eng",
"track_name": "5.1 - Rs",
"channel_designators": [
"right_surround"
]
}
],
"timecode": [
{
"source": "start_value",
"force_drop": true,
"start_value": "01:00:00;00"
}
]
}
]
}
}
The code snippet for the transcode
Task above can be found in theExamples section.
Other Related Tutorials
Tutorials for some of the objects featured in the example transcode
Task above can be accessed below:
Examples
And to see more jobs with other examples of various transcode
Task targets, there are numerous sample jobs available here.
- A full job file with a simple transcode task
- A full job with multiple transcode targets and packaging, including subtitles
- A full job of the transcode task used in the XDCAM example above