HTML video comes down to the video tag, its 7 attributes, an H.264 MP4 with a WebM fallback and muted autoplay, which Chrome always allows. ReelSDK makes the MP4 itself for $0.03 per output minute; HyperFrames turns HTML into one on Node 22.
How to code a video in HTML
Add a <video> element with src and controls, then tune it with 6 more attributes such as poster and preload, whose 3 values decide how much loads early. ReelSDK goes the other way: JSON in, MP4 out.
LearnUpdated
At a glance
HTML video attributes worth knowing
Add only the ones you need.
| Attribute | What it does |
|---|---|
controls | Shows the browser's playback controls. |
autoplay | Requests playback without the viewer pressing play, subject to browser rules. |
muted | Starts the video with its audio muted. |
loop | Starts the video again when it reaches the end. |
playsinline | Requests playback within the page rather than switching to fullscreen. |
poster | Sets an image to show before playback starts. |
preload | Hints how much to load ahead of playback: none, metadata, or auto. |
Source: MDN: the video element, checked November 2026.
The basic video tag
To put a video file on your page, use the HTML <video> element: <video controls src="video.mp4"></video> is a complete embed.
The src points to your video file, and controls asks the browser to show its playback controls. You don't need to build a player interface to let someone play or pause the video.
The distinction worth making here is between playing a video and creating one. This tag plays an existing file on a page; it doesn't turn your page, its styles, or its animations into a video file. If you're trying to export HTML as an MP4, you'll need a renderer instead. The last section covers that route.
For an embed, start with the tag above and add the attributes you need, rather than copying a player configuration with every option switched on.
<video controls src="video.mp4"></video>Attributes that matter
Video attributes control playback, the browser's player interface, and what appears before playback starts. Most of the ones below are switches: include the attribute to enable that behavior. poster and preload take values.
The code box shows an embed with a poster image and a preload hint.
With preload="none", you're asking the browser not to preload the video. metadata asks for information about the file rather than the whole video, while auto lets the browser preload more of it. These are hints, not download guarantees.
Want the video to repeat? Add loop. Want the viewer to choose when playback starts? Keep controls and leave out autoplay. You can choose these behaviors separately; adding a poster doesn't require autoplay, and looping doesn't require hiding the controls.
<video
controls
src="video.mp4"
poster="poster.jpg"
preload="metadata"
></video>Formats and fallbacks
H.264 video in an MP4 file is the safe default. You can point src at that file, as in the basic example, or use nested <source> elements to offer alternatives.
The browser tries those sources in order and plays the first format it supports, as in the code box.
In this example, the WebM file would contain VP9 video, and the MP4 file would contain H.264 video. You can also offer AV1 as an extra source.
Keep the order intentional. If you put the MP4 first and the browser supports it, it'll use that file rather than continue looking for another format.
The text inside the element is fallback content for a browser that doesn't support HTML video. It isn't another video source.
<video controls>
<source src="video.webm" type="video/webm">
<source src="video.mp4" type="video/mp4">
Your browser doesn't support HTML video.
</video>Autoplay rules
Adding autoplay requests automatic playback. It doesn't override the browser's playback rules.
Browsers allow autoplay when the video is muted, and Chrome always allows muted autoplay. For a muted video that should start on its own, combine autoplay, muted and playsinline, as in the code box.
But don't treat autoplay as permission to start audio. Keep muted in the markup when you're relying on muted autoplay, and leave controls available if you want the viewer to manage playback.
playsinline is separate from autoplay (it concerns where playback happens). Include it when you want the video to play within the page rather than switch to fullscreen.
<video
autoplay
muted
playsinline
controls
src="video.mp4"
></video>Turning HTML into an MP4
If your goal is a downloadable MP4 made from HTML or code, the <video> element isn't the tool for that job. You need a rendering tool that produces the file, then you can embed that output with the same video markup shown above.
The options use different inputs and licenses. Remotion uses React and is source-available. HyperFrames by HeyGen uses HTML, is licensed under Apache 2.0, and needs Node 22 and FFmpeg; it renders in headless Chrome.
Revideo uses TypeScript and is MIT-licensed. Motion Canvas also uses TypeScript and is MIT-licensed. Don't assume that choosing a code-based renderer means you can hand it an existing HTML page unchanged: check the input it expects.
If you'd rather send a request than run headless Chrome yourself, ReelSDK takes JSON and returns an MP4. Captions and slideshows cost $0.03 per output minute as of November 2026. That's a JSON-to-video route, rather than an HTML page passed directly into a renderer.
FAQ
Questions, answered
Can I add a video without JavaScript?
Yes. <video controls src="video.mp4"></video> embeds an existing video and provides the browser's playback controls without JavaScript.
What video format should I use?
H.264 in an MP4 file is the safe default. You can add WebM with VP9 or AV1 as an extra source.
Why won't my video autoplay?
Check whether it's muted. Autoplay is subject to browser rules, and Chrome always allows muted autoplay.
Does the video tag convert HTML into an MP4?
No. It plays an existing video file; creating an MP4 from HTML or code requires a renderer.
- How to make a video with code?Make a video with code: React with Remotion, TypeScript with Motion Canvas or Revideo, Python with MoviePy or Manim, or ffmpeg commands.
- What is a rendering API?What a rendering API does: send a JSON or code description, get an MP4 back. What you send, who renders it, and what it costs per minute.
- How do I use ffmpeg?Install ffmpeg on macOS, Windows or Ubuntu, learn the order a command follows, and copy 6 everyday commands, or run it online.
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
