[MEncoder-users] H.264 levels, -x264encopts level_idc=xx. Was: Why can't the PS3 play the mp4s produced by this mencoder command?

Stroller stroller at stellar.eclipse.co.uk
Mon Sep 29 04:43:54 CEST 2008

On 22 Sep 2008, at 08:09, briaeros007 wrote:
> ...
> I don't know how undvd work, but to be read on a PS3, an H264 video
> stream must not have a level greater than 4.1
> With mencoder , you can use the options 'level_idc=41'.
> For example :
> mencoder $1 -ovc x264 -oac copy -x264encopts
> subq=6:pass=1:bitrate= 
> $ 
> 3 
> :bframes 
> = 
> 3 
> :partitions 
> = 
> p8x8 
> ,b8x8 
> ,i4x4 
> :weight_b:threads 
> = 
> auto:nopsnr:nossim:frameref 
> =3:mixed_refs:bime:brdo:level_idc=41:direct_pred=auto:trellis=1
> -o "$2.avi"

That's fantastic! Sorry for taking so long to reply, but that helped  
me out immediately.

I have spent some time this week performing test rips with  
level_idc=41 and also with level_idc=30. Level 3 is interesting  
because, according to Wikipedia [1] it is required for iPod support.

Working with a 2 minutes trailer level_idc=41 seems to have no effect  
effect upon filesize, but level_idc=30 is a fraction smaller:
$ ls -lS HeatTest_*
-rw-r--r-- 1 stroller users 21839760 Sep 22 17:46 HeatTest_lvl41.mp4
-rw-r--r-- 1 stroller users 21839760 Sep 29 02:55 HeatTest_undvd.mp4
-rw-r--r-- 1 stroller users 21838530 Sep 27 23:42 HeatTest_lvl30.mp4

Differences between these files are not visible.

I understand that levels are intended to accommodate the "very large  
variation in the performance of encoders and decoders", so am I to  
assume that the file produced with "level_idc=30" has been forced to a  
slightly lower bitrate?

I ask this because `undvd` (by default) specifies a "bitrate=939" as  
part of its existing -x264encopts, and looking at the "Max video bit  
rates" for level 3, I don't think that this exceeds those. Perhaps I  
am missing something in bits / bytes conversion, but I'm not exactly  
sure which column I should be looking at either. The table shown in  
the "levels" section of the Wikipedia page [2] is clearly copy & paste  
from Annex A itself [3, pdf].

I haven't tested as thoroughly as I'd like - I'm ripping the whole  
movie right now with a second set of options - but generally speaking  
can anyone tell me, please, what are the implications of levels when  
encoding DVD-quality video?

(If my question is too verbose, perhaps a short answer of "level X is  
perfect for DVDs, level X-1 is ok but a bit shoddy, level X-2 looks  
dreadful" would suffice.)

The examples given of 720x480 at 30.0, 720x576 at 25.0 for level 3 look  
absolutely ideal, but on this particular movie I'm seeing quite a bit  
of noise on the dark backgrounds, and am currently ripping with "- 
x264encopts ...bitrate=1087:level_idc=41". Would level 3 cause this  
higher bitrate to be ignored and a lower-quality rip produced?

Thanks in advance for any pointers,


[1] http://en.wikipedia.org/wiki/H.264#Applications
[2] http://en.wikipedia.org/wiki/H.264#Levels
[3] http://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.264-200711-I!!PDF-E&type=items

More information about the MEncoder-users mailing list