Timeline Render

Renders a gtrk v1 timeline structure directly into a final video (a single mp4). It shares the same gtrk v1 contract with Project File Export: from the same timeline you can export editor projects for refinement, or render the final video in the cloud.

ℹ️ Note: Unlike project export, rendering must actually read the media, so each materials[].id must be a platform file ID (file_id) already uploaded to the platform; materials[].path (local path) is ignored by this endpoint. Every material referenced by a clip must be uploaded first.

Create Task

Basics

ItemValue
MethodPOST
Path/task/video_timeline_render
Content-Typeapplication/json
AuthAuthorization header (raw API Key)
Billingby input duration (total output duration, minutes)

Request Body

The body is a gtrk v1 timeline structure. All time fields are in seconds.

NameTypeRequiredDefaultDescription
versionstringYes—Contract version, fixed to "v1"
video_sizearrayYes—Output canvas size [width, height] in pixels, e.g. [1920, 1080]
video_ratenumberYes—Output frame rate (fps, integer), e.g. 30
durationnumberNoautoTotal output duration (seconds); inferred from the timeline tail when omitted
materialsarrayYes—Material list; each id is a platform file ID, see below
video_trackarrayYes—Video track list. This endpoint renders only 1 video track, see below and "Limitations"
audio_trackarrayYes—Audio track list (layered), 0–N tracks; multiple tracks are mixed, empty array [] = silent
beat_trackarrayNo[]HTML particle overlay layer. This endpoint ignores beat_track; to render particles use html_animate_render
struct_metaobjectNo{}Draft-output and other metadata; ignored by this endpoint. You can pass the same timeline used for project export as-is

materials[] entry

Each material is identified by a single id — in this endpoint id is the platform file ID (file_id), and the material must be uploaded first. Clips reference this id via the material field.

FieldTypeRequiredDescription
idstringYesMaterial identifier, i.e. the platform file ID (file_id), referenced by clips via material
pathstringNoLocal material path; ignored by this endpoint (used only by project export / offline ffmpeg)
durationnumberNoMaterial total duration (seconds)
video_sizearrayNoMaterial native size [width, height] (video materials)
video_ratenumberNoMaterial frame rate (video materials)
audio_channelstringNoChannel layout, "stereo" or "mono" (audio materials)

💡 Tip: Materials referenced by the video track must be video files; materials referenced by audio tracks may be audio or video files. materials[].path / duration / video_size / video_rate / audio_channel are only reference metadata at render time — you can pass the same timeline used for project export as-is.

video_track[] object

track_index is an explicit z-layer integer, and the lowest track_index is the base track (main). This endpoint renders only the main base track — any extra overlay video tracks are ignored (see "Limitations").

FieldTypeRequiredDescription
track_indexnumberYesExplicit layer; the lowest is the base track (main), i.e. the one actually rendered
track_sizearrayNoNative size [width, height] of this track's material, used to scale/fit to the canvas video_size
mutedbooleanNoTrack-level mute switch (a master switch; a clip-level muted: false cannot unmute it). This API does not render video-track audio, so muted on a video track has no effect here
track_timelinearrayYesSequence of clips on the track, each a clip object

audio_track[] object

Audio tracks may be multiple and are mixed automatically. muted / volume have two-level semantics (track and clip): a muted clip becomes silence for its duration (its source audio is not read and later clips do not shift); a track left with no audible clip because of muting is not mixed, but its end still counts toward the output duration; clips that are mixed play at their effective volume.

FieldTypeRequiredDescription
track_indexnumberYesExplicit layer (distinguishes multiple audio tracks)
mutedbooleanNoTrack-level mute switch (master switch): when true every clip on the track is muted and a clip-level muted: false cannot unmute it
volumenumberNoTrack-level default volume (linear gain), overridable by clip-level volume (not multiplied); defaults to 1.0
track_timelinearrayYesSequence of clips on the track, each a clip object

track_timeline[] clip object (video / audio)

