H.264
Also known as: AVC, MPEG-4 Part 10
What Is H.264?
H.264 is a video compression standard from the Joint Video Team, where ITU-T’s Video Coding Experts Group and ISO/IEC’s MPEG worked side by side, and its first version was finished in May 2003. Both bodies publish the same text under their own names, and ITU still releases new editions.
The encoder splits each frame into macroblocks of 16 × 16 pixels, predicts each one from nearby blocks or from frames it has already coded, and stores only the difference. For motion, a macroblock can be cut into partitions as small as 4 × 4 pixels, so a moving edge gets small blocks while a still background keeps large ones. The video compression page walks through the steps.
Every major browser can play H.264 with AAC sound in an MP4, though Firefox relies on the operating system’s codecs for it, and many platforms have hardware that decodes and encodes it. That reach is why YouTube’s upload settings ask for it and Apple’s HLS spec keeps H.264 versions of a stream next to the newer codecs.
| Where the name comes from | |
|---|---|
| H.264 | ITU-T, which publishes it as Recommendation H.264 |
| MPEG-4 Part 10 | ISO/IEC, which publishes it as part 10 of the MPEG-4 standards |
| AVC | Short for Advanced Video Coding, the title both bodies give it |
| avc1 | The code an MP4 file stores to mark its video track as H.264 |
What Are the H.264 Profiles?
A profile names the coding tools an encoder may use, so a decoder knows in advance what it has to handle. CE.SDK’s web export takes the three below, and the choice trades file size against how old a player can still open the file.
Baseline leaves out B-frames and CABAC
Built for video calls and mobile, Baseline skips B-frames, which borrow from frames on both sides, and CABAC, the more efficient of H.264’s two ways to pack the coded data. Files come out larger for the same picture, but the simplest decoders play them. Constrained Baseline, the version WebRTC browsers must implement, keeps only the tools that Baseline, Main and High share.
Main adds B-frames and CABAC
With both tools back, Main fits the same picture into fewer bits than Baseline. It carries standard-definition TV broadcasts in some regions, and it is the profile a CE.SDK export uses unless your app sets another one.
High adds 8 × 8 transform blocks
High came with the Fidelity Range Extensions, finished in 2004, and lets the encoder transform 8 × 8 blocks as well as 4 × 4 ones. It is the profile of Blu-ray discs and HD broadcasts, the one YouTube’s upload settings and Apple’s HLS spec ask for, and the one CE.SDK’s docs list for the best compression.
What Does an H.264 Level Limit?
A level caps how much work a decoder has to keep up with: how large each frame may be, how many frames per second it decodes at that size and how high the bitrate may go. The standard defines levels from 1 to 6.2. Apple’s HLS spec adds a caution: a device that supports a level may still not handle the highest bitrate that level allows.
Level 4.1
Apple's ceiling for some HLS versions
kept for the widest range of devices
Level 5.2
CE.SDK's default level
also the highest level Apple allows in HLS
How Do You Read an H.264 Codec String?
A codec string such as avc1.640028 packs the profile, the constraint flags and the level into six hex digits after the dot, two for each, in the form RFC 6381 sets out. HLS playlists list their video this way, and the WebCodecs API takes the same string when an app asks what a browser can decode or encode. In decimal, the profile byte is the number CE.SDK’s export settings take for the profile, such as 100 for High.
Decode an H.264 codec string
Type or paste one, or pick a string from the support check on this page.
- Profile
- Main 4D is 77
- Flags
- None set 00 is 00000000 in binary
- Level
- 5.2 34 is 52
avc1.4D0034: Main profile, level 5.2.
Which H.264 Profile Should You Use?
The destination decides the profile, and some jobs need another codec altogether. A language-learning app, for example, might run its live tutoring calls on Constrained Baseline and export the lesson recaps it posts to YouTube at the High profile.
| Use | Why | |
|---|---|---|
| Video calls in the browser | Constrained Baseline | The IETF requires every WebRTC browser to implement it, along with VP8 |
| The oldest and simplest players | Baseline | It needs fewer decoding tools than Main or High, and CE.SDK's docs call it the most compatible |
| Video for the web and your app | Main, CE.SDK's default | CE.SDK's docs describe it as balanced between quality and how widely it plays |
| YouTube uploads and HLS streams | High | YouTube's upload settings ask for it, and Apple's HLS spec prefers it to Main and Baseline |
| HLS versions for older devices | High at level 4.1 or lower | Apple asks for it in some versions of each stream, so the most devices can play one |
| Video with see-through areas | VP8 or VP9 in WebM instead | H.264 has no alpha channel, so the clear areas come out black |
| A browser with no H.264 encoder | WebM with VP8, VP9 or AV1 instead | A few open-source Linux browsers ship without one, and CE.SDK's MP4 export fails in them |
How H.264 Works in CE.SDK
CE.SDK’s video editor imports H.264 from MP4 and MOV files and exports it on Web, iOS, Android and Server. Unless your app picks H.265, every MP4 export uses H.264, starting from the Main profile at level 5.2.
Each export can set its own. h264Profile takes 66 for Baseline, 77 for Main and 100 for High, and h264Level takes the level times ten, so level 4.1 is 41. Together they cap the bitrate the export may reach. For YouTube or an HLS stream, check for an encoder first and set the High profile, as in the code.
await engine.editor.checkCapabilities();
const h264 =
engine.editor.getCapabilityState('h264Encode') === 'supported';
// No H.264 encoder (some Linux builds): export WebM.
const blob = h264
? await engine.block.exportVideo(page, {
mimeType: 'video/mp4',
h264Profile: 100, // High, as YouTube and Apple ask
videoBitrate: 'Auto'
})
: await engine.block.exportVideo(page, {
mimeType: 'video/webm'
}); Transparent areas come out black
H.264 has no transparency, so an MP4 export fills every clear area of the page with black. For a video with a see-through background, export VP8 or VP9 in WebM with exportAlpha on iOS, macOS, Android or a server running @cesdk/node-native, since the browser can’t encode the transparency. The VP9 page shows the steps.
Some encoders stop at 4096 × 2304
On Windows, and on Linux without the licensed codec pack, the video encoder takes at most 36,864 macroblocks of 16 × 16 pixels per frame, such as 4096 × 2304, and on Windows each side needs at least 48 pixels. A frame outside those limits fails the export, so keep targetWidth and targetHeight inside them there.
Some browsers can’t write H.264
Which H.264 profiles does your browser decode, and which does it encode?
In the browser, an H.264 export can only use a profile the browser’s encoder takes, and the audio encoders decide whether the MP4 carries AAC or Opus sound.
| Codec | Decodes | Encodes |
|---|---|---|
| H.264 Baseline | Not checked Checking Yes No | Not checked Checking Yes No |
| H.264 Main | Not checked Checking Yes No | Not checked Checking Yes No |
| H.264 High | Not checked Checking Yes No | Not checked Checking Yes No |
| AAC audio | Not checked Checking Yes No | Not checked Checking Yes No |
| Opus audio | Not checked Checking Yes No | Not checked Checking Yes No |
Decoding opens and plays a file. Encoding writes one, as an export does.
The check asks about 1080p video at 30 fps through WebCodecs, the API
CE.SDK's web export encodes with. In your app, go by CE.SDK's own checkCapabilities() result. Mobile browsers may report codecs here, but CE.SDK doesn't support
video editing in them.
FAQs
No. H.264 is the codec that compresses the picture, and MP4 is the container that carries the H.264 track next to the audio track and some metadata. An MP4 can hold H.265 or AV1 video instead, and H.264 also goes into MOV files, but not into WebM.
YouTube recommends uploading H.264 at the High profile in an MP4 file, with two B-frames in a row, CABAC, a variable bitrate and a closed group of pictures (GOP) half a second long, 15 frames at 30 fps. For 1080p at 30 fps it suggests 8 Mbps, the same rate CE.SDK's Auto bitrate mode picks.
Not by itself. A higher profile gives the encoder more tools, so it can keep more detail at an equal bitrate, but the bitrate still decides the amount of data per second. CE.SDK's docs rate High as the best compression and Baseline as the most compatible.
Pick H.264 when the video must open on devices you don't control. H.265 targets the quality of H.264 with half the bitrate, but it needs a decoder on the viewer's device and system, and CE.SDK can export it only on platforms that have an encoder.
Links
Documentation and references for this concept.
Video Editor SDK
Let your users edit video in your app and export H.264 MP4 at the profile your app picks.
Export to MP4
Set the H.264 profile, level and bitrate of an MP4 export.
File format support
Check which containers bring H.264 video into CE.SDK on each platform.
Related Terms
H.264 vs H.265
Two generations of the same family of video standards. H.265, also called HEVC, aims for the picture of H.264 at half th…
Video Codec
The software or hardware that compresses video into a compact stream and decodes it again for playback, as H.264, H.265,…
Bitrate
How much data a video or audio stream holds per second, given in kbps or Mbps. An encoder treats it as a target that tra…



