Skip to main content

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.

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

Basic usage

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

value
str | Path | Callable | None
default:"None"
Default video as filepath or URL
format
str | None
default:"None"
File extension for video (e.g., “mp4”, “avi”). Use “mp4” for browser playability
sources
list[Literal['upload', 'webcam']] | None
default:"None"
Input sources:
  • "upload" - File upload
  • "webcam" - Webcam recording
Defaults to both
height
int | str | None
default:"None"
Component height in pixels or CSS units
width
int | str | None
default:"None"
Component width in pixels or CSS units
autoplay
bool
default:"False"
Whether to automatically play video when displayed
loop
bool
default:"False"
Whether video loops when it reaches the end
include_audio
bool | None
default:"None"
Whether to include audio track. Defaults to True for uploads, False for webcam

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

import gradio as gr

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

Ensure MP4 format

import gradio as gr

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

Build docs developers (and LLMs) love