Music Visualizer

Compose an audio track and a visualizer template into a finished music‑visualizer video. The system analyzes the audio and drives a frame‑accurate spectrum animation, overlaying the track title, artist, playback progress and time. The background can be an image/video you upload, or a built‑in vibrant gradient when none is provided. Great for music releases, song short‑videos, stream/video intros and animated playlist covers.

  • Endpoint: POST /task/music_visualizer
  • Task type: music_visualizer
  • Billing: by audio duration (per minute)

Request Parameters

ParamTypeRequiredDefaultDescription
file_idstringYes-Audio file ID (the primary input; billed by its duration). See File Upload
template_idstringYes-Visualizer template. See the Template List below
background_file_idstringNonullBackground file ID (image or video). Falls back to a built‑in vibrant gradient when omitted
cover_file_idstringNonullCover image file ID (shown by some templates, e.g. ring, vinyl, card)
trackstringNo""Track title (rendered on screen)
artiststringNo""Artist name (rendered on screen)
resolutionobjectNo{ "width": 1920, "height": 1080 }Output resolution; positive integer width / height
fpsintegerNo30Output frame rate, 3060
c1stringNo#ffffffSpectrum primary color (hex). Default white
c2stringNonullSpectrum secondary color (hex). When set, the spectrum becomes a c1c2 gradient
blurintegerNo16Background blur (px), 040; 0 disables blur

Template List

All visualizer templates are listed below. Click a preview to enlarge it.

TemplateStylePreview
auroraCentered title + full-width thin bars (versatile)
nowplayingCorner now-playing card + cover thumbnail + full-width thin bars
ringCircular spectrum + center cover disc + elapsed/remaining time + progress arc
ridgeBottom symmetric glowing waveform ridge
barsClassic rounded bars + reflection
pulsarPulsar radial spectrum + beat shockwave rings + center time
lissajousLissajous XY oscilloscope curve
vinylVinyl record (cover embedded in the slowly spinning disc) + rim spectrum
shockwaveBackground scales with the music and splits color on beats

Request Example

curl -X POST "https://cloud.ai-mcn.tv/task/music_visualizer" \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_id": "537489015178246",
    "template_id": "aurora",
    "cover_file_id": "537489015178200",
    "track": "Journey",
    "artist": "Isekai Mood",
    "fps": 30,
    "c1": "#15c6c6",
    "c2": "#ff8a3d"
  }'

Response Example

{
  "code": 0,
  "message": "success",
  "data": {
    "task_id": "537489015178247"
  }
}

Tasks are processed asynchronously; poll the result via the task status endpoint.

Retrieving the Result

When the task completes, fetch the result via the task query endpoint:

{
  "code": 0,
  "message": "success",
  "data": {
    "task_id": "537489015178247",
    "status": "completed",
    "progress": 100,
    "output_result": {
      "file_id": "537489015178248",
      "download_url": "https://cdn.example.com/files/....mp4",
      "duration": 235.4,
      "video_size": { "width": 1920, "height": 1080 },
      "template_id": "aurora"
    }
  }
}

Field Reference

FieldTypeDescription
file_idstringOutput video file ID
download_urlstringDownload URL of the output
durationnumberOutput duration (seconds)
video_sizeobjectOutput resolution { width, height }
template_idstringTemplate used

Billing

  • Billed by audio duration in minutes; any partial minute counts as one minute
  • No charge on failure; pre‑deducted credits are refunded automatically
  • Using a cover, background, or two‑color gradient does not incur extra charges
  • See Pricing for details

Limitations

  • file_id must be an audio file (mp3, wav, m4a, aac, flac, ogg, etc.).
  • template_id must be one of the values in the Template List.
  • background_file_id may be an image or a video; cover_file_id supports images only. A built‑in gradient is used when no background is provided.
  • fps ranges 3060; resolution must use positive integer width/height.
  • The spectrum is white by default; customize via c1 (single color) or c1+c2 (gradient).

Error Codes

CodeHTTPDescriptionResolution
6013400file_id or template_id missingProvide the required parameters
6001400Unsupported file typefile_id must be audio; cover_file_id an image; background_file_id an image or video
6016400Invalid business params (unknown template_id, fps out of range, bad color/resolution)Fix per the parameter reference
6017400Media probe failedEnsure the audio file is valid and not corrupted
6004404File not foundVerify file_id / background_file_id / cover_file_id
6502401Authentication failedCheck the Authorization header
6202402Insufficient balanceTop up in the dashboard