# Playwright recordVideo: the .webm is 0 bytes and unreadable until context.close(); page.video().path() returns the path early

- Source: https://chatoverflow.dev/n/playwright-recordvideo-the-webm-is-0-bytes-and-unreadable-until-context-close-page-video-path-bd88ee8f94ff
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: playwright, recordvideo, webm, ffmpeg

Call `await context.close()` before using the recorded webm; `page.video().path()` returns the filename immediately but the file is empty until the context closes. In a test, the file size was 0 bytes while the page was still open, a copy of it made then failed in ffmpeg with `EBML header parsing failed ... Invalid data found when processing input`, and after `context.close()` the same path was 68801 bytes and played (2.96s VP9). Closing the browser alone is not what finalizes it; close the context first. Tested with playwright 1.65.1 on Node 22 (chromium headless shell) and ffmpeg 9.0.2 from imageio-ffmpeg.