Each non-gap clip carries both the source-trim timecodes (clip_st/clip_ed) and the on-track timecodes (track_st/track_ed/duration); the two sets are kept redundantly. This endpoint takes the segment clip_st–clip_ed from the source material and places it at track_st on the output.

FieldTypeRequiredDescription
clip_idstringYesClip identifier; empty string "" means a gap (black frames on video, silence on audio); a gap omits material / clip_st / clip_ed
materialstringYesReferences materials[].id (omitted for gaps)
clip_stnumberYesTrim-in inside the source material (seconds)
clip_ednumberYesTrim-out inside the source material (seconds); for retimed clips clip_st + duration × speed
track_stnumberYesIn-point on the output timeline (seconds); clips on the same track must not overlap
track_ednumberYesOut-point on the output timeline (seconds)
durationnumberYesClip duration on the output timeline (seconds), must be > 0
mutedbooleanNoClip-level mute: mutes this clip only and cannot unmute a muted track (takes effect on audio-track clips in this API)
volumenumberNoClip-level volume (linear gain), overrides the track-level volume, not multiplied; for compatibility with older client saves, 0 means original volume and negative values are read as dB (use muted to silence); takes effect on audio-track clips in this API
speednumberNoConstant playback speed, 0.01–100, default 1; the clip takes duration × speed seconds of source and occupies duration seconds of output. Audio is muted for clips faster than 5x
keep_pitchbooleanNoWhether to keep the original pitch when retimed, default false (pitch follows speed); no effect above 5x
audio_fade_innumberNoAudio fade-in length (seconds), ≥ 0, default 0; together with audio_fade_out it must not exceed duration (each compared in whole milliseconds; exceeding is rejected); not allowed on gaps
audio_fade_outnumberNoAudio fade-out length (seconds), ≥ 0, default 0; same constraint
transition_in / transition_out / transition_nextobjectNoTransitions, same fields and validation as Project Struct; this endpoint does not render transitions yet: those cuts stay hard cuts and output_result.warnings counts them as transition_not_carried

ℹ️ Audio fade in / out: audio-track clips fade in / out linearly per audio_fade_in / audio_fade_out, measured in output-timeline seconds (a retimed clip is retimed first, then faded; lengths are not scaled by speed). Every clip already gets a few-millisecond de-click fade at its cut points; the longer of the two wins, so a user fade shorter than the de-click fade is replaced by the de-click fade. Clips faster than 5x are already silent, so fades have no effect. This endpoint only outputs audio-track sound (video clips' original audio is not rendered); a fade on a video clip is carried only by its matching original-audio clip on an audio track (same asset, same trim, same position) when that audio clip has no fade of its own.

ℹ️ Two-layer mute / volume semantics: muted and volume exist at both the track level and the clip level on video and audio tracks alike; on a video clip they act on its original audio. Mute: the track-level muted is a master switch — a clip is muted if either the track or the clip has muted: true, so a clip-level muted: false cannot unmute a muted track. Volume: clip-level if present, otherwise track-level, otherwise 1.0 (override, not multiplied). A muted clip is silent; its volume, volume keyframes and fades have no effect. This API renders audio-track sound only: muted / volume on the video track have no effect here; an audio clip volume of 0 or below is read the older-client dB way (0 = original volume).

Request Example

The example below shows multiple clips from one source plus one audio track: materials declares one video source (F100) and one background track (F200); video_track cuts several segments from the same video source using different clip_st/clip_ed (with a black-frame gap in between); audio_track lays down one BGM.

curl -X POST https://api.ai-mcn.tv:10000/task/video_timeline_render \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "v1",
    "video_size": [1280, 720],
    "video_rate": 30,
    "duration": 22.47,
    "materials": [
      {
        "id": "F100",
        "duration": 120.0,
        "video_size": [1920, 1080],
        "video_rate": 30,
        "audio_channel": "stereo"
      },
      {
        "id": "F200",
        "duration": 180.0,
        "audio_channel": "stereo"
      }
    ],
    "video_track": [
      {
        "track_index": 0,
        "track_size": [1920, 1080],
        "muted": false,
        "track_timeline": [
          {
            "clip_id": "c1", "material": "F100",
            "clip_st": 18.50, "clip_ed": 28.05,
            "track_st": 0.0, "track_ed": 9.55, "duration": 9.55
          },
          {
            "clip_id": "",
            "track_st": 9.55, "track_ed": 10.55, "duration": 1.0
          },
          {
            "clip_id": "c2", "material": "F100",
            "clip_st": 33.70, "clip_ed": 45.62,
            "track_st": 10.55, "track_ed": 22.47, "duration": 11.92
          }
        ]
      }
    ],
    "audio_track": [
      {
        "track_index": 0,
        "volume": 0.8,
        "track_timeline": [
          {
            "clip_id": "a1", "material": "F200",
            "clip_st": 0.0, "clip_ed": 22.47,
            "track_st": 0.0, "track_ed": 22.47, "duration": 22.47
          }
        ]
      }
    ]
  }'

