Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
browser automation

How to Capture Video Screenshots With Puppeteer and Playwright

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a video frame, wait for the page’s <video> element, seek it by setting currentTime, await the seeked event, and then screenshot the element. Puppeteer uses an element handle screenshot; Playwright uses a locator screenshot. For a single rendered frame, this is simpler and more reliable than starting a recording.

Choose the capture you actually need

There are three different jobs that are often called a “video screenshot.” Choosing the right one avoids unnecessary complexity.

Capture the currently displayed video

Use an element screenshot when you need the pixels visible in the player. It captures the rendered video, controls and overlays that fall inside the element’s box (depending on what is visible at capture time).

Capture a frame at a media timestamp

Seek the HTML media element first, wait for seeked, then capture. The event means the seek operation completed, playback position changed and seeking became false. It does not promise codec-independent, mathematically exact frame accuracy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Audio Express AXHDCAP 4K HDMI Video Capture Card, Cam Link Card Game Audio Adapter HDMI to USB 2.0 Record Capture Device for Streaming, Live Broadcasting, Video Conference, Teaching, Gaming
  • [Enhanced 4K-1080P Video Capture Experience] Capture the Magic: Elevate your video recordings to new heights with our upgraded anti-static 1080P Video Capture Card. Immerse yourself in stunning visuals, supporting HDMI input at 4K 60FPS and USB output for capturing in 1080P, complete with rich stereo sound. Enjoy crystal-clear video recordings, dynamic gaming live streams, and professional conference broadcasts. Note: HDMI resolution: Max input can be 3840×2160@30Hz / Video output resolution: Max output can be 1920×1080@30Hz
  • [Seamless Real-Time Preview] Stay in the Moment: Our advanced ultra-low latency technology ensures seamless real-time transmission of video streams. Experience instant, lag-free previews, allowing you to capture every detail precisely. Effortlessly record video directly to your hard disk, all without compromising on quality or introducing any delays.
  • [Versatility and Broad Compatibility] Your Creative Hub: Connect your DSLR, camcorder, or action camera to a wide range of operating systems, including Windows, MacOS, and Linux. Unlock a world of possibilities with real-time streaming to popular platforms like Twitch, Youtube, OBS, Zoom, Potplayer, and VLC, giving you the tools to share your content effortlessly.
  • [Effortless Plug and Play] Simplicity Redefined: Say goodbye to complex installations. Our plug-and-play design eliminates the need for drivers or external power supplies. Seamlessly integrate high-definition acquisition into various scenarios, whether it's educational recordings, immersive gaming, precise medical imaging, captivating live streams, or professional broadcasting.
  • [Seize Every Detail with Precision] Unleash your creativity and attention to detail with our video capture card. Capture every nuance, every color, and every moment with precision, thanks to the enhanced capabilities of our technology. Whether you're a content creator, a gamer, or a professional, our capture card empowers you to seize the finest elements and bring them to life in your recordings and live streams.

Collect a stream of browser frames

A screencast produces a sequence of page images, not a still image from a video’s own timeline. Playwright’s screencast API can provide JPEG frames with timestamps. Puppeteer’s documented Page.screencast() route is marked obsolete and points to Page.record(); that recording workflow requires ffmpeg. Use a still screenshot for one frame.

Prerequisites and a stable capture strategy

  • Install a supported Puppeteer or Playwright version and its browser binaries.
  • Navigate to the page and wait for the video element to exist.
  • Wait for media metadata before using duration or seeking.
  • Install event listeners before changing currentTime, so a fast seek cannot be missed.
  • Provide media-error and timeout handling. A network stall, unsupported codec or protected stream can prevent completion.
  • Pause playback when you need a stable image rather than a frame that changes during capture.

The browser may display a poster, black frame or partially decoded image while media is loading. loadedmetadata indicates that dimensions and duration metadata are available; loadeddata indicates that the first frame has loaded. For a target timestamp, wait for metadata, seek, await seeked, and verify that the element has usable data before taking the screenshot.

Capture a video frame with Puppeteer

Install Puppeteer with npm install puppeteer. This example saves a PNG of the video element at 12.5 seconds.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });

  try {
    await page.goto('https://example.com/video-page', {
      waitUntil: 'domcontentloaded',
      timeout: 60_000
    });

    await page.waitForSelector('video');
    const video = await page.$('video');
    if (!video) throw new Error('Video element was not found');

    await page.evaluate(async (element, target) => {
      const waitFor = (event, timeout = 30_000) => new Promise((resolve, reject) => {
        const timer = setTimeout(() => reject(new Error(`Timed out waiting for ${event}`)), timeout);
        const done = () => { clearTimeout(timer); resolve(); };
        element.addEventListener(event, done, { once: true });
        element.addEventListener('error', () => {
          clearTimeout(timer);
          reject(new Error('Video media error'));
        }, { once: true });
      });

      if (element.readyState < 1) await waitFor('loadedmetadata');
      if (Number.isFinite(element.duration) && target > element.duration) {
        throw new Error(`Target ${target}s exceeds duration ${element.duration}s`);
      }
      element.pause();
      if (Math.abs(element.currentTime - target) > 0.01) {
        const seeking = waitFor('seeked');
        element.currentTime = target;
        await seeking;
      }
      if (element.readyState < 2) await waitFor('loadeddata');
    }, video, 12.5);

    await video.screenshot({ path: 'video-12.5s.png' });
  } finally {
    await browser.close();
  }
})();

