[MEncoder-users] H.264 levels, -x264encopts level_idc=xx. Was: Why can't the PS3 play the mp4s produced by this mencoder command?
briaeros007
briaeros007 at gmail.com
Mon Sep 29 15:21:15 CEST 2008
2008/9/29, Stroller <stroller at stellar.eclipse.co.uk>:
>
> 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,
>
> Stroller.
>
>
>
> [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
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
>
Hello,
Good to know it help you ;).
I'm not to sure about the level myself.
In one hand, the encoder could (and should) enforce the level
constraint on the video.
In the other hand, the level is just a flag in the head of one nal (an
h.264 packet) (and not all nal, just some specific nal), so the
encoder (or a little script) could change the level of a video, even
if the constraint are not (always) respected, and it will be all up to
the decoder to manage this stream.
For mencoder, it seem to use the second method for the bitrate :
Example :
I use this command to encode with level 30 :
mencoder -nosound -ovc x264 -x264encopts bitrate=2000:level_idc=30
-demuxer rawvideo -rawvideo w=720:h=480 stream2.yuv -frames 1000 -o
test.h264 -of rawvideo -ofps 25
kb/s:2123.7
It print x264 [info]: kb/s:2123.7
11M test.h264
1000 frames/25 fps => 40 seconds
11M bytes/40 seconds => 2252.8 kbits/s
And i verified (in hexa) that the level is the good one in the file ;)
(if you want to verify yourself :
use an heximal editor of your file and search
0x00000167
after this code, you will have thre other bytes :
XX Y0 ZZ
XX -> it's the profile :66 for baseline, 77 for main and 88 for extended.
(it can be also 100 for high, 110, 122 ...)
Y it's the flag constraint
ZZ it's the level_idc.
In this case ZZ=30 (4D), and XX=77(0x1E)
)
--
-------------------------------------------------------------------
Subete ga wakatta toki…watashi ga anta wo korosu.
More information about the MEncoder-users
mailing list