Log in

View Full Version : Need Help With AVC Levels


dj-big
7th May 2014, 07:47
i read avc level on wikipage and i have some questions example what happen if i encode 1080p video with low size and low bitrate (1500-2000) in level 3.1 , i test it with megui and just i just have some standard error stream in 2 each pass of encoding ( using 2 pass ) i paste it here :



-[Information] [5/5/2014 5:15:38 AM] Process started
-[Information] [5/5/2014 5:15:38 AM] Standard output stream
--[Information] [5/5/2014 6:13:01 AM] avs [info]: AviSynth 2.58, build:Dec 22 2008 [08:46:51]
--[Information] [5/5/2014 6:13:01 AM] avs [info]: Video colorspace: YV12
--[Information] [5/5/2014 6:13:01 AM] avs [info]: Video resolution: 1912x1072
--[Information] [5/5/2014 6:13:01 AM] avs [info]: Video framerate: 24000/1001
--[Information] [5/5/2014 6:13:01 AM] avs [info]: Video framecount: 76358
--[Information] [5/5/2014 6:13:01 AM] avs4x264 [info]: "x264_64" - --level 3.1 --preset slower --pass 2 --bitrate 1524 --stats 24.S02.1080p.WEB-DL.DD5.1.H.264\24.S01E01.1080p.WEBDL.stats
--deblock -1:-1 --keyint 230 --min-keyint 22 --bframes 4 --qpmin 10 --qpmax 51 --vbv-bufsize 17500 --vbv-maxrate 17500 --rc-lookahead 40
//
--merange 24 --psy-rd 1.0:0.05 --no-fast-pskip --colorprim bt709 --transfer bt709 --colormatrix bt709 --sar 1:1 --frames 76358 --fps 24000/1001 --input-res 1912x1072 --input-csp i420
-[Warning] [5/5/2014 5:15:38 AM] Standard error stream
--[Information] [5/5/2014 5:15:42 AM] raw [info]: 1912x1072p 1:1 @ 24000/1001 fps (cfr)
--[Information] [5/5/2014 5:15:42 AM] x264 [info]: using SAR=1/1
--[Warning] [5/5/2014 5:15:42 AM] x264 [warning]: frame MB size (120x67) > level limit (3600)
--[Warning] [5/5/2014 5:15:42 AM] x264 [warning]: DPB size (4 frames, 32160 mbs) > level limit (2 frames, 18000 mbs)
--[Warning] [5/5/2014 5:15:42 AM] x264 [warning]: MB rate (192767) > level limit (108000)
--[Information] [5/5/2014 5:15:42 AM] x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
--[Information] [5/5/2014 5:15:42 AM] x264 [info]: profile High, level 3.1
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: frame I:605 Avg QP:24.18 size: 45145
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: frame P:22957 Avg QP:28.01 size: 14393
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: frame B:52796 Avg QP:30.70 size: 4717
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: consecutive B-frames: 4.0% 7.7% 14.4% 68.0% 5.9%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: mb I I16..4: 41.5% 53.1% 5.4%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: mb P I16..4: 12.5% 8.6% 0.2% P16..4: 39.4% 2.1% 3.5% 0.0% 0.0% skip:33.7%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: mb B I16..4: 0.3% 0.4% 0.0% B16..8: 31.5% 1.1% 0.1% direct: 0.8% skip:65.8% L0:43.3% L1:55.6% BI: 1.1%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: 8x8 transform intra:43.0% inter:84.7%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: direct mvs spatial:97.4% temporal:2.6%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: coded y,uvDC,uvAC intra: 19.8% 27.4% 1.0% inter: 3.9% 3.9% 0.0%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: i16 v,h,dc,p: 34% 21% 11% 34%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 8% 20% 9% 12% 11% 11% 9% 10%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 14% 7% 8% 12% 11% 12% 9% 13%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: i8c dc,h,v,p: 70% 18% 9% 3%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: Weighted P-Frames: Y:0.9% UV:0.4%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: ref P L0: 58.0% 12.3% 29.7% 0.1%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: ref B L0: 88.5% 11.5%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: ref B L1: 96.1% 3.9%
--[Information] [5/5/2014 6:13:01 AM] x264 [info]: kb/s:1524.18
--[Information] [5/5/2014 6:13:01 AM] encoded 76358 frames, 22.20 fps, 1524.18 kb/s
-[Information] [5/5/2014 6:13:02 AM] Final statistics
--[Information] [5/5/2014 6:13:02 AM] Video Bitrate Desired: 1524 kbit/s
--[Information] [5/5/2014 6:13:02 AM] Video Bitrate Obtained (approximate): 1525 kbit/s
-[Information] [5/5/2014 6:13:02 AM] MediaInfo


my question is with this error that happened can it influence the quality ? if i use higher level i get better quality ? is there anything to worry about with this encode ?

LoRd_MuldeR
7th May 2014, 12:09
my question is with this error that happened can it influence the quality ?

Nope. It just tells you that the properties of your video and/or your encoder settings are incompatible with the Level you have requested.

if i use higher level i get better quality ?

Nope. Don't mix up effect and cause!

