Upload videos from URL
This guide explains how the FastPix API uses a pull-based process to upload and create a new video or audio media from a publicly accessible URL. Once the media is uploaded, FastPix processes the file and stores it on the platform, making it available for use in playback, further processing, or editing.
Overview
You can use the pull-based upload
feature to retrieve and use public URLs from popular cloud file hosting services for uploading media. This method is especially useful for large files that may have been edited or processed by external teams outside of your organization. Instead of downloading large files to your local system, you can provide a direct URL, and FastPix will then pull the file from its location and begin processing it. After successful processing, the media becomes available for streaming and other operations within the FastPix platform.
PLEASE NOTE
It's important to note that all cares, the URL to the file must be publicly accessible, or the upload will
While this approach can be the simplest to implement when you have the required information, it depends on the media being readily accessible. If this works for your application’s workflow, it’s a practical option. However, for many applications, using methods like a standard POST request might be more suitable for direct uploads.
Public URL requirements
Key points for consideration:
- Public accessibility: The URL you provide must be publicly accessible without any form of authentication or permission barriers (e.g., no login, no private links). This is crucial as FastPix fetches the media directly from the URL.
If the video stored on a content delivery network (CDN), make sure that the URL is unsigned and public, or possibly pre-signed if security is a concern for you. - Supported formats: Ensure that the media file is in a supported format. FastPix supports a wide range of video formats, which includes the following:
.m4v, .ogv, .mpeg, .mov, .3gp, .f4v, .rm, .ts, .wtv, .avi, .mp4, .wmv, .swf, .webm, .mts, .vob, .mx
If the media format is not supported, the processing will fail, and an error response will be returned via the API or webhooks.
Example:
Let’s assume you have a video hosted on an Amazon S3 bucket with a public access URL. You can provide this URL to FastPix, and the system will pull the video, process it, and store it for playback on your platform.
Supported storage types
FastPix allows you to pull media files from several cloud storage solutions or Content Delivery Networks (CDNs). These can include URLs originating from the following:
- Amazon S3: Direct URLs from an S3 bucket. Ensure the object permissions are set to public for FastPix to access the file.
- Google Cloud Storage: Links from Google Cloud Storage are supported as long as the files are made publicly accessible.
- Azure Blob Storage: Media files hosted on Microsoft Azure Blob Storage can be retrieved if the correct public access permissions are enabled.
- Public CDNs: Any media file hosted on a public CDN (such as Akamai, Cloudflare, or Fastly) can be fetched by FastPix.
TIP
When using cloud services like S3 or Azure, make sure you configure the access control settings properly to avoid issues with files accessibility
Using Google Drive link to upload
To upload a video from Google Drive to FastPix, follow these steps to get the correct URL:
- Login to your Google Drive account.
- Find the video file you want to upload and right-click on it.
- Select Get Shareable Link from the menu.
-
- Click Copy Link, but note that this link is not a direct link to the video file. To generate a usable direct link, proceed to the next step.
- Visit a site like Google Drive Direct Link Generator, which can convert Google Drive sharing links into direct download links. Other similar tools are also available.
- Enter your shareable link into the provided field on the tool's page and click Create Direct Link to generate the correct URL for FastPix
The generated link in the Output Link field is the one you should use in the FastPix Upload module to upload the video.
PLEASE NOTE
You cannot use YouTube URLs for this purpose, as direct video file links are not provided by YouTube
Using Dropbox link to upload
To upload a video from Dropbox to FastPix, follow these steps to generate the correct URL:
- Log in to your Dropbox account.
- Locate the video file you wish to upload and right-click on it.
- Select Share from the options.
- In the sharing settings, click Create Link if a shareable link hasn’t already been created.
- Once the link is generated, click Copy Link. However, the default Dropbox link will not work directly with FastPix, as it links to a preview page and not the actual file.
- Modify the Dropbox link: To convert the link into a direct download link, change the end of the URL from dl=0 to dl=1. This will ensure FastPix can directly access the file for processing.
For example, if your link looks like this
https://www.dropbox.com/s/abc1234/yourfile.mp4?dl=0
change it to:
https://www.dropbox.com/s/abc1234/yourfile.mp4?dl=1
- Use the modified URL in the FastPix Upload module to upload your video from Dropbox.
PLEASE NOTE
Ensure the file permissions are set to public or shared appropriately. If the files is restricted or private, the upload may fail, as FastPix needs public access to retrieve the file.
How upload from URL works
The understand the process of uploading a video via a URL to FastPix follows these steps:
- Send a POST request: Submit a POST request to the /on-demand FastPix API endpoint with the media URL, optional metadata, and additional settings.
Below is an example API request for uploading a video via URL to FastPix. It includes optional media settings like adding watermarks, subtitles, and more:
curl -X POST 'https://v1.fastpix.io/on-demand' \ --user {Access Token ID}:{Secret Key} \ -H 'Content-Type: application/json' \ -d '{ "inputs": [ { "type": "video", "url": "https://static.fastpix.io/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4", "startTime": 0, "endTime": 60 }, { "type": "watermark", "url": "https://static.fastpix.io/watermark-4k.png", "placement": { "xAlign": "left", "xMargin": "10%", "yAlign": "top", "yMargin": "10%" } } ], "metadata": { "key1": "value1" }, "createSubtitles": { "name": "name", "metadata": { "key1": "value1" }, "languageCode": "en-us" }, "accessPolicy": "public", "mp4Support": "capped_4k", "optimizeAudio": true, "maxResolution": "1080p" }'
- FastPix fetches the media: FastPix retrieves the media file from the provided URL and begins processing it. This involves transcoding, optimizing, and preparing the media for playback.
- Receive a response: After the media is successfully uploaded, FastPix sends a response containing a unique media ID. This ID will be essential for tracking the media, checking its status, and initiating playback. Here’s a sample response:
{ "success": true, "data": [ { "id": "iyuU4HFxhJg1vMHM2uztnJut1hIJBuNBSzJionwUV7c", "trial": true, "status": "created", "createdAt": "2023-10-20T10:50:34.594302Z", "updatedAt": "2023-10-20T10:50:34.594302Z", "playbackIds": [ { "id": "6ta85f64-5717-4562-b3fc-2c963f66afa6", "accessPolicy": "public" } ], "metadata": { "key1": "value1" }, "mp4Support": "capped_4k", "maxResolution": "1080p" } ] }
{ "success": false, "error": { "code": 400, "message": "Upgrade to remove all restrictions video deletion after 24 hours" } }
{ "success": false, "error": { "code": 401, "message": "Unauthorized" } }
{ "success": false, "error": { "code": 403, "message": "forbidden" } }
{ "success": false, "error": { "code": 422, "message": "payload validation failed", "fields": [ { "field": "fieldName", "message": "must not be null" } ] } }
- Track media processing via webhooks: FastPix sends webhook events to your application during the upload and processing lifecycle (e.g., video.media.created, video.media.ready). These webhooks provide real-time updates on the media’s processing status.
Example workflow:
Suppose a user submits a URL that points to a video hosted on Google Cloud Storage. After sending the POST request, FastPix will download the video, process it, and store it in its own infrastructure. The user will receive a media ID that can be used to check the processing status and playback availability.
Webhook notifications
FastPix provides real-time feedback on the media's upload and processing lifecycle through webhook events. These events allow your application to respond asynchronously, triggering actions when media status changes occur.
Key webhook events:
- video.media.created: This event is fired when the media file is successfully created on FastPix. Your application can use this to confirm the initial upload was successful.
- video.media.ready: Once FastPix completes processing the media, this event notifies your application that the media is ready for playback.
- video.media.failed: If there is an issue with the media processing (e.g., unsupported file format, inaccessible URL), this event will notify your system of the failure, allowing for troubleshooting.
By leveraging these webhooks, you can build robust systems that monitor the media’s progress and update users accordingly. For example, you can notify users when their media is ready for viewing or alert them if something goes wrong
Best practices and recommendations
Error handling
: Always have error-handling mechanisms in place for cases when FastPix is unable to process the media. Use thevideo.media.failed
webhook event to trigger notifications or retry logic.URL accessibility
: Ensure the media URL is fully accessible to FastPix. If a file is behind a firewall or requires special authentication, the upload process will fail.Metadata use
: Leverage metadata to track and manage media more efficiently. Metadata allows you to attach key-value pairs that can be referenced in future API calls.Webhook integration
: Set up webhook listeners to efficiently manage the media lifecycle. This will help you provide real-time feedback to your users about their media’s status.Supported formats
: Before uploading, verify that the media file format is supported by FastPix. Unsupported formats will lead to failures during the processing stage.
Updated 16 days ago