ElementHandle.screenshot() captures only the element’s rectangle. Use page.screenshot() instead when you need the complete page, including surrounding text or controls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Capture Card, 4K HDMI Video Capture Card, Game Capture Card, 1080P 60FPS Video Capture Device, HDMI to USB 3.0 Capture Card for Streaming, Work with Camera/Xbox/PS4/PS5/PC/OBS
  • 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
  • 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
  • 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
  • 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
  • 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.

Current-frame Puppeteer version

If a representative frame is sufficient, omit the seek and pause the element before capturing:

await page.evaluate(() => {
  const video = document.querySelector('video');
  if (!video) throw new Error('No video element');
  video.pause();
});
const video = await page.$('video');
await video.screenshot({ path: 'current-frame.png' });

Capture a video frame with Playwright

Install Playwright with npm install playwright and install its browser with npx playwright install. Locator screenshots automatically resolve the element at capture time.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });

  try {
    await page.goto('https://example.com/video-page', {
      waitUntil: 'domcontentloaded',
      timeout: 60_000
    });

    const video = page.locator('video').first();
    await video.waitFor({ state: 'attached', timeout: 30_000 });

    await video.evaluate(async (element, target) => {
      const waitFor = (event, timeout = 30_000) => new Promise((resolve, reject) => {
        const timer = setTimeout(() => reject(new Error(`Timed out waiting for ${event}`)), timeout);
        const done = () => { clearTimeout(timer); resolve(); };
        element.addEventListener(event, done, { once: true });
        element.addEventListener('error', () => {
          clearTimeout(timer);
          reject(new Error('Video media error'));
        }, { once: true });
      });

      if (element.readyState < 1) await waitFor('loadedmetadata');
      if (Number.isFinite(element.duration) && target > element.duration) {
        throw new Error(`Target ${target}s exceeds duration ${element.duration}s`);
      }
      element.pause();
      if (Math.abs(element.currentTime - target) > 0.01) {
        const seeking = waitFor('seeked');
        element.currentTime = target;
        await seeking;
      }
      if (element.readyState < 2) await waitFor('loadeddata');
    }, 12.5);

    await video.screenshot({ path: 'video-12.5s.png', type: 'png' });
  } finally {
    await browser.close();
  }
})();

Use await page.screenshot({ path: 'page.png', fullPage: true }) when the entire scrollable page is required. If no path is supplied, Playwright returns image bytes, which is useful for uploading or further processing.

Seek correctly and avoid race conditions

Do not set currentTime and immediately call a screenshot. Seeking is asynchronous. Register the seeked listener first, then assign the time. Handle a target equal to the current position, because some browsers may not emit a new event when no seek occurs. Also validate duration when it is finite; live streams may have an unknown or changing duration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Guermok Video Capture Card, 4K USB3.0 HDMI to USB C, 1080P 60FPS & 2K 30FPS
  • 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
  • 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
  • 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
  • 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
  • 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
  1. Wait for the element and loadedmetadata.
  2. Check that the target is non-negative and, for finite media, no greater than duration.
  3. Pause playback if movement during capture would be a problem.
  4. Create the seeked promise and attach an error listener.
  5. Set currentTime.
  6. Wait for seeked, then for loadeddata if frame data is not ready.
  7. Capture the video element.

Canvas extraction: when you need pixels

A canvas is useful when you must resize, analyze or manipulate the frame rather than save the browser’s rendered rectangle:

const image = await page.evaluate(async (target) => {
  const video = document.querySelector('video');
  if (!video) throw new Error('No video element');
  if (video.readyState < 1) await new Promise((resolve, reject) => {
    video.addEventListener('loadedmetadata', resolve, { once: true });
    video.addEventListener('error', reject, { once: true });
  });
  await new Promise((resolve, reject) => {
    const timer = setTimeout(() => reject(new Error('Seek timeout')), 30_000);
    video.addEventListener('seeked', () => { clearTimeout(timer); resolve(); }, { once: true });
    video.currentTime = target;
  });
  const canvas = document.createElement('canvas');
  canvas.width = video.videoWidth;
  canvas.height = video.videoHeight;
  canvas.getContext('2d').drawImage(video, 0, 0);
  return canvas.toDataURL('image/png');
}, 12.5);

Canvas security is stricter than a browser screenshot. If media came from another origin without CORS approval, drawing it taints the canvas. Reading pixels or calling toDataURL() or toBlob() can then throw SecurityError. Set an appropriate crossorigin value before the video loads, and ensure the media server returns an allowing CORS header. A client-side attribute cannot grant permission that the server does not provide.

Puppeteer versus Playwright for video screenshots