Using certain encoder settings, like more reference frames, hopefully improves quality. But, at the same time, those settings may also result in requiring a higher Level, e.g. because you run into the DPB limit.

Still, it's not like "using a higher Level" is what results in better quality!

It's more like "having to use a higher Level" now, because you decided to use certain encoder settings that have higher demands on the decoder side, and thus require a higher Level.


Always keep in mind that the Level is nothing but a label that says: A H.264 decoder needs to be at least that "powerful" to properly decode my stream - with higher Levels requiring a more powerful decoder.

Of course you want the lowest Level possible (i.e. the lowest Level that your stream conforms to), so that your stream will be compatible to as many decoders as possible.

But you can't "lie" about the Level, because enforcing a lower Level than what is actually needed will result in playback issues, when a decoder that actually is not capable of playing the stream tries anyway.


Example: More reference frames => requires a bigger DPB size => required DBP size might violate Level limits => might have to use a higher Level

(But keep in mind that the DPB is only one of the many things limited by Levels. There are also limits, e.g., on the macroblock rate, which is a direct consequence of the video's frame rate and the video size)


See here for details:
http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels

is there anything to worry about with this encode ?

Well, if you used the "--level 3.1" command, because you really require a H.264 stream that conforms to Level 3.1, then you probably should be concerned about the fact that the resulting video will not actually be Level 3.1 compliant - as x264 has told you. Otherwise, if you don't require a H.264 stream that conforms to Level 3.1, you don't need to worry and you should just remove the "--level 3.1" command ;)

dj-big
7th May 2014, 15:23
Nope. It just tells you that the properties of your video and/or your encoder settings are incompatible with the Level you have requested.



Nope. Don't mix up effect and cause!

Using certain encoder settings, like more reference frames, hopefully improves quality. But, at the same time, those settings may also result in requiring a higher Level, e.g. because you run into the DPB limit.

Still, it's not like "using a higher Level" is what results in better quality!

It's more like "having to use a higher Level" now, because you decided to use certain encoder settings that have higher demands on the decoder side, and thus require a higher Level.


Always keep in mind that the Level is nothing but a label that says: A H.264 decoder needs to be at least that "powerful" to properly decode my stream - with higher Levels requiring a more powerful decoder.

Of course you want the lowest Level possible (i.e. the lowest Level that your stream conforms to), so that your stream will be compatible to as many decoders as possible.

But you can't "lie" about the Level, because enforcing a lower Level than what is actually needed will result in playback issues, when a decoder that actually is not capable of playing the stream tries anyway.


Example: More reference frames => requires a bigger DPB size => required DBP size might violate Level limits => might have to use a higher Level

(But keep in mind that the DPB is only one of the many things limited by Levels. There are also limits, e.g., on the macroblock rate, which is a direct consequence of the video's frame rate and the video size)


See here for details:
http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels



Well, if you used the "--level 3.1" command, because you really require a H.264 stream that conforms to Level 3.1, then you probably should be concerned about the fact that the resulting video will not actually be Level 3.1 compliant - as x264 has told you. Otherwise, if you don't require a H.264 stream that conforms to Level 3.1, you don't need to worry and you should just remove the "--level 3.1" command ;)

oh thanks for your great help so you mean in this case if i encode 1080p video with high values it just dont compliant with level 3.1 but not effects on quality or something else and those errors just warned me and if i want to play it in devices that only can play videos that encode from level 3.1 maybe have some issues am i right ?

again thanks for your answers

LoRd_MuldeR
7th May 2014, 15:32
you mean in this case if i encode 1080p video with high values it just dont compliant with level 3.1

Again, one of things that the Level's restrict (but not the only thing!) is the maximum macroblocks per second. For Level 3.1 that is 108,000 (http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels).

Therefore, possible combinations of frame size and frame rate for Level 3.1 include:
720×480 @ 80.0 fps
720×576 @ 66.7 fps
1280×720 @ 30.0 fps

For 1080p (1920x1080) you would have to go down to 13 fps, if you which to stick within the Level 3.1 limits.

But even that wouldn't help, because you are not only violating the macroblocks per second limit of Level 3.1, but also the maximum frame size limit!

To make long story short: If you want 1080p, then Level 3.1 is not for you ;)

but not effects on quality or something else

Well, if you do things like re-sampling your video to a lower resolution, in order to make it Level 3.1 compliant, then that of course effects quality.

But as long as you just add the "--level 3.1" switch, the only thing that happens is that x264 will add a "this stream conforms to Level 3.1" label to the stream - and it will print a fat warning when that actually is not true!

After all, you should never be using the "--level" option and just let x264 set the correct Level for you. If you need a lower level, simply make sure your video actually conforms to that Level...

and those errors just warned me and if i want to play it in devices that only can play videos that encode from level 3.1 maybe have some issues am i right ?

Yes. If your goal was to create a stream that plays on devices that support at most Level 3.1, then the warning tells you that the stream will probably not play flawlessly on those devices, despite pretending to be Level 3.1 conform.

foxyshadis
10th May 2014, 01:51
Also, if you leave the level switch off, x264 will figure out the lowest compatible level and report it for you, while tagging your video with it. If you're hardware constrained to a certain maximum level, then you just have to listen to the warning and correct your input.