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

To capture a video frame in JavaScript, pass the video element to the Canvas 2D context’s drawImage() method. For the frame at a particular time, seek the video and wait until the requested frame is ready before drawing. For ongoing frame-by-frame work, use requestVideoFrameCallback() where supported.

Capture the video’s current frame

The basic operation is ctx.drawImage(video, x, y, width, height). An HTMLVideoElement is a valid image source, so the canvas receives the video’s currently available frame. Set the canvas dimensions after the video metadata loads, then draw only when media data is available.

<video id="video" src="clip.mp4" muted playsinline controls></video>
<canvas id="canvas"></canvas>

<script>
const video = document.querySelector("#video");
const canvas = document.querySelector("#canvas");
const ctx = canvas.getContext("2d");

video.addEventListener("loadedmetadata", () => {
  canvas.width = video.videoWidth;
  canvas.height = video.videoHeight;
});

function drawCurrentFrame() {
  if (video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) {
    throw new Error("The video does not have frame data available yet.");
  }
  ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
}

video.addEventListener("loadeddata", drawCurrentFrame, { once: true });
</script>

video.videoWidth and video.videoHeight are the video’s intrinsic dimensions. The canvas width and height set its backing resolution; changing them also clears its contents and resets context state, so set them before drawing. If you want a smaller output, set a smaller canvas size and use the destination-size form of drawImage(), as above.

MDN documents the video element as a drawImage() source and notes that media readiness must be greater than 1 (HAVE_CURRENT_DATA) for drawing to work correctly. See MDN’s drawImage() documentation.

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.
#1 Best Overall
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.

Capture a frame at a specific timestamp

Assign the target time to video.currentTime, then wait for the seek to finish before drawing. The following function handles repeated requests by removing the previous seek listener, rejects out-of-range times, and returns a promise you can await.

let pendingSeekCleanup;

function captureAt(video, canvas, seconds) {
  const ctx = canvas.getContext("2d");

  if (!Number.isFinite(seconds) || seconds < 0 || seconds > video.duration) {
    return Promise.reject(new RangeError("Requested time is outside the video."));
  }

  if (pendingSeekCleanup) pendingSeekCleanup();

  return new Promise((resolve, reject) => {
    let timer;
    const cleanup = () => {
      clearTimeout(timer);
      video.removeEventListener("seeked", onSeeked);
      video.removeEventListener("error", onError);
      if (pendingSeekCleanup === cleanup) pendingSeekCleanup = undefined;
    };
    const onError = () => {
      cleanup();
      reject(new Error("Video failed while seeking."));
    };
    const onSeeked = () => {
      if (video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) return;
      cleanup();
      canvas.width = video.videoWidth;
      canvas.height = video.videoHeight;
      ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
      resolve(canvas);
    };

    pendingSeekCleanup = cleanup;
    video.addEventListener("seeked", onSeeked);
    video.addEventListener("error", onError, { once: true });
    timer = setTimeout(() => {
      cleanup();
      reject(new Error("Timed out waiting for the requested frame."));
    }, 15000);

    video.currentTime = seconds;
  });
}

// Example, after metadata is loaded:
await captureAt(video, canvas, 4.25);

The example replaces an earlier pending seek callback when a newer request arrives. If your application must complete every requested capture, rather than keeping only the newest one, serialize requests in a queue instead. A seek event indicates the seek operation completed; the readiness check guards against drawing before current frame data is available. MDN’s canvas image tutorial demonstrates seeking and recommends using requestVideoFrameCallback() to ensure a frame is ready.

Seeking is to a media time, not necessarily an exact encoded frame index. For frame-accurate extraction, account for the source’s frame rate and keyframe structure, and verify the result in the target browsers and media. The APIs described here provide browser rendering of a video frame; they do not promise exact synchronization with a separate clock or playback pipeline.

Rank #2
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

Crop or scale the captured frame

drawImage() has overloads for positioning, scaling, and cropping. Use the 3-argument form to draw at the source’s natural dimensions, the 5-argument form to scale to a destination rectangle, or the 9-argument form to select a source rectangle and map it to a destination rectangle.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
// Scale the full frame to a 640 × 360 canvas.
canvas.width = 640;
canvas.height = 360;
ctx.drawImage(video, 0, 0, 640, 360);

