---
title: "Cloudflare Stream - All-in-one Video Platform"
description: "All-in-one managed media pipeline for live and on-demand video. Upload, encode, and deliver video globally with simple, predictable pricing."
url: "https://www.cloudflare.com/products/stream"
---

# Stream

> Stream makes storing, encoding, and distributing video effortless — eliminating the need for complex infrastructure, multiple vendors, or opaque pricing models.

## Key Features

- Unified video API
- Automatic encoding
- RTMP/SRT ingest
- HLS/DASH output
- Built-in player
- Global delivery
- Predictable pricing

## Benefits

### Unified Media Pipeline

Upload, encode, package, and stream video from a single API — no stitching together services or vendors.

### Simple, Predictable Pricing

Avoid convoluted billing models with clear, cost-effective rates that scale with you.

### Built on Cloudflare's Network

Delivers video globally with lower bandwidth costs, faster access, and higher reliability.

## Use Cases

### E-learning and user-generated content

Perfect for educational platforms, journalism, worship services, and sports broadcasting with reliable delivery and flexible player options.

### AI-generated media workflows

Integrate with Stream or Media Transformations + R2 for AI-generated video content with automatic optimization and global delivery.

### Live streaming events

Broadcast live events with RTMP/SRT ingest and HLS/DASH output, reaching audiences worldwide with minimal latency.

### Multi-platform video distribution

Transform videos for different platforms with resizing, cropping, and repackaging — adapt content for social media, mobile, and web.

## Code Examples

### Upload and encode video

Upload videos and get playback URLs with automatic encoding and delivery.

```typescript
export default {
  async fetch(request, env, ctx): Promise<Response> {
    // Upload a video file
    const formData = new FormData();
    formData.append('file', videoFile);
    
    const uploadResponse = await fetch('https://api.cloudflare.com/client/v4/accounts/{account_id}/stream', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer ' + env.CLOUDFLARE_API_TOKEN,
      },
      body: formData,
    });
    
    const uploadResult = await uploadResponse.json();
    const videoId = uploadResult.result.uid;
    
    // Get video details
    const videoResponse = await fetch('https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/' + videoId, {
      headers: {
        'Authorization': 'Bearer ' + env.CLOUDFLARE_API_TOKEN,
      },
    });
    
    const videoData = await videoResponse.json();
    
    return new Response(JSON.stringify({
      videoId: videoId,
      playbackUrl: videoData.result.playback.hls,
      thumbnailUrl: videoData.result.thumbnail
    }));
  },
};
```

### Live Streaming with RTMP Ingest

Set up live streaming with RTMP ingest and automatic HLS/DASH output. This example shows how to create a live stream and get the playback URL for real-time broadcasting.

```typescript
export default {
  async fetch(request, env) {
    // Create a live stream
    const streamResponse = await fetch('https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/live_inputs', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer ' + env.CLOUDFLARE_API_TOKEN,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        meta: {
          name: 'Live Event Stream'
        },
        recording: {
          mode: 'automatic',
          requireSignedURLs: false
        }
      }),
    });
    
    const streamData = await streamResponse.json();
    const streamId = streamData.result.uid;
    
    // Get RTMP ingest URL
    const rtmpUrl = streamData.result.rtmps.ingestURL;
    
    // Get HLS playback URL
    const playbackUrl = 'https://customer-' + env.CUSTOMER_CODE + '.cloudflarestream.com/' + streamId + '/manifest/video.m3u8';
    
    return new Response(JSON.stringify({
      streamId: streamId,
      rtmpIngestUrl: rtmpUrl,
      hlsPlaybackUrl: playbackUrl
    }), {
      headers: { 'content-type': 'application/json' },
    });
  },
} satisfies ExportedHandler;
```

## Resources

- [Full Documentation](https://developers.cloudflare.com/stream): Complete technical documentation
- [Get Started](https://dash.cloudflare.com/sign-up): Sign up and start building
- [Pricing](/plans.md): See pricing details

## Related Products

- [Images](/products/images.md): Image optimization
- [RealtimeKit](/products/realtime.md): Live comms

---

*This is a markdown version of [https://www.cloudflare.com/products/stream](https://www.cloudflare.com/products/stream) for AI/LLM consumption.*
