AI video generation platforms like Sora, Runway, and custom pipelines produce content at scale. Trackyard provides instant music licensing as a single API call — no manual clearance bottleneck.
The Challenge
Traditional workflow:
- Generate 100 videos via AI
- Manually search for music for each video
- License each track separately
- Download and merge audio manually
Problem: The music licensing step becomes the slowest part of the pipeline.
The Trackyard Solution
Integrate /search → /download-track directly into your video generation pipeline:
# Generate video
video = sora.generate("A sunset over mountains")
# Get licensed music automatically
tracks = trackyard.search("cinematic ambient music for nature video")
audio = trackyard.download(tracks[0]["id"], duration_seconds=video.duration)
# Merge and export
final_video = merge(video, audio)
One workflow, end-to-end.
Integration Example
import requests
import subprocess
API_KEY = "your_api_key"
BASE = "https://api.trackyard.com/api/external/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
def add_music_to_video(video_path, query, output_path):
# 1. Get video duration
duration = get_video_duration(video_path) # via ffprobe
# 2. Search for music
search = requests.post(
f"{BASE}/search",
headers=HEADERS,
json={"query": query, "limit": 1}
).json()
track_id = search["tracks"][0]["id"]
# 3. Download music (trimmed to match video)
audio = requests.post(
f"{BASE}/download-track",
headers=HEADERS,
json={
"track_id": track_id,
"duration_seconds": duration
}
).content
# Save temp audio
with open("/tmp/music.mp3", "wb") as f:
f.write(audio)
# 4. Merge with ffmpeg
subprocess.run([
"ffmpeg", "-i", video_path, "-i", "/tmp/music.mp3",
"-c:v", "copy", "-shortest", output_path
])
# Usage
add_music_to_video(
"ai_generated.mp4",
"upbeat music for tech product demo",
"final_with_music.mp4"
)
Best Practices
Cache search results: If generating similar videos, search once and reuse the track across multiple outputs
Match music to video style: Include the video’s subject in your search query (“nature video”, “tech demo”, “fashion content”)
Use smart trimming: Let Trackyard handle clip selection instead of fading manually
Next Steps