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
versionstringYesContract version, fixed to "v1"
video_sizearrayYesOutput canvas size [width, height] in pixels, e.g. [1920, 1080]
video_ratenumberYesOutput frame rate (fps, integer), e.g. 30
durationnumberNoautoTotal output duration (seconds); inferred from the timeline tail when omitted
materialsarrayYesMaterial list; each id is a platform file ID, see below
video_trackarrayYesVideo track list. This endpoint renders only 1 video track, see below and "Limitations"
audio_trackarrayYesAudio 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 default mute, overridable by clip-level muted
track_timelinearrayYesSequence of clips on the track, each a clip object

audio_track[] object

Audio tracks may be multiple and are mixed automatically. volume has two-level semantics (track and clip).

FieldTypeRequiredDescription
track_indexnumberYesExplicit layer (distinguishes multiple audio tracks)
volumenumberNoTrack-level default volume, overridable by clip-level volume; 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_stclip_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)
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 (seconds), must be > 0
mutedbooleanNo(video) clip-level mute, overrides track-level muted
volumenumberNo(audio) clip-level volume, overrides track-level volume

ℹ️ Two-level mute / volume semantics: video uses muted, audio uses volume, each with a track level and a clip level. Priority: clip level if present, otherwise track level, otherwise the default (muted defaults to false, volume to 1.0).

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]

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.