// Crop a 320 × 180 region beginning at (100, 50), then scale it.
ctx.drawImage(video, 100, 50, 320, 180, 0, 0, canvas.width, canvas.height);

Coordinates in the source rectangle refer to the video image; destination coordinates and dimensions refer to the canvas. For a crop that should retain its natural size, make the canvas match the crop dimensions. For a scaled crop, set the canvas to the desired output dimensions.

Process frames as the video plays

For overlays, analysis, or repeated canvas updates, schedule the next callback from the current callback. That ties work to new video frames rather than polling with a generic timer.

Rank #3
Oassuose VHS to Digital Converter,USB-A/USB-C Video 1080P Capture Card
  • This Video Capture Card Can transfer video and audio from VHS, VCR, DVD, Hi8, DV tapes, camcorders, or other video source devices with RCA or S-Video interfaces to your PC or Mac synchronously.
  • Convert analog RCA/S-Video audio and video signal input to high-definition 1080P/30fps USB-A/USB-C output, digitize and save your good memories with your friends and family on your computer, share with your friends and family, leaving precious memories
  • Plug and play, easy to operate, just connect the RCA or S-Video interface of your video recorder to the USB-A/USB-C interface of your computer or notebook and it can be used without any driver. Note: It needs to be used with the acquisition software
  • Compatible with USB-A/USB-C interfaces, not limited by computer interfaces, compatible with Windows and Mac OS, supports NTSC, PAL and other video formats, and supports brightness, contrast, hue and saturation control
  • Note: This video converter needs to be used with capture software, which can be downloaded free of chargge . We recommend OBS Studio or PotPlayer for Windows and QuickTime Player for Mac. Please feel free to contact us if you need technical support.
function onVideoFrame(now, metadata) {
  if (video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
    ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
  }
  // metadata includes information about this presented video frame.
  video.requestVideoFrameCallback(onVideoFrame);
}

if ("requestVideoFrameCallback" in HTMLVideoElement.prototype) {
  video.requestVideoFrameCallback(onVideoFrame);
} else {
  // Use a fallback selected for the browsers your application supports.
}

The callback receives a high-resolution timestamp and frame metadata. MDN describes requestVideoFrameCallback() as running when a new video frame is sent to the compositor. Its cadence is bounded by the lower of the video frame rate and browser paint refresh rate; it may run a vertical synchronization late, so it is not a hard real-time guarantee. Feature-detect it rather than assuming every browser version has it. MDN labels the API Baseline 2024—available on the latest devices and browser versions since October 2024—while noting that older versions or devices may not support it. Details: MDN requestVideoFrameCallback().

If a fallback based on requestAnimationFrame() is suitable, it can draw on display refreshes, but it is not inherently synchronized to each distinct video frame. Avoid using a fixed interval as if it guaranteed frame accuracy.

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

Choose the right frame-capture path

Need Approach Important trade-off
One still from the frame currently displayed Call drawImage(video, ...) when current frame data is ready. Simple; depends on media readiness.
A still at a chosen time Set currentTime, wait for seeking and available frame data, then draw. Seeking and readiness need handling.
Repeated frame-triggered work Draw inside requestVideoFrameCallback(). Frame-oriented but not perfectly synchronized; older environments may lack support.
Advanced decoded-frame processing Use WebCodecs VideoFrame with a canvas rendering method. More involved; Canvas 2D behavior and performance can vary by browser.

For WebCodecs background and usage guidance, consult MDN’s Using the WebCodecs API and VideoFrame references.

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.

Export the canvas image

Once the frame has been drawn, use canvas.toBlob() to encode it as an image without building a large data URL string. The browser may choose a fallback format if it does not support the requested type.

function canvasToBlob(canvas, type = "image/png", quality) {
  return new Promise((resolve, reject) => {
    canvas.toBlob(blob => {
      if (blob) resolve(blob);
      else reject(new Error("Canvas image encoding failed."));
    }, type, quality);
  });
}

const blob = await canvasToBlob(canvas, "image/jpeg", 0.9);
const imageUrl = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = imageUrl;
link.download = "video-frame.jpg";
link.click();
URL.revokeObjectURL(imageUrl);

