How to use the video tag generator
- Enter the Sources (one URL per line, best format first), for example a WebM file and then an MP4.
- Add a Poster image shown before playback, and the Width and Height in pixels (0 to leave out).
- Tick Controls, Autoplay (adds muted and playsinline), Loop and Muted as needed, and choose Preload.
- Enter a Captions file (WebVTT) and the Captions language code, such as
enorhi. - Copy the code and read the notes.
What it does and when to use it
The video element plays your own files with the browser’s built-in player: no third-party scripts, no tracking and no adverts. It needs a few things to work well everywhere. There should be a source per format with the right MIME type, so the browser can skip files it cannot play without downloading them. A poster gives a still image before playback. Width and height reserve space so the page does not jump. A captions track makes the speech readable.
Use it for product tours, tutorials, hero loops and recorded talks hosted on your own site or a CDN. For a video hosted on YouTube or Vimeo, use their embed code with the iFrame Generator. For sound only, the HTML Audio Tag Generator writes the matching audio element.
How it works
The MIME type comes from each file’s extension: .mp4 and .m4v are video/mp4, .webm is video/webm, .ogv and .ogg are video/ogg, and .mov is video/quicktime. Unknown extensions get no type. The captions label is the language’s English name, worked out from the code with the browser’s Intl.DisplayNames, so hi becomes “Hindi”. The track is marked default so captions are available straight away. A paragraph with a download link to the last source is added for browsers that cannot play any of the files. There is no preview because the URLs are placeholders until you upload your files.
Worked examples
The default product tour:
<video width="1280" height="720" poster="/media/product-tour-poster.jpg" controls preload="metadata">
<source src="/media/product-tour.webm" type="video/webm">
<source src="/media/product-tour.mp4" type="video/mp4">
<track kind="captions" src="/media/product-tour.en.vtt" srclang="en" label="English" default>
A silent hero loop. One MP4, Autoplay and Loop ticked, Controls off, no captions file. The tag becomes <video autoplay loop muted playsinline preload="metadata">, with two notes: muted and playsinline were added, and captions are recommended if the video has speech.
Hindi captions. Captions file /media/tour.hi.vtt with language hi gives a track ending in srclang="hi" label="Hindi" default>.
Limits and tips
- The tool does not convert files. Create the WebM and MP4 versions with a video tool first.
- Compress the poster image with the Image Compressor; it loads even if nobody presses play.
- For several caption languages, copy the
trackline and changesrc,srclangandlabel. Keepdefaulton one track only.
Frequently asked questions
Why will my video not autoplay?
Why list both WebM and MP4?
What is a WebVTT file?
What does preload do?
Should a background video have controls?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.