Input Files
Learn how to handle input files
Magic Hour’s API allows you to upload various types of assets needed for video generation. This guide explains how to manage these assets effectively.
Supported asset types
The follow file extensions are supported by our APIs:
Video
mp4, m4v, mov, webm
Audio
mp3, mpeg, wav, aac, aiff, flac
Image
png, jpg, jpeg, webp, avif, jp2, tiff, bmp
gif
extension is only supported by face swap API’s video_file_path
field.
Using assets
You have two options when it come to using input files:
- Pass a URL as the input
- Upload to our storage
Passing a file URL
This is the simplest method if you have the files hosted somewhere. When calling our APIs, you can simply pass the URL as the video_file_path
, image_file_path
, or audio_file_path
.
For Example
The URL can be an authenticated url, as long as we can validate the file extension is supported.
Upload to Magic Hour storage
To upload assets for video generation, you’ll need to follow a two-step process:
Get presigned upload URLs
First, request upload URLs for your assets.
If requesting multiple upload urls, the response array will be in the same order as the request body.
Upload files
After receiving the upload URLs, send a PUT request to each URL with your file data and the appropriate content type header.
Make sure to add Content-type: 'application/octet-stream'
header to the
request.
Using uploaded assets
After successfully uploading your assets, you can reference them in your video generation API calls using .items.[].file_path
value from the upload urls API call.
For example,
Uploaded file lifecycle
Uploaded files are automatically cleaned up after 7 days.
You can reference the value in .items.[].file_path
in multiple API calls
before the file is cleaned up.
If you have use cases where having more permanent storage is required, please reach out to our team at support@magichour.ai.
Was this page helpful?