Use PNG for lossless output or when transparency matters; JPEG is lossy. If the video is cross-origin, the server must permit the relevant cross-origin access and the video must be configured for CORS before loading if you intend to export pixels. Otherwise, drawing may be possible while reading or exporting canvas pixels is blocked by browser security protections. Set the video’s crossOrigin property before assigning its source and configure the media server’s CORS response appropriately.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot blank captures and timing errors

  • The canvas is blank: confirm metadata loaded, dimensions are nonzero, and readyState >= HTMLMediaElement.HAVE_CURRENT_DATA. Draw after loadeddata for an initial frame or after the seek and frame readiness for a timestamp capture.
  • The image is stretched or blurry: check that canvas backing dimensions reflect the intended output and that destination width and height preserve the source aspect ratio. Increasing CSS display size alone does not increase canvas resolution.
  • A seek callback never resolves: check that the requested time is within the finite duration, listen for media errors, and provide a timeout. Live streams may have an unknown duration or a moving seekable range; a timestamp outside the currently seekable range cannot be captured by simply assigning it.
  • Two captures return the wrong frame: overlapping seeks can race. Serialize them or cancel the previous pending listener when replacing a request, then draw only after the completed seek’s data is ready.
  • Export throws a security error: the canvas may be tainted by a cross-origin video. Configure CORS on both the element request and the media server before drawing; JavaScript cannot bypass the browser’s origin policy after the fact.
  • requestVideoFrameCallback is undefined: feature-detect it and use a fallback only if its timing behavior meets your needs. The callback API is not available in all older browser environments.
  • drawImage() rejects or draws nothing: verify the video has decoded usable current data, not merely that a source URL was assigned. A failed network request, unsupported codec, or unready frame must be fixed before drawing.

Or skip the browser setup

If what you need is a screenshot of the webpage containing a video—not a frame at a chosen playback time—ScreenshotNeo can capture the page through a single request. It does not replace seeking an HTML video element to extract a particular frame. Its website screenshot API removes cookie banners, newsletter popups, and chat widgets before capture; failed loads, bot checks, blank pages, and cache hits are not billed. It also provides an MCP server so AI agents can request screenshots.

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

cURL example (see the ScreenshotNeo API documentation):

Best Value
ClearClick Video to Digital Converter 2.0 (Second Generation) - Record Video from VCR's, VHS Tapes, AV, RCA, Hi8, Camcorder, DVD, Gaming Systems [Requires Working VCR/Camcorder & Tapes]
  • Convert Your Old Video Tapes or Camcorder Tapes to Digital Format With The Touch of a Button (Recording Resolution: SD 640x480 or 720x480 Pixels. Does Not Upscale To HD. Does Not Record From Modern HDMI Sources.)
  • Record and Digitalize Video From VHS, VCR's, DVD Players, DVR's, Camcorders, Hi8, & Retro Gaming Systems (IMPORTANT: A WORKING VCR/CAMCORDER AND WORKING VIDEO TAPES ARE REQUIRED; CONVERTER DOES NOT PLAY VIDEO TAPES BY ITSELF)
  • No Computer or Software Required - Just Hook It Up & Start Recording - Records Videos Directly Onto USB Flash Drive or SD Card (REQUIRED, NOT INCLUDED; 512 GB or less)
  • What's New In The Video2Digital Version 2.0 (Second Generation): Extra-Large 3.5" Preview Screen, Better Recording Quality, Improved Audio/Video Sync Protection, Auto Stop Feature (60, 90, 120, 150 Minutes), Mobile-Friendly MP4 Recording Format, & Pause/Resume While Recording
  • Includes 1-Year Wty & Tech Support from ClearClick, a USA Small Business
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

Free includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.

Frequently Asked Questions

Can I capture a frame from a video before it plays?

Yes, once the browser has loaded and decoded current frame data. Wait for media readiness rather than assuming that assigning a source URL makes a drawable frame immediately available.

Does requestVideoFrameCallback work in every browser?

No. MDN identifies it as Baseline 2024 for latest devices and browser versions since October 2024, but older versions and devices may not support it; feature-detect before use.

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

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.