Tool

H.264 & HEVC Level Calculator

Enter a resolution and fps and the tool finds the minimum level required from the spec tables, along with the number of reference frames you can use at that level. The calculation happens only inside this browser, and nothing is uploaded.

Resolution

Size used in the calculation 1920×1088 (8,160 macroblocks/frame)

Minimum level required: 4

At this level, the maximum fps for this resolution is 30, with up to 4 reference frames. Your 4 reference frames also fit at this level.

ffmpeg -i input.mp4 -c:v libx264 -level 4 -crf 20 -preset medium -c:a copy output.mp4
# x264 directly: x264 --level 4 --ref 4 ...

This only checks the frame-size and per-second throughput limits. Check the bitrate limit in the table below.

LevelFitsMax fpsMax refsMax kbps
1No––64
1.1No––192
1.2No––384
1.3No––768
2No––2,000
2.1No––4,000
2.2No––4,000
3No––10,000
3.1No––14,000
3.2No––20,000
4Yes30420,000
4.1Yes30450,000
4.2Yes64450,000
5Yes7213135,000
5.1Yes12016240,000
5.2Yes25416240,000
6Yes51216240,000
6.1Yes102416480,000
6.2Yes204816800,000

Max kbps is for the Baseline, Main and Extended profiles; the High profile is 1.25 times this value.

What is a level?

A level is a bundle of upper limits set by the codec spec: ‘a decoder must be able to handle at least this much.’ If you know which level a video requires, you can expect it to play on devices that support that level or higher. There are three main kinds of limits.

  • Frame size: H.264 limits the number of macroblocks (16×16) per frame, and HEVC limits the number of luma samples per frame.
  • Throughput per second: the upper limit on frame size multiplied by fps. Even at the same resolution, a higher fps can require a level one step higher.
  • Bitrate and DPB: the upper limit on bits per second, and the size of the picture buffer (DPB) the decoder keeps. The larger the resolution, the fewer frames fit in the same buffer, so the reference frame limit goes down.

How do I use the result?

  • Encode with a set level: as in the ffmpeg command under the result, you can set the level with -level for x264 and with -x265-params level-idc=... for x265. This is for re-encoding to match the level a device supports when a video won’t play on an older TV or set-top box.
  • Choosing --ref: even at the same level, a larger resolution lowers the reference frame limit. Using a --ref larger than the table’s ‘Max refs’ goes outside the spec, so you need to raise the level or lower --ref.
  • Combinations like 4K 60fps: pick a resolution and fps, and the first row in the table where ‘Fits’ becomes ‘Yes’ is the minimum level. For example, you can see boundaries at a glance, such as H.264 at 1080p being level 4.1 up to 30fps and needing 4.2 from 60fps.
  • Checking a file you already have: the level inside a file’s codec string (such as avc1.640028) can be decoded with the codec string decoder, and the level you need when converting can be checked along with the rest in the HEVC/AV1 to H.264 conversion planner.

How it is calculated

  • H.264: width and height are rounded up to multiples of 16 to get the macroblock count. A level passes if the count is at most the level’s MaxFS and macroblocks × fps is at most MaxMBPS. Max reference frames is min(⌊MaxDpbMbs ÷ macroblock count⌋, 16).
  • HEVC: width and height are rounded up to multiples of 8 to get the luma sample count. A level passes if the count is at most MaxLumaPs and samples × fps is at most MaxLumaSr. The DPB size comes from the spec’s maxDpbPicBuf=6 rule, and the table shows that value minus the one picture being decoded as the max reference frames.
  • The constants are the values in H.264 Table A-1 and H.265 Tables A.6, A.8 and A.7. This is a spec calculation and has nothing to do with this site’s measured data.

Limits worth knowing

  • This tool only calculates the upper limits the spec allows. Which level a real TV, set-top box or phone plays differs from device to device, so confirm it from the manufacturer’s specs or by testing playback yourself. Even if the level matches, the video won’t play if the profile (High, Main 10 and so on) isn’t supported.
  • The bitrate limit column is the value for a representative profile, and the multiplier differs for other profiles. It doesn’t check VBV settings (maxrate and bufsize).
  • It doesn’t account for interlacing, variable resolution or special H.264 constraints such as frame cropping. Width and height are rounded up exactly as you enter them, not as the coded size before cropping.
  • The HEVC reference frame count is a simple upper bound, the DPB size minus one, and real encoders use fewer depending on the GOP structure. The effect on quality and file size isn’t measured here. For measurements by preset and CRF, see our measurements.