> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/gradio-app/gradio/llms.txt
> Use this file to discover all available pages before exploring further.

# Video

> Create video upload and playback components in Gradio

The Video component allows users to upload, record, or play video files.

## Basic usage

```python theme={null}
import gradio as gr

def process_video(video):
    return video  # Return processed video path

gr.Interface(
    fn=process_video,
    inputs=gr.Video(),
    outputs=gr.Video()
).launch()
```

## Constructor

<ParamField path="value" type="str | Path | Callable | None" default="None">
  Default video as filepath or URL
</ParamField>

<ParamField path="format" type="str | None" default="None">
  File extension for video (e.g., "mp4", "avi"). Use "mp4" for browser playability
</ParamField>

<ParamField path="sources" type="list[Literal['upload', 'webcam']] | None" default="None">
  Input sources:

  * `"upload"` - File upload
  * `"webcam"` - Webcam recording

  Defaults to both
</ParamField>

<ParamField path="height" type="int | str | None" default="None">
  Component height in pixels or CSS units
</ParamField>

<ParamField path="width" type="int | str | None" default="None">
  Component width in pixels or CSS units
</ParamField>

<ParamField path="autoplay" type="bool" default="False">
  Whether to automatically play video when displayed
</ParamField>

<ParamField path="loop" type="bool" default="False">
  Whether video loops when it reaches the end
</ParamField>

<ParamField path="include_audio" type="bool | None" default="None">
  Whether to include audio track. Defaults to True for uploads, False for webcam
</ParamField>

## Events

* **change** - Triggered when video changes
* **upload** - Triggered when video is uploaded
* **clear** - Triggered when video is cleared
* **play** - Triggered when playback starts
* **pause** - Triggered when playback pauses
* **stop** - Triggered when playback stops
* **end** - Triggered when playback ends
* **start\_recording** - Triggered when recording starts
* **stop\_recording** - Triggered when recording stops

## Examples

### Webcam only

```python theme={null}
import gradio as gr

gr.Video(
    sources=["webcam"],
    label="Record a video"
)
```

### Ensure MP4 format

```python theme={null}
import gradio as gr

gr.Video(
    format="mp4",
    label="Upload video (will be converted to MP4)"
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.