Qencode + Cloudflare R2

Encode and store video on Cloudflare R2 with zero egress fees.

Overview

What This Integration Does

Qencode integrates with Cloudflare R2 as both a source and destination for video transcoding jobs. R2 provides an S3-compatible API with a standout feature: zero egress fees. Pull source video from any R2 bucket, transcode it, and write the output back automatically. Combined with Cloudflare’s global edge network and Workers for custom logic, R2 eliminates the unpredictable egress costs that make video delivery expensive on other platforms.

Architecture

How the Integration Works

Source

R2 bucket or URL

Qencode pulls your source video from an R2 bucket (or any URL).

Process

Transcode & package

Qencode transcodes, encrypts, and packages the video per your job configuration.

Deliver

Destination bucket

Encoded files are written directly to your destination R2 bucket.

Serve

Via Cloudflare edge

Serve via Cloudflare's edge network with a custom domain, or use Workers for access control.

Getting Started

Setup Steps

  1. Create your R2 bucket

    In the Cloudflare dashboard, navigate to R2 and create a new bucket. Connect a custom domain or use the R2.dev subdomain for public access.

    This step is completed in the Cloudflare dashboard — see R2 documentation

  2. Generate R2 API tokens

    In the Cloudflare dashboard, go to R2 → Manage R2 API Tokens and create an API token with Object Read & Write permissions scoped to your bucket. Note the Access Key ID and Secret Access Key.

    Store your API token as an environment variable. Never commit credentials to source control.

  3. Add credentials to Qencode

    In Transcode Media, go to Third-Party Storage, then choose Generic S3. Enter your Bucket Name, Endpoint, Access Key ID, and Secret Access Key.

  4. Set destination in your transcode job

    In your API request, set the destination parameter to your R2 bucket URL with the desired output path. Use the S3-compatible endpoint format.

  5. Verify the output

    After the job completes, check your R2 bucket for the encoded files. Qencode sends a webhook notification when writing is complete.

Implementation

Code Example

Request Example

MP4 output to Cloudflare R2

{
  "query": {
    "source": "https://[account_id].r2.cloudflarestorage.com/my-source-bucket/folder/input.mov",
    "format": [
      {
        "output": "mp4",
        "destination": {
          "url": "s3://[account_id].r2.cloudflarestorage.com/my-bucket/folder/output.mp4",
          "key": "YOUR_ACCOUNT_KEY",
          "secret": "YOUR_ACCOUNT_SECRET"
        }
      }
    ]
  }
}

Replace placeholder credentials with your actual R2 Access Key ID and Secret Access Key. Use environment variables in production.

For a step-by-step walkthrough, see Tutorial: Cloudflare R2 Integration

Pricing

Cost Context

Storage costs at Cloudflare

  • R2 runs approximately $0.015/GB/month with zero egress fees — no charge for data read from your bucket.
  • The first 10 GB of storage are free, along with 10 million Class A operations and 1 million Class B operations per month.
See Cloudflare R2 pricingfor current rates.

Estimated total cost per hour of 1080p video

Qencode transcoding (HLS, H.264)

~$1.80


R2 Storage (1 GB encoded output)

~$0.015/mo


Cloudflare delivery (100 viewers × 1 GB)

$0.00 (zero egress)

Estimates based on standard configurations. Actual costs vary with codec, resolution, and encoding features. See Qencode pricing
Explore More

Related Integrations & Features

We love creating powerful solutions that are aligned with the needs of your business.

Please send us a message if you have a question or Schedule a call for a demo to discuss your integration.

Let's talk

First Name
Last Name
Company
Email
Your Message

Contact us with any questions. We'd love to help.

Los Angeles, CA - (HQ)

San Francisco, CA

New York, NY