This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
Import images, videos, and audio files from S3, GCS, HTTP URLs, or local
paths into Pixeltable tables.
Problem
You have media files stored in cloud storage (S3, GCS) or accessible via
HTTP URLs. You need to process these files with AI models without
downloading them all upfront.
Solution
What’s in this recipe:
- Reference media files by URL (S3, HTTP, local paths)
- Automatic caching of remote files on access
- Process files lazily without bulk downloads
You insert media URLs as references. Pixeltable stores the URLs and
automatically downloads/caches files when you access them through
queries or computed columns.
Setup
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/pjlb/.pixeltable/pgdata
Created directory ‘cloud_demo’.
<pixeltable.catalog.dir.Dir at 0x10d31f710>
Load images from HTTP URLs
Reference images by URL—Pixeltable downloads them on demand:
Created table ‘images’.
Inserting rows into `images`: 3 rows [00:00, 767.91 rows/s]
Inserted 3 rows with 0 errors.
3 rows inserted, 6 values computed.
Load videos from S3
Reference videos in S3 buckets (using public Multimedia Commons bucket):
Created table ‘videos’.
Inserting rows into `videos`: 2 rows [00:00, 1477.13 rows/s]
Inserted 2 rows with 0 errors.
2 rows inserted, 4 values computed.
Process remote media with computed columns—files are fetched
automatically:
Added 3 column values with 0 errors.
Added 3 column values with 0 errors.
3 rows updated, 6 values computed.
When you store media in private cloud storage, you need presigned URLs
to serve files over HTTP. The presigned_url function converts storage
URIs to time-limited, publicly accessible URLs:
Added 2 column values with 0 errors.
2 rows updated, 4 values computed.
Use cases for presigned URLs:
- Serve private media in web applications without exposing credentials
- Generate download links for end users
- Integrate with CDNs or video players that require HTTP URLs
Provider limitations:
Note: HTTP/HTTPS URLs pass through unchanged (already publicly
accessible).
Pixeltable supports multiple URL schemes for media files:
*Configure AWS/GCP credentials via environment variables or config
files.
Explanation
How caching works:
- URLs are stored as references in the table
- Files are downloaded on first access (query or computed column)
- Downloaded files are cached in
~/.pixeltable/file_cache/
- Cache uses LRU eviction when space is needed
Benefits of URL-based storage:
- Lazy loading - Only download files when needed
- Deduplication - Same URL is cached once
- Incremental processing - Add files without bulk downloads
- Cloud-native - Works directly with object storage
For private S3 buckets:
Configure AWS credentials using standard methods:
- Environment variables (
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
- AWS credentials file (
~/.aws/credentials)
- IAM roles (when running on EC2/ECS)
See also