// blog

Count the Cars and People in Any YouTube Video, Free, in Your Browser

You can count the traffic in a YouTube video for free with Passerby, a working example on aiwebcenter.com. Paste the video’s link, press Start counting and share the tab when your browser asks. An object detection model running in your own browser marks every car, truck, bus, motorcycle, bicycle and pedestrian in the video and counts each one as it crosses a line you choose, by direction, with counts per 1, 5 or 15 minutes and a spreadsheet download. It works on a computer, best in Chrome or Edge; nothing is downloaded from YouTube or uploaded anywhere, and the counts are estimates.

Last updated 4 min read

YouTube is full of street scenes: live cameras on busy intersections, walking tours of city centers, dashcam drives, the footage you filmed outside your own shop and uploaded last week.

Now you can count what’s in them.

Count a YouTube video →

How to use it

  1. Open Passerby for YouTube on a computer.
  2. On YouTube, press Share under the video and copy the link. Paste it into the box and press Load. Live streams and Shorts work too, and a link with a start time (?t=90) starts there.
  3. Press Start counting. Your browser asks what to share: choose this tab.
  4. Watch. Every vehicle, cyclist and pedestrian gets a colored box, and each one is counted once when it crosses the dashed yellow line, in the direction it was going.

You’ll see the video twice. The first copy is YouTube’s own player: that’s where you play, pause, skip and pick the quality. The second is Passerby’s copy of it, with the boxes and the counting line drawn on top. It follows the player, so keep controlling the video in YouTube’s player.

The counts work exactly as on the live Caltrans cameras:

  • Pedestrians, bicycles, motorcycles and vehicles, each split by direction
  • An hourly rate once you’ve counted for a minute
  • Counts per 1, 5 or 15 minutes, as a chart and a table, with a Download CSV button
  • A counting line across the picture, top to bottom, or drawn yourself with two clicks, plus an optional pedestrian line across a crosswalk or sidewalk

Things worth trying

  • A live street camera. Search YouTube for a live camera on a busy square or intersection in a city you know, and count the people crossing it at lunchtime against the evening.
  • A city walking tour. Walking videos pass shop after shop. Draw the pedestrian line across the sidewalk and see which stretch of street is busiest.
  • Your own footage. Filmed your shop’s street for a few minutes and put it on YouTube, even as an unlisted video? Paste the link and count it. (A file on your computer works without YouTube: use Try your own video on the main page.)
  • Before and after. Count the same live camera at the same hour on two days, and compare the CSVs.

Turn the player’s quality up (the gear icon) for the best counts: in a sharper picture, distant cars and pedestrians are bigger, and more of them get found.

Why you’re asked to share the tab

A web page isn’t allowed to look inside a video player from another website. That’s a browser safety rule, and a good one: it’s the same rule that stops a random site from reading your email in a hidden frame.

So Passerby asks you to share the tab, the same way you’d share your screen in a video call. In Chrome and Edge, it then keeps only the player’s part of the picture and counts that. Nothing is downloaded from YouTube, nothing is recorded, and the picture never leaves your computer. Stop sharing from the browser’s bar at any time.

Honest limits

  • A computer is needed for live counting. Phone and tablet browsers don’t let a page share the screen. On a phone, screen-record the YouTube video instead, then press Count a video from your phone on the same page and pick the recording: it’s counted right there and never uploaded.
  • Chrome or Edge works best. Other browsers share the whole window or screen instead of just the player, which works but counts whatever else is on it, so draw the counting line over the road.
  • Keep the player in view and playing. Only what’s on screen is shared. Pause, and the count pauses with it.
  • Some videos won’t play outside YouTube: their owners have turned embedding off.
  • The counts are estimates. Low-quality video, night, rain, crowds and cars that overlap all lower the count. The total is more reliable than the split between cars and pickups.
  • Boxes can trail a moment behind. On the Caltrans cameras Passerby holds the picture back so the boxes land exactly on what they mark. A shared tab is live and can’t be held back, so a box can lag a fraction of a second behind a fast car. The counts aren’t affected.

Why I built it

Passerby is a working example of a footfall and traffic research tool. Counting a YouTube video shows the same thing as the Caltrans cameras, on almost any street in the world: the counting doesn’t care where the picture comes from. Pointed at a store entrance, a mall concourse or the street outside a billboard, it tells a business how many people and cars actually pass.

Want counts like these for your own location, or a tool like this on your own site? Tell me what you’d like to count.