Need Puppeteer Playwright
Visible page page.screenshot() page.screenshot()
Video element ElementHandle.screenshot() Locator screenshot
Full scrollable page Check options for the installed version fullPage: true
Image bytes Screenshot encoding options Returned buffer when no path is supplied
Frame stream Documented screencast is obsolete; use the current recording guidance page.screencast.start({ onFrame }), version-sensitive

Playwright’s screencast callback is intended for continuous JPEG page frames and includes presentation timestamps and viewport dimensions. Those timestamps describe the browser frame stream; they are not a substitute for seeking the HTML video to a media timestamp.

Or skip the browser setup

For a hosted page screenshot, ScreenshotNeo provides a single HTTP request and can return PNG, JPEG, WebP or PDF. It accepts consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. It also offers an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cURL (see the ScreenshotNeo API documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/video-page -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com/video-page"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/video-page' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
require('fs').writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo also supports full-page and selector captures, custom JavaScript and CSS, waits, device presets, cookies, headers, geolocation, blocking rules, caching, asynchronous jobs and bulk capture. It is useful when you need a clean page image rather than code running a browser on your own machine. One thousand screenshots per month are free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Rank #4
Video Capture Card, 4K USB3.0 HDMI to USB C, 1080P60FPS HDMI Capture Card for Streaming, Gaming, Video Recording Compatible with Switch, Xbox, PS4/5, OBS,iPad Mac OS Windows,Camera, Zoom(Silver)
  • 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
  • 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
  • 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
  • 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
  • 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

The screenshot shows a poster or black frame

Wait for loadeddata after seeked, confirm the video is not hidden, and check that the browser can decode the codec. A poster image is not evidence that the requested media frame is ready.

The seek promise never resolves

Use a timeout and inspect the media error. The URL may be stalled, the target may be outside a live stream’s seekable range, or the player may not expose a normal HTML video element.

The selector finds the wrong element

Inspect the page for nested players, shadow DOM or an iframe. For an iframe, access its frame first; for shadow DOM, use a locator or page-side query that reaches the component’s shadow root.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Canvas export raises SecurityError

Verify the media origin, the pre-load crossorigin setting and the server’s CORS response. If you only need the rendered image, use the element screenshot instead of canvas extraction.

Best Value
Capture Card 4K HDMI Video Streaming to USB 3.0 1080P 60FPS Capture Device
  • High-Quality Video Capture, 4K HDMI Capture Card Ready: Capture smooth and vibrant video with this 4K HDMI capture card, engineered for gamers and content creators who demand crisp 1080P 60FPS video quality. Whether you're streaming to Twitch or recording gameplay for YouTube, your footage will look professional and detailed
  • Plug-and-Play USB Capture Card, No Drivers Needed: Designed as a USB capture card for streaming, this device works instantly out of the box, just plug into your PC or laptop and start capturing. Fully compatible with popular software like OBS Studio, Streamlabs, and XSplit, making setup quick and stress-free for beginners and pros alike
  • Universal Compatibility PS5, Xbox, Switch & More: Stream or record gameplay from virtually any HDMI-enabled device including Nintendo Switch, PS5, Xbox Series X, DSLR cameras, and PCs. The video capture card for gaming supports seamless passthrough so you can play without lag while your audience watches every frame in real time
  • Low-Latency Performance for Smooth Streaming: This capture card for streaming minimizes delay between gameplay and broadcast, so you get reliable, low-latency capture that works well for competitive gaming, live broadcasts, and podcast sessions. Suitable for those building their channel with high-quality, engaging content
  • Compact & Portable Design for Content Creators: Lightweight and portable, this USB 3.0 capture card works well for creators who travel or switch gaming setups often. Throw it in your bag and stream or record wherever you are, at home, events, LAN parties, streaming or studio sessions

A protected or DRM stream cannot be captured

The documented workflow assumes an accessible HTML video element. DRM players, custom streaming pipelines and sites without a usable seek path require player-specific investigation; these APIs do not establish a general DRM bypass.

The output is not frame-exact

Seek completion means the browser finished seeking, not that every codec and browser selected an identical decoded frame. If exact frame identity matters, test the same browser, codec, stream and timestamp in your deployment environment.

Practical performance and reliability notes

  • Reuse one browser process for multiple pages, but isolate unrelated jobs in separate pages or contexts.
  • Set realistic navigation and media timeouts; a long timeout should not hide permanently broken media.
  • Capture the video element instead of a full page when output size and speed matter.
  • Use PNG for lossless analysis and JPEG or WebP when smaller files are acceptable.
  • Record the URL, target time, browser version and media errors alongside output so failed captures can be reproduced.
  • Do not infer performance guarantees from API documentation; decoding and scheduling vary by browser, hardware and stream.

Frequently Asked Questions

Can I capture a frame without playing the video?

Yes. Set the target currentTime, await seeked, and keep the element paused before taking the screenshot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I use a page screenshot or an element screenshot?

Use an element screenshot for the video pixels alone; use a page screenshot when surrounding content, controls or the complete layout is part of the result.

Does Playwright screencast seek the video timeline?

No. Screencast timestamps describe a stream of browser frames. Seek the HTML video element separately when you need a media timestamp.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.