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.Available options for assets
You have two options when it come to using input files:
- Pass a URL as the input (simplest)
- Upload to our storage (do not require hosting files yourself)
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 these steps:
- Request upload URLs for your assets, you need to specificy the file extension and the type of the file.
- Upload the files to the provided URLs by sending a PUT request.
- Use the
file_path
value from the original upload url response in your API calls.
The following code samples provide a full example of how to upload a video file to Magic Hour storage.
Make sure to include Content-type: 'application/octet-stream'
header in the PUT
request.
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.