
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Fri, 10 Apr 2026 04:40:40 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Improve site load times and SEO with one-click support for Signed Exchanges on Google Search]]></title>
            <link>https://blog.cloudflare.com/automatic-signed-exchanges/</link>
            <pubDate>Tue, 14 Sep 2021 12:59:06 GMT</pubDate>
            <description><![CDATA[ Starting today, Cloudflare customers will be able to generate Signed Exchanges (SXG) for Google Search with just one click. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>We’re excited to announce that, starting today, Cloudflare customers will be able to generate Signed Exchanges (SXG) for Google Search with just one click. Signed Exchanges is an open <a href="https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html">web platform specification</a> Google developed as a way of verifying a cached version of a website — enabling massively <a href="https://www.cloudflare.com/learning/performance/speed-up-a-website/">faster delivery of a website from a third party</a>, such as Google itself from its search results page, or from a news aggregator that is linking out to other sites.</p><p>The advantage to you as a website owner? Not only will your site load faster when linked to from a site supporting SXG, but because many search engines use page load times in order to determine search results, you should see a very nice <a href="https://www.cloudflare.com/learning/performance/how-website-speed-boosts-seo/">boost in SEO</a>.</p>
    <div>
      <h3>What are signed exchanges, and how do they work?</h3>
      <a href="#what-are-signed-exchanges-and-how-do-they-work">
        
      </a>
    </div>
    <p><a href="https://web.dev/signed-exchanges/">Introduced by Google</a>, a Signed Exchange (SXG) is an open standard delivery mechanism that makes it possible to authenticate the origin of a resource, independent of how it was delivered. This decoupling advances a variety of use cases, such as prefetching, offline Internet experiences, and serving from third-party caches. It does so in a secure and privacy-preserving manner.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4OjZeHJZXsvdoFZoI2cfvj/35372e8e6ea9617382148e7729ac4104/image5-6.png" />
            
            </figure><p>Now, imagine yourself as the ruler of your kingdom with an important message to deliver to all your subjects. You have too many people to reach, so you can’t do it alone. You decide to enlist your trusty knights to ride out with large chests filled with copies of your message. There are villains everywhere that would love to take these messages and modify them for their own nefarious machinations for their own profit.</p><p>You, being the wise ruler you are, have a crafty plan: you have a very special stamp made that can imprint a seal that everyone can recognize, yet no one can recreate. With this wondrous seal, no one can tamper with the messages without breaking the seal and proving the forgery for all to see. Now, your knights can bring these chests to all corners of the kingdom and hand out the messages to the masses, and your subjects can trust that the message came from you. There is a side benefit for your people, too. They can come whenever they want to pick up the message without your watchful eye, so they’re more inclined to read it at their leisure.</p><p>Maybe this is stretching the analogy a bit, but in the case of Signed Exchanges, a cryptographic signature on a digest of the response and headers acts as the tamper proof seal for the message. Fast forwarding our example to the present day: you want to get your newest web experience out to global distribution with the understanding that just about everyone will come through a search engine or aggregator site. Ahead of time, when you publish your content, the search engine <a href="https://www.cloudflare.com/learning/bots/what-is-a-web-crawler/">crawls your site</a> for content, but instead of delivering the raw content, you negotiate the delivery of the signed exchange. (This is accomplished simply through additional “Accept: application/signed-exchange;v=” request headers from the crawler that announces the preference for signed exchanges).</p><p>Then Cloudflare generates the Signed Exchange, using the following process:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/41mWvVJkJcKzFAUhjOexa5/437dfba49fa1cd15ccc8ff5ff425f7ff/image3-7.png" />
            
            </figure><ol><li><p>Cloudflare fetches the original content that you want to sign, including the response headers.</p></li><li><p>An additional Digest header is added that uses Merkle Integrity Content Encoding to support the progressive detection of data modification/corruption.</p></li><li><p>We also strip out headers that don’t make sense within the context of Signed Exchanges (like Connection, Keep-Alive, etc.) as well as security sensitive headers (Set-Cookie, Authentication-Info, etc.).</p></li><li><p>Then these headers, including the digest, along with additional metadata, like request URL, URL of the certificate, hash of the certificate, expiration time, etc., are all chained together into a stream that is used to calculate the final signature.</p></li><li><p>The original content, along with the headers, signature, and a fallback URL are then packed into a final binary for delivery.</p></li></ol><p>This Signed Exchange is then cached and sent to the crawler, which also stores the Signed Exchange. After indexing the content, it can now show up in searches. The user then discovers the link to your content in the search results. The search engine also preloads the signed exchange for your content in the background in the meantime, effectively pre-filling the cache in the client’s browser. This exchange was delivered from the search engine, so no signal has gone to the origin yet. Thus, the search intent of the user isn’t leaked to the origin. Since the exchange is signed and validated against your certificate, the browser trusts the contents and can display the content with attribution to the original URL. Now, when the user clicks on the link to view the contents, it magically loads instantaneously from the local cache.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3fxVcYcnHZHJqUUKXXbr8N/b06a1958c4908c1bfaf22222852a4973/image4-8.png" />
            
            </figure><p>There are many resources on the web available that go into detail about the specific format of <a href="https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html">Signed Exchanges</a>, so we won’t rehash them here in detail. But one important aspect that isn’t obvious at first glance is the complexity of managing the signing process itself. The many details involve:</p><ul><li><p>The inclusion of the atypical CanSignHttpExchanges extension to your certificate.</p></li><li><p>The requirement to deliver your certificates in a specific CBOR (like binary JSON) format.</p></li><li><p><a href="/high-reliability-ocsp-stapling/">OCSP stapling</a> to ensure the validity of the certificates is required.</p></li><li><p>Renewals of these certificates on a more frequent basis (i.e. requires <a href="https://www.cloudflare.com/application-services/solutions/certificate-lifecycle-management/">automation</a>).</p></li><li><p>Caching of the generated signed exchanges, since they can be expensive to generate.</p></li></ul><p>Luckily, all of these are in Cloudflare’s wheelhouse, since we already have deep expertise in <a href="https://www.cloudflare.com/advanced-certificate-manager/">Certificate Management</a> and <a href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/">TLS delivery</a> infrastructure. By partnering with Google on the Signed Exchange implementation, we can ensure the consistency of implementation, but improve the simplicity of integrating the technology with the single push of a button.</p><blockquote><p><i>“Signed Exchanges make the web faster and a better user experience for users, by enabling cross-site prefetching. Site owners have seen clear improvement to Largest Contentful Paint, one of the Core Web Vitals, as well as increased user stickiness. Cloudflare now makes it simple for sites to implement Signed Exchanges and derive these benefits.” —</i> Jeff Jose, Product Manager, Google</p></blockquote>
    <div>
      <h3>Bigger than search alone</h3>
      <a href="#bigger-than-search-alone">
        
      </a>
    </div>
    <p>The broader implication of SXGs is that they make content portable: content delivered via an SXG can be easily distributed by third parties while maintaining full assurance and attribution of its origin. Historically, the only way for a site to use a third party to distribute its content while maintaining attribution has been for the site to share its <a href="https://www.cloudflare.com/application-services/products/ssl/">SSL certificates</a> with the distributor. This has security drawbacks. Moreover, it is a far stretch from making content truly portable.</p><p>In the long-term, truly portable content can be used to achieve use cases like fully offline experiences. In the immediate term, the primary use case of SXGs is the delivery of faster user experiences by providing content in an easily cacheable format. Specifically, <a href="https://web.dev/signed-exchanges/#google-search">Google Search</a> will cache and sometimes prefetch SXGs. For sites that receive a large portion of their traffic from Google Search, SXGs can be an important tool for delivering faster page loads to users.</p><p>It’s also possible that all sites could eventually support this standard. Every time a site is loaded, all the linked articles could be pre-loaded. Web speeds across the board would be dramatically increased. <a href="/from-amp-to-signed-exchanges-or-how-innovation-happens-at-cloudflare/">Matthew’s blog post</a> talks more about this possibility.</p>
    <div>
      <h3>Sign up today</h3>
      <a href="#sign-up-today">
        
      </a>
    </div>
    <p>Automatic Signed Exchanges will be free for all Cloudflare Pro, Business and Enterprise customers as well as for customers using our <a href="https://www.cloudflare.com/automatic-platform-optimization/wordpress/">Advanced Platform Optimization</a> product.</p><p>Sign up for the Automatic Signed Exchange beta waitlist today and after being approved, activating is only one flip of a switch.</p><p>To sign up for the waitlist go to the <a href="https://dash.cloudflare.com?to=/:account/:zone/speed/optimization#sxg-card">Speed page</a> on the Cloudflare dashboard and click on “Join Waitlist” on the Automatic Signed Exchanges (SXGs) card.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/IAJGfwzNRXcjVs5nzhi5W/1abf7168ca5caef0b460ce643bdffb85/image1-7.png" />
            
            </figure><p>We’ll take care of the rest.</p>
    <div>
      <h3>Watch on Cloudflare TV</h3>
      <a href="#watch-on-cloudflare-tv">
        
      </a>
    </div>
    <div></div><p></p> ]]></content:encoded>
            <category><![CDATA[Speed Week]]></category>
            <category><![CDATA[Signed Exchanges (SXG)]]></category>
            <category><![CDATA[Internet Performance]]></category>
            <guid isPermaLink="false">1UzU9qeTQcJmghaVMksLAz</guid>
            <dc:creator>Marc Lamik</dc:creator>
            <dc:creator>Oliver Yu</dc:creator>
        </item>
        <item>
            <title><![CDATA[Building Cloudflare TV from scratch]]></title>
            <link>https://blog.cloudflare.com/building-cloudflare-tv-from-scratch/</link>
            <pubDate>Tue, 07 Jul 2020 11:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare TV is a 24x7 TV channel that takes you behind-the-scenes and let’s you hear directly from the builders working on your favorite Cloudflare products. This blog post covers the story of why we decided to build Cloudflare TV in-house and some of the technologies that make it possible. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Cloudflare TV is inspired by television shows of the 90s that shared the newest, most exciting developments in computing and music videos. We had three basic requirements for Cloudflare TV:</p><ol><li><p>Guest participation should be as simple as joining a Zoom call</p></li><li><p>There should be 24x7 programming. Something interesting should be playing <i>all the time</i></p></li><li><p>Everything should happen in the cloud and we should never have to ask anyone “to leave their computer on” to have the stream running 24 hours a day</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/j8JPvjtPqbNC7OMfkqYhK/04f32b8fcc5bd60c87169357f4191cba/image1.png" />
            
            </figure>
    <div>
      <h3>We didn’t set out to build Cloudflare TV from <i>scratch</i></h3>
      <a href="#we-didnt-set-out-to-build-cloudflare-tv-from-scratch">
        
      </a>
    </div>
    <p>Building a lot of the technology behind Cloudflare TV from scratch was not part of the plan, especially given our aggressive timeline. So why did we decide to pursue it? After evaluating multiple live streaming solutions, we reached the following conclusion:</p><ul><li><p>24x7 linear streaming is not something that is a priority for most video streaming platforms. This makes sense: the rise of <a href="https://www.cloudflare.com/developer-platform/solutions/video-on-demand/">video-on-demand</a> and event-based live streaming has come at the expense of linear streaming.</p></li><li><p>Most broadcasting platforms have their own guest apps which must be downloaded and set up in advance. This introduces unnecessary friction compared to clicking a link in the calendar invite to join a video call.</p></li></ul>
    <div>
      <h3><i>“Wait! Can we just use Zoom + Cloudflare?”</i></h3>
      <a href="#wait-can-we-just-use-zoom-cloudflare">
        
      </a>
    </div>
    <p>One of the core goals of Cloudflare TV was to make it easy for presenters, and what’s easier than letting them use the tools they already know? Everyone on our team is familiar with Zoom, and so are many of the guests who will be appearing on Cloudflare TV. Better yet, Zoom almost always "just works".</p><p>So when we discovered that Zoom lets you push live video to any RTMP end point, we started experimenting with the feature.</p><p>“RTMP” stands for Real-Time Messaging Protocol and was originally developed to facilitate low-latency communication using TCP via Macromedia Flash. RTMP has outlived Flash and is widely used by platforms, including YouTube, to enable live video streaming. RTMP is a push protocol and platforms like YouTube provide RTMP endpoints which are simply URLs. Most video broadcast apps will let you configure multiple RTMP endpoints, which tells the app “<i>hey send my live video feed from my phone or computer to these services</i>.” If you find yourself watching a live video that is being broadcasted on multiple services, it is very likely made possible by RTMP.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/31W6iKPpSmg0aAB0PjhDGb/a809f622de9a52b470541484233f5ea4/image3.png" />
            
            </figure><p>Zoom lets you provide RTMP endpoints and instruct it to send the live video feed of Zoom calls to, in our case, Cloudflare TV’s RTMP. Before we could use this feature, we needed to be able to ingest RTMP video feeds.</p><p>First, we set up an NGINX server with the RTMP module:</p>
            <pre><code>apt-get install build-essential libpcre3 libpcre3-dev libssl-dev git zlib1g-dev -y
