VideoFlowcodeGitHubStudioTry itCoreRenderersReact Video EditorPlaygroundExamplesDocscodeGitHubStudioTry it
← Back to Blog

Resolution-Agnostic Video: Why em Units and Normalized Coordinates Matter

October 31, 2026 · By VideoFlowLearn how VideoFlow uses em units and normalized coordinates to enable resolution-agnostic video authoring that scales perfectly from 720p to 4K.Resolution-Agnostic Video: Why em Units and Normalized Coordinates Matter

Resolution-Agnostic Video: Why em Units and Normalized Coordinates Matter

Building a video pipeline that works at scale often hits a frustrating wall: the resize. You've spent hours perfecting a layout for a 1080p social media post, only to be told it needs to render in 4K for a high-res display, or in 720p for a low-bandwidth preview. In traditional frame-based or pixel-based systems, this usually means recalculating every position, every font size, and every stroke width manually.

At VideoFlow, we treated resolution independence as a first-class requirement from day one. By moving away from absolute pixels and toward a system of normalized coordinates and em units, we've made it possible to write your video logic once and render it anywhere—from a browser tab to a high-performance server node—without changing a single line of code.

A technical diagram of normalized coordinates in VideoFlow

The Problem with Pixels

Pixels are brittle. If you position a title at x: 960, y: 540, it’s centered on a 1080p canvas. But on a 4K canvas, that same title is suddenly stuck in the top-left quadrant. The same applies to font sizes: a 48px font looks great on a small preview but becomes tiny on a high-resolution export.

Most developers try to solve this with math helpers: width / 2 or height * 0.1. While this works, it pollutes your builder logic with boilerplate and makes the code harder to read. VideoFlow abstracts this away into two core concepts: Normalized Positioning and Relative Sizing.

Normalized Coordinates: 0 to 1

In VideoFlow, the canvas is always a unit square from 0 to 1.

  • [0, 0] is the top-left.
  • [0.5, 0.5] is the exact center.
  • [1, 1] is the bottom-right.

When you add a layer, you specify its position using these fractions. Whether your project is 720p, 1080p, or 4K, [0.5, 0.5] will always be the center. This makes core concepts like layout and alignment predictable regardless of the output resolution.

const title = $.addText({
  text: 'Resolution Independent',
  position: [0.5, 0.4], // 40% from the top, centered horizontally
  color: '#fff',
});

The Power of em Units

For sizing, we took inspiration from the web. In VideoFlow, 1em is defined as 1% of the project width.

If your project width is 1920px, 1em is 19.2px. If you scale that project to 3840px (4K), 1em automatically becomes 38.4px. This means that if you set a fontSize to 6, your text will always occupy 6% of the screen width, maintaining the same visual weight across every resolution.

Scaling the same layout across multiple resolutions

This isn't just for text. Shape widths, heights, and even effect parameters like blur radius can use these relative units. It ensures that a "subtle blur" at 720p remains a "subtle blur" at 4K.

const $ = new VideoFlow({ width: 1920, height: 1080 });

// This card will always take up 60% of the width and 30% of the height
// relative to the project width, no matter the final render resolution.
const card = $.addShape(
  {
    width: 60, 
    height: 30, 
    fill: '#FF5A1F',
    position: [0.5, 0.5],
  },
  { shapeType: 'rectangle' }
);

One Source, Three Renderers

This resolution-agnostic approach is what enables the VideoFlow multi-renderer strategy. Because the scene is described in relative terms, the same VideoJSON can be interpreted perfectly by:

  1. @videoflow/renderer-dom: For a 60fps live preview in your dashboard.
  2. @videoflow/renderer-browser: For zero-cost MP4 exports directly in the user's browser.
  3. @videoflow/renderer-server: For high-volume headless rendering in a Node.js environment.

When you scrub through a video in our Playground, you are seeing the DOM renderer in action. When you hit export, the browser renderer takes that exact same JSON and produces a bit-perfect MP4. This consistency is only possible because we've decoupled the design from the pixel grid.

Building for the Future of Automated Video

As we move toward more automated content pipelines—where AI agents speak VideoJSON—having a predictable, resolution-independent unit system is critical. It allows agents to compose complex scenes without needing to know the final technical constraints of the delivery platform.

If you're tired of fighting with coordinate math and brittle layouts, give the VideoFlow builder a try. You can start building today by visiting our GitHub repository or diving into the Getting Started guide.

Happy rendering!

VideoFlow

Open-source toolkit for composing videos from code.

Product

CoreRenderersReact Video EditorPlaygroundStudio

Learn

DocsAPI referenceExamplesvs. Remotionvs. FFmpeg

Project

GitHubLicenseContactTermsPrivacy

From the blog

All posts →How to Add a Professional Video Editor to Your SaaS in 10 Lines of CodeBeyond the Shell: Why Your Video Pipeline Should Be a TypeScript APICinematic Code: How to Stack and Animate GLSL Effects in VideoFlowDynamic HUDs and Overlays: Mastering Layer Groups in VideoFlowBeyond the MP4: Exporting Editable NLE Projects with VideoFlowVideo Rendering Without FFmpeg: Inside the VideoFlow Server EngineVisualizing Git History: How to Build a Repository Timeline with VideoFlowHeadless Video as a Service: Building a Scalable Rendering API with Node.js
© 2026 VideoFlow. Apache-2.0 core.