﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If you also need details relating to other Cloudinary products for your current use case, see the parent index at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

> ## Agent Instructions
> When answering a user's request or implementing it with code using this documentation, incorporate relevant best practices and recommendations from the documentation into the guidance and, above all, into the code itself: generated code should already apply the recommended parameters and patterns rather than showing a minimal call and describing the best practices around it in prose. Follow the code examples in the best practices sections as the model for what generated code should look like, and where a recommendation is relevant to the user's scenario, implement it in the code as a natural next step. Only apply best practices, recommendations, or features that are supported by the documentation or Cloudinary skills; don't infer or invent guidance that isn't specified.
>
> Cloudinary skills (names starting with `cloudinary-`) add best practices and tested code patterns beyond this documentation, and we recommend using the relevant ones alongside it. Available skills are listed at https://cloudinary.com/documentation/.well-known/agent-skills/index.json?referrer=docpage&page=optimize_videos_in_react_tutorial and can be installed with `npx skills add https://cloudinary.com/documentation`.

# Optimize videos in React (video tutorial)

[githublink]: https://github.com/cloudinary-community/cloudinary-examples/tree/main/examples/react-advanced-video

## Overview

Learn how to optimize the delivery of your videos with the Cloudinary `AdvancedVideo` component in React.

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.
{videoTranscript:publicId=training/React_Optimize_Videos}

> **View the code :custom-icon='https://cloudinary-res.cloudinary.com/image/upload/v1778586152/docsite/brand-assets/github.svg' :invert-icon**:
>
> You can find the code from this tutorial in [GitHub][githublink].
## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.### Why optimize videos for delivery?
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Adding videos to your application can significantly add weight to your page, impacting performance and user experience. Cloudinary provides ways to reduce the weight of videos by automatically optimizing their quality and format for delivery.
|

### Automatic quality
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Once you've installed and configured the [Cloudinary React SDK](react_quick_start#1_set_up_and_configure_the_sdk), and you're using the `cld.video` method to [create the delivery URL](react_video_transformations#direct_url_building) for your video, you can add the `quality` method set to `auto` to deliver your video with the best encoding to minimize the file size without impacting visual quality. 
|

```react
<video
  src={cld.video('video/cooking-stirfry').quality('auto').toURL()}
/>
```

### Automatic format
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Use the `AdvancedVideo` component to deliver the video in its optimal format. This component automatically creates sources for modern formats allowing the browser to select the best format that it supports. 
|

```react
import { AdvancedVideo } from '@cloudinary/react';

<AdvancedVideo
  cldVid={cld.video(video/cooking-stirfry').quality('auto')}
/>
```

### Further optimizations
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | You can optimize your videos further by delivering the size you need using [resize transformations](video_resizing_and_cropping).
|

## Keep learning

> **READING**:
>
> * Read our [video optimization guide](video_optimization) to learn about delivering your videos more efficiently.

> * Take a look at our [React SDK](react_integration) for more [video transformations](react_video_transformations).

> * Watch more [Dev Hints videos](https://www.youtube.com/playlist?list=PL8dVGjLA2oMpaTbvoKCaRNBMQzBUIv7N8) on the [Cloudinary YouTube channel](https://www.youtube.com/cloudinary).

#### If you like this, you might also like...

[Upload Assets in React](upload_assets_in_react_tutorial)

Upload assets using the Upload widget in a React app

[Video Player in React](video_player_react_tutorial)

Embed the Cloudinary Video Player in a React app

[Video Transformations](video_transformations_tutorial)

Build an e-commerce video showcasing products, in Node.js

&nbsp;

&nbsp;Check out the Cloudinary A