If you cut a 9:16 picture out of a 16:9 video, at the same height, you keep about 32% of the image. Two thirds are gone. So the real question is: who chooses which third to keep?
Vertix is my answer: a virtual camera operator inside a browser tab. It takes a 16:9 video and turns it into a 9:16 video while it plays, with no server and no upload.
I worked as an audio and video technician before moving into software, and I have always loved the client side of streaming. This project started because I wanted to see how far the browser can go.
Live demo: https://pzanella.github.io/vertix/
Code: https://github.com/pzanella/vertix (Apache 2.0)

Left: centre crop. Right: Vertix (real output, Pexels sample clip).
Three rules
For this project I gave myself three rules:
- Zero servers. All the logic lives in the browser tab. Once the page is loaded, it even works without a connection, with a local video file.
- Real time, or almost. Vertix works while the video is playing, next to any player (Shaka Player, hls.js or a simple
<video>). It never touchesplay(),srcorcurrentTime: it reads the frames withrequestVideoFrameCallbackand draws them on a canvas. - Measure on real devices, and let the numbers guide the project. I tested on a laptop (Mac, 10 cores, Chrome) and on a mid-range phone, a Nothing Phone 3a.
Making a video vertical is not a new idea. Google's AutoFlip (2020) does it, and it is not the only one. AutoFlip also detects scene changes, looks at the whole scene before deciding, and chooses a fixed or moving camera for each shot, so some of my steps below are similar. What I wanted to try is to do all of this live, in the browser, with a small model, even on a phone.
To measure, I built a benchmark mode in the demo page. It plays all the sample clips, runs the tests, and at the end you can download a file with the results. Every step below started from the problem of the step before, and every step was checked with this benchmark.
Step 0: cut the middle
The simplest case of all: take the 16:9 video and keep only the central part. You can see the result on the left of the GIF above: with two people sitting on opposite sides, nobody is really in the crop.
Step 1: find the faces
How do I know if there are people in the picture? I find their faces. About five times per second, a small copy of the frame (320×240) goes to a worker. There, UltraFace runs: a small face detection model (about 1.2 MB), executed with tract in Rust and compiled to WebAssembly. It tells me how many faces there are and where they are. With this information the code acts like a camera operator: it moves inside the scene and frames the people.
The first numbers: about 70 ms per detection on the laptop and about 170 ms on the phone. Not very fast, but important to know. And there was a second problem: with several people, the virtual camera moved too fast and the picture shook.
Step 2: layout
One face: one frame. Two faces: one above the other. Three or more: the person who is speaking, or a grid (this changed later, in step 7). With no face, for example a landscape, I show the whole 16:9 scene with a blurred copy above and below. Against the shaking, the crop now ignores small movements and moves smoothly when it has to.
Step 3: SIMD
With 170 ms per detection, the phone skipped some detections, because the previous one was not finished yet. So I compiled the WebAssembly module with SIMD: instructions that work on several numbers at the same time. Browsers without SIMD get a second build without it. The app checks support at start-up with a tiny test module and downloads only one of the two:
// i32.const 0; i8x16.splat; i8x16.popcnt; drop. // Only validates if the engine supports SIMD (same probe as wasm-feature-detect). const SIMD_PROBE_MODULE = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11, ]); export function isWasmSimdSupported(): boolean { try { return typeof WebAssembly === "object" && WebAssembly.validate(SIMD_PROBE_MODULE); } catch { return false; } } Both builds find exactly the same faces (a script checks it). Only the time changes:
About 2.2 times faster on the phone, 1.5 times on the laptop, and on the phone no more skipped detections (before: 4 to 37 per clip).
Step 4: the double snap
At this point I had faces, a layout and better speed. But I saw a problem when the scene changes. News and sport videos are edited: at the cut, the crop is still the old one, and the new person is not in the picture. Then the crop jumps to her. So the viewer sees two snaps: the cut, and then the jump.
I added a cut detector in the same WebAssembly call. It compares a colour histogram and a small grid of brightness values with the previous frame, and it accepts a cut only if the change is clearly bigger than in the last few frames. A false cut is worse than a missed one, because it resets everything. But detection runs about every 200 ms, so the cut was still found a few frames too late: 2 to 9 frames in my October tests.
Step 5: lookahead
To fix this, I decided to look at the future while I show the past. I added a small delay: about 160 ms on the laptop and 300 ms on the phone. Each frame waits in a small buffer before it is shown. A quick check on every frame finds the cut and starts a detection on that exact frame. So the code works a little ahead of what the viewer sees, and when a frame is shown, its crop is already ready.
The audio has the same delay, so it stays in sync. The audio already goes through Web Audio, so a DelayNode is enough:
this.sourceNode = this.ctx.createMediaElementSource(video); this.analyser = this.ctx.createAnalyser(); this.delay = this.ctx.createDelay(MAX_OUTPUT_DELAY_SEC); this.delay.delayTime.value = this.outputDelay; // same delay as the frame buffer this.sourceNode.connect(this.analyser); this.analyser.connect(this.delay); this.delay.connect(this.gain); this.gain.connect(this.ctx.destination); 
The same cut, slowed down 4 times. Left: lookahead off. Right: lookahead on.
Now the cut is clean. On the 25 fps test clips the crop changes exactly on the cut frame, on the laptop and on the phone. Without lookahead the delay depends on the device: 2 to 9 frames in October, 1 frame in the capture above with the current version. Even one frame is visible. At 50 fps it is not perfect yet: the change can arrive up to 2 frames early or 1 frame late.
Step 6: the tracker, and a face that wasn't there
With a crowd or sports action, Vertix gave everyone a panel: a grid that changed all the time. It was hard to watch. I also tested it on real TV news clips that I can only use on my computer. So I added a tracker to give each face an ID, and a filter for small faces in the background. Then I added new rules for three or more faces: follow one main person, and use the grid only when people sit still.
But the numbers said no.
On a two-person interview that already worked well, the layout changes went from 11 to up to 16. The detector sometimes saw a face that was not there: the hands of the guest near the channel logo, and the hand of the reporter with the microphone. With the new rules, that false face made things worse.
I was disappointed, honestly. I had spent a lot of time on those rules. I also tried a second model (MediaPipe Face Landmarker) to remove the false faces, but there was no good threshold: the false faces got scores up to 0.69, and a real face seen from the side got 0.52 at most.
So I kept the tracker and the filter, and I switched the new rules off. Then I stopped and looked at the problem from a different angle. I asked a new question: what kind of scene is this?
Step 7: shot type
I don't count faces any more: I look at what kind of shot it is. I can tell from the size of the biggest face compared with the frame.
- If it is big (at least a quarter of the frame), it is a close shot: I follow the face.
- If it is small, it is a wide shot, like a crowd or a football pitch: I show the whole scene with the blurred copy above and below. (Safari doesn't support the blur on canvas, so there you see black bands.)
- I use split panes only when people stay still for at least one second, like in an interview or a panel. Then the virtual camera stays still too.
This also worked around the false face. The detector still sees it, but a new pane only appears after a face has been still for one second, and the hands never get one. On the same interview, the layout changes went down from 11 to 7, and the crop in the split screen moves about four times less. AutoFlip also decides by shot type: the idea is not new, but here it all runs in the browser, while the video plays.
These numbers are from my clips, checked by eye. They are not a general accuracy score.
Quality of experience
- The lookahead delay is fine for video on demand, less good for low-latency live.
- On the phone, audio and video stayed within 34 ms of each other in my tests, under the roughly 45 ms where people start to notice.
- The main thread does little work: less than 2 ms per frame. Face detection runs in its own worker, so it doesn't touch the video pipeline.
- The phone drops some frames on its own, even in normal 16:9 without Vertix, and it never played 50 fps clips smoothly. That's why I did the live demo of my talk on a laptop.
Limits
- DRM: with protected video the browser doesn't give me the decrypted frames, so Vertix can't work there.
- The lookahead delay is a problem for low-latency live.
- The whole 16:9 video is downloaded, but only a part of it is shown.
- On the phone this is still heavy work, and you pay for it with battery.
- Vertix only looks at faces. A voice-over or someone speaking off screen is invisible to it.
- The engine (
src/core) works without any framework, but it is not on npm yet.
Some ideas for the future
These are only ideas, not promises:
- An ABR that knows about the crop. Today the player chooses the quality from the size of the screen, but Vertix zooms into a part of the picture.
- Face detection on WebGPU or WebNN, where possible, instead of the CPU.
- The crop area as metadata, for example in the manifest or in a MoQ track, computed during packaging. But this would break my first rule.
- Audio analysed together with the faces, to understand who is speaking by matching each face with its voice.
What I take home
Three things:
- Sometimes the right question lets you see a problem from a different angle.
- A small delay can make the final result better.
- Even if a path looks good on paper, without numbers to support it, it is not a good path.
I presented Vertix at the Milan Video Tech Meetup in November 2026, and this post is the written version of that talk. If you try it, I would love to hear from you: benchmark numbers from your phone (there is a gauge button for that), clips where Vertix gets the shot wrong, or ideas for the next steps. Comments, issues and contributions are all welcome.