mkdir ~/build &amp;&amp; cd ~/build
git clone git://github.com/arut/nginx-rtmp-module.git
wget http://nginx.org/download/nginx-1.14.1.tar.gz
tar xzf nginx-1.14.1.tar.gz
cd nginx-1.14.1
sudo ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module
sudo make
sudo make install</code></pre>
            <p>Next, we configured <code>nginx.conf</code> so NGINX can not only ingest the RTMP feed, but also make it streamable to the end user. A browser typically can’t stream from an RTMP source. We need NGINX to take the RTMP feed and create HLS/DASH segments.</p><p>We defined an application called <code>live</code> inside <code>nginx.conf.</code> Within the live application, we can add directives to ingest RTMP and output HLS:</p>
            <pre><code>...
rtmp {
    server {
        ...
        application live {
            allow play all;
            live on;

            # sample HLS
            hls on;
            hls_path /mnt/hls/;
            hls_fragment 1;
            hls_playlist_length 4;
            hls_sync 100ms;
        }
    }
}
</code></pre>
            <p>Once we had NGINX set up to ingest RTMP and HLS, we followed Zoom’s instructions on <a href="https://support.zoom.us/hc/en-us/articles/360028478292-Streaming-a-Meeting-or-Webinar-on-YouTube-Live">Custom Live Streaming</a>. And soon enough, we had a basic prototype of live streaming Zoom calls using the Cloudflare network!</p>
    <div>
      <h3>Transitions without interruption</h3>
      <a href="#transitions-without-interruption">
        
      </a>
    </div>
    <p>So we met our number one requirement of making the guest experience as easy as joining a video call. But Cloudflare TV isn't going to be one never-ending call. We needed a way to smoothly transition between multiple calls over the course of the day, and to replay some of our favorite segments.</p><p>For example, we may have live programming from 1000 to 1100 followed by two hours of pre-recorded (or replayed) content. When the live programming ends at 1100, the video experience would break and the user would need to hit refresh to see the next show on the schedule.</p><p>So how do we fix this? We determined we needed the following:</p><ol><li><p>Ability to set the programming (the <i>“what plays when?”)</i> many days in advance</p></li><li><p>Have “virtual rooms” ingesting video from different sources (live events, pre-recorded videos stored using our Cloudflare Stream product)</p></li></ol><p>Once we have a schedule and “virtual rooms”, we can dynamically switch what is currently playing on-air to the appropriate “virtual room” streaming the content.</p><p>To implement this, we used Contentful, Workers, and Brave (an open-source video editor).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5XUFf7AdV7b8Wfh6ZG0hTg/54532516d529bee7c145daa52b931c04/image2.png" />
            
            </figure>
    <div>
      <h3>Brave</h3>
      <a href="#brave">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/32SC1qaxTOiSGmirYSKsdD/b5911f46cdc34b13e829375578b77405/image4.png" />
            
            </figure><p><a href="https://github.com/bbc/brave">Brave</a> is an open-source project started by the BBC. Using Brave, we were able to set up multiple virtual rooms and smoothly make any virtual room go on-air.</p><p>Under the hood, Brave is doing two key things:</p><ol><li><p>pulling multiple video feeds from various sources and placing them in virtual rooms</p></li><li><p>pushing the final (“on air feed”) to NGINX <i>every second of the day</i></p></li></ol>
    <div>
      <h3>Contentful</h3>
      <a href="#contentful">
        
      </a>
    </div>
    <p><a href="http://contentful.com/">Contentful</a> is a headless content management platform designed to be API-first; it eliminated the need for a database and helped us build our scheduling feature rapidly.</p><p>Most of the necessary fields are pretty straightforward for a CMS: title, presenters, and, of course, the time slot. Each of these is automatically synced with the publicly-facing schedule at <a href="https://cloudflare.tv/schedule">cloudflare.tv/schedule</a>.</p><p>We are able to use Workers to fetch events from Contentful:</p>
            <pre><code>export async function fetchEventRaw(id: string) {
  let r = await fetch(`${CONTENTFUL_API}/entries/${id}`, {
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${CONTENTFUL_ADMIN}`,
    },
  })
  return unwrap(r, 'Failed to retrieve event')
}</code></pre>
            <p>The more complex piece was integrating this with Zoom. Each segment needs its own Zoom meeting, and it’d be pretty arduous to create these manually. So when we publish in Contentful, Contentful makes a call to a Worker endpoint. The Worker endpoint automatically generates a Zoom meeting — and provides the Programming Team with the customized invite to send to the guest.</p><p>For example, when a new event is added to Contentful, Contentful notifies our Worker endpoint which creates a new meeting and configures it so it is being pushed to Cloudflare TV:</p>
            <pre><code>export async function createMeeting(ev: TVEvent) {
  const headers = await zoomHeaders()

  const alternative_hosts = ev.altHosts ? ev.altHosts.join(',') : ''

  ev.zoomPassword = genPassword()

  let r = await fetch(`https://api.zoom.us/v2/users/${ev.studio}@cloudflare.com/meetings`, {
    method: 'POST',
    headers,
    body: JSON.stringify({
      topic: ev.title,
      type: 2,
      start_time: ev.start,
      duration: ev.duration,
      timezone: 'UTC',
      agenda: ev.description,
      password: ev.zoomPassword,
      settings: {
        host_video: true,
        participant_video: false,
        alternative_hosts,
        cn_meeting: false,
        in_meeting: false,
        join_before_host: true,
        mute_upon_entry: true,
        watermark: false,
        use_pmi: false,
        approval_type: 2,
        audio: 'both',
        auto_recording: 'cloud',
        enforce_login: false,
      },
    }),
  })
  let data = await unwrap(r, 'Failed to create ZOOM meeting')
  log('zoom: ', data)

  ev.meetingId = data.id
  ev.zoomUrl = data.join_url

  // push livestream configuration data to meeting
  r = await fetch(`https://api.zoom.us/v2/meetings/${ev.meetingId}/livestream`, {
    method: 'PATCH',
    headers,
    body: JSON.stringify({
      //TODO: make configurable
      stream_url: CFTV_RTMP_ENDPOINT,
      stream_key: ev.studio,
      page_url: 'https://cloudflare.tv',
    }),
  })
  await unwrap(r, 'Failed to update LiveStream config')

  return ev
}</code></pre>
            <p>The other upside to using Contentful is that many members of our team already have familiarity with it, so it reduces the overhead of learning a new tool.</p>
    <div>
      <h3>Workers</h3>
      <a href="#workers">
        
      </a>
    </div>
    <p>So far, we’ve described the different pieces of the backend (NGINX, Brave, Contentful) that make Cloudflare TV possible. How do we bring them all together? Cloudflare Workers serves as the glue that brings these systems together. The <a href="https://cloudflare.tv/">Cloudflare TV frontend</a> is built on Worker Sites. The frontend calls our Worker endpoints to fetch data, such as the programming calendar.</p>
    <div>
      <h3>Thinking Ahead...</h3>
      <a href="#thinking-ahead">
        
      </a>
    </div>
    <p>We’re just getting started with Cloudflare TV. We have a long wish list of features we’d really like to see. Here are some of the features we can’t wait to work on:</p><ul><li><p>Improve the viewing experience by adding closed-caption support</p></li><li><p>Enable our viewers to call in and ask questions and contribute to the conversation</p></li><li><p>Bring Cloudflare TV to platforms like Apple TV and Roku</p></li></ul> ]]></content:encoded>
            <category><![CDATA[Live Streaming]]></category>
            <category><![CDATA[Cloudflare Stream]]></category>
            <category><![CDATA[Life at Cloudflare]]></category>
            <category><![CDATA[Cloudflare TV]]></category>
            <guid isPermaLink="false">6n1f4DWW7cUcgbNbTHcqFR</guid>
            <dc:creator>Oliver Yu</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare Streams]]></title>
            <link>https://blog.cloudflare.com/how-cloudflare-streams/</link>
            <pubDate>Wed, 27 Sep 2017 13:00:00 GMT</pubDate>
            <description><![CDATA[ Every day, close to 1 billion people watch video through Cloudflare. That’s 100 petabytes of video every month. Last year, video made up 73% of all internet traffic, which is why earlier today we announced Cloudflare Stream. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Every day, close to 1 billion people watch video through Cloudflare. That’s 100 petabytes of video every month. Last year, <a href="https://www.cisco.com/c/en/us/solutions/collateral/service-provider/visual-networking-index-vni/complete-white-paper-c11-481360.html#_Toc484813971">video made up 73%</a> of all internet traffic, which is why earlier today we announced <a href="/introducing-cloudflare-stream">Cloudflare Stream</a>, an end to end video solution designed to bring instant video to any device and network connection. Here’s how Stream works to optimize video upload, encoding and delivery.</p>
    <div>
      <h3>Uploads</h3>
      <a href="#uploads">
        
      </a>
    </div>
    <p>Using Cloudflare Stream starts with a call to the Stream API to <code>/upload</code> a video.</p><p>HTTP does not by default provide a reliable upload mechanism for large files, which can make it tricky to upload large media content like high quality video. If there’s any latency in the network connection, a timeout can cancel the entire upload and require the client to start over.</p><p>We use an open source upload protocol called <a href="https://tus.io/protocols/resumable-upload.html">Tus</a> which allows for resumable uploads where the upload previously failed. Tus does this by splitting the download into manageable chunks and tracking completed chunks on the server.</p>
    <div>
      <h3>Encodes</h3>
      <a href="#encodes">
        
      </a>
    </div>
    <p>Video files are containers that hold the video file, the audio track, and some metadata. The video file is compressed by a codec. The codec is a compression algorithm for encoding video streams. Browsers use codecs to determine how they should decode and decompress the video for playing. Common container formats include MPEG, AVI, OGG and MP4. (You can usually tell the container format by the file extension.) Common codecs include H.264, HEVC (which Apple just announced support for as part of iOS 11), and VP9.</p><p>Different <a href="https://en.wikipedia.org/wiki/HTML5_Video#Browser_support">browsers support different codecs</a> so in order to run the best quality video on all browsers and devices, video providers need to encode a single video to multiple formats. For example, Netflix uses HEVC/H.265 to get <a href="https://medium.com/netflix-techblog/a-large-scale-comparison-of-x264-x265-and-libvpx-a-sneak-peek-2e81e88f8b0f">50% bitrate savings</a> over its predecessor, but that format is only supported on the newest version of <a href="http://caniuse.com/#feat=hevc">Safari on the latest Mac and iOS</a> operating systems, so they fall back when streaming on other browsers and devices. Likewise, <a href="https://youtube-eng.googleblog.com/2015/04/vp9-faster-better-buffer-free-youtube.html">YouTube uses VP9</a> to deliver 4K video at half the bandwidth, but it isn’t supported on <a href="http://caniuse.com/#search=vp9">Safari, IE or Opera</a> so they use other formats on those browsers.</p><p>Once you upload a video to Cloudflare Stream, Cloudflare immediately starts encoding the video and storing each encoded version. Today we encode to H.264, which is supported by <a href="http://caniuse.com/#feat=mpeg4">all modern browsers</a> and is known for supporting high quality video including 4K, and to MP4 for legacy support. We’re adding more optimized codecs like VP9 and HEVC next.</p>
    <div>
      <h3>Delivery: Streaming</h3>
      <a href="#delivery-streaming">
        
      </a>
    </div>
    <p>With normal HTTP streaming, the client pulls down the video while the user watches it at the same time. That means for video to play without buffering, the bitrate needs to be below that of the bandwidth available on the connection. As more clients are watching video from their phones, the bandwidth connection is often lower and this method sacrifices video quality.</p><p>Instead, we use progressive downloads, also called pseudo streaming, in which the video is streamed from the HTTP server and then cached on the client, where it is played from the hard drive or from memory. This allows us to encode at higher bitrates, preserving quality.</p><p>Alongside progressive downloads, we use a technology called adaptive streaming in which the server offers multiple bitrate streams and the client switches between them based on the current network connectivity. To accomplish this, the video is chunked, and the client can switch between profiles in between the video chunks by downloading the following chunk from a different bitrate stream. You might have seen this in action when watching a video where the image quality changes in response to your network connection.</p><p>Each chunk contains a valid video file, audio file, and some metadata, which means that each chunk can be played independently. The difference between the video files on the chunks on each stream is the pixel dimension and the framerate (aka the quality of detail). However, the start moment of each chunk is lined up between streams so there’s no skipping as the client switches between streams.</p><p>The client knows where to source each bitrate stream because the video delivery starts by delivering a single manifest file that contains each available stream and its location. Here’s an example of the m3u8 format manifest file used for adaptive streaming. There’s a list of available bitrates and a location of each of their manifest files:</p>
            <pre><code>#EXTM3U

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-1",NAME="Audio",LANGUAGE="en",AUTOSELECT=YES,URI="audio_0_128000_hls.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=9728000,CODECS="avc1.64000d,mp4a.40.2",RESOLUTION=1920x1080,AUDIO="audio-1"
video_0_4800000_hls.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=4928000,CODECS="avc1.64000d,mp4a.40.2",RESOLUTION=1280x720,AUDIO="audio-1"
video_0_2400000_hls.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2528000,CODECS="avc1.64000d,mp4a.40.2",RESOLUTION=854x480,AUDIO="audio-1"
video_0_1200000_hls.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1728000,CODECS="avc1.64000d,mp4a.40.2",RESOLUTION=640x360,AUDIO="audio-1"
video_0_800000_hls.m3u8</code></pre>
            <p>Then if you were to open a single bitrate’s manifest file, you’d find the location of each chunk (this is how we route clients to the lowest latency data center for first segments vs lowest cost data center for subsequent segments -- more on that later):</p>
            <pre><code>#EXTM3U
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:10
#EXTINF:10,
http://media.cloudflarestream.com/segment1.avc
#EXTINF:10,
http://media.cloudflarestream.com/segment2.avc
#EXTINF:10,
http://media.cloudflarestream.com/segment3.avc
#EXT-X-ENDLIST</code></pre>
            <p>Cloudflare uses two standards for adaptive streaming: HLS and MPEG-DASH. The standards both work in essentially the same way - they contain small differences like MPEG-DASH uses smaller chunk sizes by default (2-4 seconds versus 10 seconds) so switching channels is faster. MPEG-DASH also has better support for ad insertion. HLS, Apple HTTP Live Streaming, on the other hand, is ideal for streaming to Apple products because it is natively supported by Apple devices and software.</p>
    <div>
      <h3>Delivery: Where in the world</h3>
      <a href="#delivery-where-in-the-world">
        
      </a>
    </div>
    <p>Cloudflare runs a global network in over 115 PoPs. In every one of our data centers we have a large number of servers connected to the Internet. Traffic to these data centers rises and falls depending on the time of day. Since each data center serves visitors in the region, when it's the middle of the night and people in the region are asleep, traffic drops. You can see this in the bandwidth graphs to data centers around the world.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1bpK4Blbf48jNZd5W6hUJ3/e5b35899476b53501eabae799a534800/Screen-Shot-2017-09-26-at-2.54.05-PM.png" />
            
            </figure><p>We are billed for bandwidth based on our peak usage in any 30-day period. That means that if we use more bandwidth during the troughs in any data center's day we don't incur any additional cost. Similarly, what we pay for the servers that run in these data centers is a fixed cost. Every minute we're not fully utilizing a server we are, effectively, underutilizing a resource we've already paid for.</p><p>Video delivery, it turns out, is the perfect task to fill these underutilized resources. To be fast, only the first few bytes need to come from the closest data center to the video viewer. The rest have a little bit of buffer time while the first few seconds of the video are being watched to reach the client and can come from whatever data center currently has excess resources.</p><p>How we accomplish this is by dynamically assigning data centers IP ranges based on which are currently being underutilized. Then videos are loaded alongside a manifest file, pointing the player to where they can locate the different chunks of the video for each bitrate. (As we described earlier, this is how adaptive streaming works: the player uses this manifest file to quickly locate different bitrate formats and switch between them as network latency changes). That manifest file is dynamically generated to point to the closest data center using Cloudflare’s default Anycast IP for the first chunk, then to the underutilized data centers for subsequent chunks. The final result is that the first segment is fast, with low cost subsequent segments. This allows us to offer a video solution that is at the best price, because let's face it, enabling video today is really expensive and unpredictable and it doesn't have to be.</p>
    <div>
      <h3>It’s a bird! It’s a plane! It’s a Cloudflare App! ?</h3>
      <a href="#its-a-bird-its-a-plane-its-a-cloudflare-app">
        
      </a>
    </div>
    <p>Three months ago we launched the next generation of Cloudflare Apps, an open platform that lets developers reach over 6 million customers. The Apps platform allows developers to build tools that use all of Cloudflare, which is why’ve built the Stream app:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5eIcjadhXK2el9V7oFnhEH/9d24dd5991f264e37a3af23188134c1b/cf-apps-video-preview-2-1.png" />
            
            </figure><p>Developers will soon be able to add video uploaders to their apps, making the Stream API accessible to all non-technical users.</p>
    <div>
      <h3>We’re Taking Advanced Sign Ups</h3>
      <a href="#were-taking-advanced-sign-ups">
        
      </a>
    </div>
    <p>It’s 10 years after Opera demoed the first implementation of the <code>&lt;video&gt;</code> element in 2007 and we’re excited about making video streaming easy, instant and cost effective. We’re going to open up a beta soon and we’re taking advance sign ups in the meantime. You can reserve your spot <a href="https://cloudflare.com/products/cloudflare-stream/">here</a>.</p><p>If bringing instant streaming to 7M applications sounds like a fun challenge for you, we're <a href="https://boards.greenhouse.io/cloudflare/jobs/863247#.WcrXlhNSzGJ">growing a video team in Austin</a>, and we want to meet you.</p> ]]></content:encoded>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[Cloudflare Stream]]></category>
            <category><![CDATA[Video]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <guid isPermaLink="false">2gFxS4eM7NI5PRMfD4VaC2</guid>
            <dc:creator>Oliver Yu</dc:creator>
        </item>
    </channel>
</rss>