Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Add video recording configuration options to BrowserSession

Magnus Müllerbe6fd1a92e28
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 687439300..75a316469 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -244,6 +244,8 @@ class BrowserSession(BaseModel):
record_har_mode: str | None = None,
record_har_path: str | Path | None = None,
record_video_dir: str | Path | None = None,
+ record_video_framerate: int | None = None,
+ record_video_size: dict | None = None,
# From BrowserLaunchPersistentContextArgs
user_data_dir: str | Path | None = None,
# From BrowserNewContextArgs
diff --git a/examples/features/video_recording.py b/examples/features/video_recording.py
index 87c7e1e10..5d8886b6c 100644
--- a/examples/features/video_recording.py
+++ b/examples/features/video_recording.py
@@ -1,14 +1,13 @@
import asyncio
from pathlib import Path
-from browser_use import Agent, BrowserProfile, BrowserSession, ChatOpenAI
+from browser_use import Agent, Browser, ChatOpenAI
+# NOTE: To use this example, install imageio[ffmpeg], e.g. with uv pip install "browser-use[video]"
-async def main():
- # Define a profile that enables video recording
- video_profile = BrowserProfile(headless=False, record_video_dir=Path('./tmp/recordings'))
- browser_session = BrowserSession(browser_profile=video_profile)
+async def main():
+ browser_session = Browser(record_video_dir=Path('./tmp/recordings'))
agent = Agent(
task='Go to github.com/trending then navigate to the first trending repository and report how many commits it has.',