Skip to main content

Overview

This guide covers the complete workflow for uploading media, monitoring processing, adding chapters, and managing media assets.
Important for YouTube/Vimeo Users: Even if you’re hosting videos on YouTube or Vimeo for playback, you must still upload the original video file to Haystack. This allows Haystack to provide AI-powered features like transcription, semantic search, and chapter generation. Your embedded player will continue using YouTube/Vimeo, while Haystack provides the search and discovery layer.

Prerequisites

  • An item created (see Managing Content)
  • Media file or URL ready to upload
  • API token for authentication

Upload Process

Uploading media to Haystack is a two-step process:

Step 1: Create Media Asset

First, create a media asset record and receive an upload URL:
External URLs for playback only: If you provide a YouTube or Vimeo URL, it will be used for embedded playback in your application. However, you must still upload the original video file in Step 2 for AI processing.

Step 2: Upload File

Use the returned uploadUrl to upload your video or audio file:
File size limit: Maximum file size is 5GB. There is no way to upload files larger than 5GB.
Supported formats:
  • Video: MP4, MOV, AVI, MKV, WebM
  • Audio: MP3, WAV, AAC, M4A, FLAC

Complete Upload Function

Here’s a complete helper function that handles both steps:

Monitoring Processing Status

Polling Method

Check processing status periodically:
Avoid polling too frequently. Check every 30-60 seconds to avoid rate limits.
For the best user experience with bulk uploads, implement a background job that polls the API every 30-60 seconds to check status updates.

Adding Chapters

Automatic Chapter Detection

Request automatic chapter generation during processing:

Manual Chapters

Create custom chapters with precise control:
Chapter best practices:
  • Use 5-15 minute segments
  • Start each chapter at a natural transition
  • Use descriptive, clear titles
  • Order chapters chronologically (handled automatically by sortOrder)

Managing Thumbnails

Thumbnail availability depends on which video player you’re using.

For Haystack Custom Player

When using the Haystack custom player, thumbnails are automatically generated via Mux. Access them via the Mux image API:
Extract thumbnails from key moments:

For YouTube/Vimeo Players

Mux-generated thumbnails are not available when using YouTube or Vimeo for playback. Use the artwork files you uploaded to your items instead.
When using YouTube or Vimeo players, retrieve thumbnails from your item’s artwork:

Playback Integration

HLS Streaming

Use the HLS playback URL with any HLS-compatible player:

HLS.js Example

Multiple Media Assets

Items can have multiple media assets (e.g., audio and video versions):

Updating Media

Replace Media

To replace media, delete the old asset and upload a new one:
Deleting media is permanent and cannot be undone. Ensure you have backups if needed.

Complete Upload Workflow

Here’s a complete example combining all steps:

Troubleshooting

Common Issues

Causes:
  • File too large (>5GB for direct upload)
  • Poor internet connection
  • Unsupported codec
Solutions:
  • Use external URL method for large files
  • Compress video before upload
  • Ensure video uses H.264 codec
Causes:
  • Corrupt video file
  • Invalid URL
  • Unsupported format
Solutions:
  • Test playback locally before upload
  • Ensure URL is publicly accessible
  • Convert to MP4 with H.264/AAC
Causes:
  • Low audio quality
  • Background noise
  • Multiple overlapping speakers
Solutions:
  • Use high-quality audio recording
  • Remove background noise in post-production
  • Ensure clear, single speaker audio
Causes:
  • Very long videos (>2 hours)
  • 4K resolution
  • High platform load
Solutions:
  • Expect 1-2x realtime processing
  • Poll every 30-60 seconds to check status
  • Consider splitting very large files into segments

Best Practices

Optimize Before Upload

Compress videos to reasonable bitrates (5-10 Mbps for 1080p) to save storage and bandwidth

Poll Responsibly

Check processing status every 30-60 seconds to avoid rate limits

Add Chapters

Break long content into chapters for better user experience and engagement

Test Playback

Verify video plays correctly before uploading to catch issues early

Next Steps

Media Management Concepts

Deep dive into media processing pipeline