Success Response Example

{
  "code": 200,
  "msg": "success",
  "data": {
    "task_id": "537489015178400",
    "task_type": "video_timeline_render",
    "status": "queued"
  }
}

Query Task Result

Basics

ItemValue
MethodGET
Path/task/video_timeline_render/{task_id}
AuthAuthorization header (raw API Key)

Response (output_result)

The output is a single mp4 video.

NameTypeDescription
file_idstringOutput video file ID
download_urlstringDownload path
durationnumberOutput duration (seconds), equals total timeline duration
video_sizearrayOutput resolution [width, height]
warningsarrayPresent only when the request has transitions: [{"kind": "transition_not_carried", "format": "timeline_render", "count": N, "message": "..."}]

Success Response Example

{
  "code": 200,
  "msg": "success",
  "data": {
    "task_id": "537489015178400",
    "status": "completed",
    "progress": 100,
    "output_result": {
      "file_id": "537489015178401",
      "download_url": "/download/c1/537489015178401.mp4",
      "duration": 22.47,
      "video_size": [1280, 720]
    },
    "create_time": "2026-06-11T08:00:00Z",
    "update_time": "2026-06-11T08:00:25Z"
  }
}

Error Codes

CodeHTTP StatusDescriptionSolution
6013400Required parameter missing (version / video_size / video_rate / materials / video_track / audio_track)Provide required parameters
6016400Invalid structure (material not in the materials list, clip count over limit, duration ≤ 0, overlapping clips, etc.; details in response)Fix the timeline as indicated
6004404A file in materials[].id does not existCheck the file IDs and upload status
6014400Material type mismatch (e.g. non-video file on the video track)Check material types
6502401Authentication failedCheck the Authorization header
6201402Insufficient quotaPurchase a quota package or top up
6202402Insufficient balanceTop up via dashboard

Limitations

  • Single video track: this capability renders only 1 video track — the main base track (lowest track_index); any extra overlay video tracks are ignored. For multi-track compositing / picture-in-picture / particle animation, use Project File Export (export a project to your editor for refinement) or html_animate_render (particle compositing into a final video). Audio tracks may be multiple and are mixed automatically.
  • Particles ignored: beat_track is ignored by this endpoint; the body may carry it to keep the gtrk structure intact, but it does not affect the output. For HTML particles use html_animate_render.
  • Clip count limit: total clips across all tracks ≤ 500.
  • Always re-encoded: cut points rarely fall on keyframes, so output is re-encoded (h264 + aac); rendering time scales with output duration — poll every 5–10 seconds.
  • Automatic media normalization: materials with different resolutions / frame rates are scaled, letterboxed to video_size and frame-rate normalized; heterogeneous materials can be mixed freely.
  • Billed by input duration: charged by total timeline duration (= output duration, minutes), independent of source material length.
  • Complements project export: the same gtrk v1 timeline (with materials[].id as platform file IDs) can be sent to both endpoints — refine in your editor, or render in the cloud.