Skip to main content

GCS Upload

PyPI version Docker Version License: Apache 2.0

A specialized OpenFilter component that uploads video segments and images to Google Cloud Storage buckets. Supports segmented video outputs, image uploads from upstream filters, optional manifest generation, and comprehensive configuration validation.

Features

  • Google Cloud Storage Output: Uploads video segments to gs:// destinations with wildcards and segment intervals
  • Image Upload Support: Monitors directories for images from upstream filters and uploads them to GCS
  • Manifest Generation: Creates JSON manifests listing all uploaded files with nested field support
  • Configuration Validation: Prevents typos with helpful error messages and suggestions
  • Concurrent Uploading: Background threads handle uploads with file locking for images
  • Flexible Templates: Manifest templates from file://, gs://, or cached sources

Quick Start

Prerequisites

IMPORTANT! You need access to GCP and the gcloud CLI installed and authenticated:

# Authenticate with Google Cloud
gcloud auth login
gcloud auth application-default login

# Set your project (replace with your project ID)
gcloud config set project your-project-id
gcloud auth configure-docker us-west1-docker.pkg.dev

Installation

# Create virtual environment
virtualenv venv
source venv/bin/activate

# Install the filter
make install

Basic Usage

from openfilter import Filter

# Simple video recording pipeline
filters = [
    Filter("VideoIn", {
        "sources": "file://sample_video.mp4",
        "outputs": "tcp://127.0.0.1:5550"
    }),
    Filter("FilterConnectorGCS", {
        "sources": "tcp://127.0.0.1:5550",
        "outputs": "gs://my-bucket/videos/video_%Y-%m-%d_%H-%M-%S.mp4!segtime=0.5",
        "workdir": "./temp_videos",
        "timeout": 60.0
    }),
    Filter("Webvis", {
        "sources": "tcp://127.0.0.1:5550",
        "outputs": "tcp://127.0.0.1:8080"
    })
]

Filter.run_multi(filters, exit_time=30.0)

Documentation

For comprehensive documentation including:

  • Complete configuration reference
  • Sample pipelines and use cases
  • Troubleshooting guides
  • API documentation

Refer to docs/overview.md

Development

Running Locally

# Run the filter locally
make run

# Navigate to http://localhost:8000 to see the video

Running in Docker

# Build the filter docker image
make build-image

# Generate docker-compose.yaml (if needed)
make compose

# Run the containerized filter
make run-image

Note: If your filter uses GPU, ensure the deploy: section in docker-compose.yaml includes GPU configuration:

deploy:
  resources:
    reservations:
      devices:
        - driver: nvidia
          count: all
          capabilities: [gpu]

Testing

# Run unit tests
make test

# Run specific test files
pytest tests/test_vid2gs.py -v
pytest tests/test_smoke_simple.py -v
pytest tests/test_integration_config_normalization.py -v

Configuration Examples

Basic Video Upload

{
    "id": "gcs_uploader",
    "sources": "tcp://127.0.0.1:5550",
    "outputs": "gs://my-bucket/videos/video_%Y-%m-%d_%H-%M-%S.mp4!segtime=0.5",
    "workdir": "./temp_videos",
    "timeout": 60.0
}

With Image Upload and Manifest

{
    "id": "gcs_uploader",
    "sources": "tcp://127.0.0.1:5550",
    "outputs": "gs://my-bucket/videos/stream_%Y-%m-%d_%H-%M-%S.mp4!segtime=1.0",
    "image_directory": "./unique_frames",
    "manifest": "file://manifest_template.json",
    "manifest_field": "stream_data.files",
    "workdir": "./temp_processing",
    "timeout": 120.0
}

Multiple Outputs

{
    "id": "multi_gcs_uploader",
    "sources": "tcp://127.0.0.1:5550",
    "outputs": [
        "gs://primary-bucket/videos/feed_%Y-%m-%d_%H-%M-%S.mp4!segtime=0.2",
        "gs://backup-bucket/archive/feed_%Y-%m-%d_%H-%M-%S.mp4!segtime=2.0"
    ],
    "manifest": "gs://primary-bucket/templates/manifest.json",
    "manifest_field": "recordings.files",
    "workdir": "./temp",
    "timeout": 180.0
}

Environment Variables

Variable Required Description
GOOGLE_APPLICATION_CREDENTIALS Yes Path to GCP service account key JSON file

Use Cases

  • Security Camera Monitoring: 24/7 recording with automatic cloud backup
  • Content Creation: Multi-destination uploads with thumbnail extraction
  • IoT Data Collection: Device-specific data collection with structured metadata
  • Live Streaming Archive: Real-time streaming with dual outputs

See docs/overview.md for detailed use case examples and sample pipelines.

Publishing

To publish a new version:

  1. Update Version: Ensure VERSION file has a production semver tag (e.g., v2.0.0)
  2. Update Release Notes: Add new entry to RELEASE.md with changes
  3. Merge to Main: CI will automatically:
    • Build and publish Docker image to GAR OCI registry
    • Build and publish Python wheel to GAR Python registry
    • Push docs to production and development documentation sites

Important: Releases are documentation-driven. Not updating RELEASE.md will not trigger a release.

Metadata

Release files for filter-connector-gcs 2.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for filter-connector-gcs 2.0.11
File Interpreter ABI Platform Actions
filter_connector_gcs-2.0.11-py3-none-any.whl Python 3 none any Details for filter_connector_gcs-2.0.11-py3-none-any.whl

Release files / filter_connector_gcs-2.0.11-py3-none-any.whl

Download URL filter_connector_gcs-2.0.11-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30053dde19613cc32fb986fb88d7bd61c722bc5cbdf00c01bdc7f80cd9ac0660
BLAKE2b-256 checksum
How to use checksums
ac76b45a26ba808e0812cd293f9e54bd06a19e1699cade0d5f112abb2702149f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for filter-connector-gcs 2.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page