# Generate Cloudflare Auth

# Generate Cloudflare Auth for VDO.Ninja

Cloudflare Account ID:
Cloudflare Stream Access Token:
Hours until expiration
Generated URL parameter to add to VDO.Ninja:

## What you can do with Cloudflare + VDO.Ninja?

### Meshcast-alternative

Instead of using Meshcast to broadcast video from director to guest, or guest to scene, you can use Cloudflare instead.

Meshcast, or any compatible WHIP/WHEP service, can help reduce CPU and network load of guests by offloading distribution to a server, compared to using the peer-to-peer default of VDO.Ninja

VDO.Ninja has built-in support for Cloudflare's WHIP/WHEP, so setup and use is relatively easy.

### Isolated guest recording remotely via WHEP

You can record the streams of each guest via WHEP remotely, without transcoding and without additional load on the guests.

This offers a redundant backup for your recordings, but also makes it easier to do higher quality VODs edits after the live ends.

Raspberry.Ninja offers WHEP recording, via GStreamer for example, but FFMpeg builds may also support direct WHEP recording

### Pricing

Cloudflare has decent pricing, however it's a bit obsecure at times what the limits actually are.

### MediaMTX

If you prefer rolling your own SFU service, VDO.Ninja supports MediaMTX. (open-source!)

Just add &mediamtx=yourdomain.com to your VDO.Ninja publishing URLs to have it use your own MediaMTX server.

## How it works?

When used with VDO.Ninja, video is published to Cloudflare via WHIP, and the WHEP playback URL is distributed to viewers. Unless otherwise specified, viewers will use the WHEP URL as the source of media from the publisher, instead of using the normal peer-to-peer mode. This has the effect of reducing the CPU and network load when sharing media with multiple videos, as instead of distributing media via peer-to-peer, the media is distributed via a server. This approach does have some downsides also, so its not normally advisable unless desired or needed.

## Why do I need a special URL parameter?

The reason we need a special generated URL parameter is because Cloudflare requires user accounts, unlike Meshcast. While you can generate WHIP URLs within your Cloudflare dashboard, and use them on VDO.Ninja links using &whipout, you'd need to create one per guest. Instead here, we're using our Cloudflare credentials to automatically create unique WHIP ingest URLs on demand for each guest, so you can get away with one-invite link for all your guests.

Since it's not advisable to share your Cloudflare credentials, particularly with random guests, this page will encrypt your credentials into URL-friendly parameter. Only the VDO.Ninja servers knows the decryption key, which limits what guest can do with the encrypted key. You can delete or restrict the credentials provided to VDO.Ninja from your Cloudflare dashboard, allowing you to limit or revoke any trust provided to VDO.Ninja.

## Where to get my Cloudflare account ID and token?

The Cloudflare account ID can be found on the right-hand side of the Workers & Pages (Overview) page, or it can be found on the right-lower side of any of your Website (domain) overview pages.

As for the API token, you'll need to create it, with limited permissions.

- Go to https://dash.cloudflare.com/profile/api-tokens
- Click to Create Token (API Tokens)
- Click Get started with the Create Custom Token option
- Provide a token name, and for the permissions select Account -> Stream -> Edit (not Read)
- You can define a time-to-live (TTL), if you wish for the token to auto-expire.

You should now have access to both access token and account ID.

## Can I self-host or hard-code my Cloudflare credentials?

Yes, the code is open-sourced and it can be self-hosted, however please be aware there is limited support for those self-hosting.

## Does VDO.Ninja track me or store my private information?

Please refer to the privacy policy, although the short answer is no. I can't say the same for Cloudflare, so please refer to their terms of service.