Log in

View Full Version : Mencoder BUG - bitrate can't be higher than 2000 !!!


Divet
23rd December 2007, 10:44
I use avs script, it outputs YV12 progressive video 720x576 25 fps and I try to encode MPEG2 video with Mencoder CLI.
First pass:
mencoder -of mpeg -mpegopts format=dvd -ovc lavc -lavcopts vcodec=mpeg2video:vpass=1:vrc_buf_size=1835:vrc_maxrate=9000 film.avs -o NUL -nosound
Second pass:
mencoder -of mpeg -mpegopts format=dvd -ovc lavc -lavcopts vcodec=mpeg2video:vpass=2:vrc_buf_size=1835:vrc_maxrate=9000:vbitrate=6000 film.avs -o film.m2v -nosound
As you see, very very simple...
But... All things are very, very bad...
Second pass displays me this message:
[mpeg2video @ 00C154C0][lavc rc] Using all of requested bitrate is not necessary for this video with these parameters.
AND ENCODES ME VIDEO WITH BITRATE ABOUT 2000 INSTEAD OF 6000 !!!!!!!!
WHY?????!!!!!!
Mencoder bilds I tested dev-SVN-r25279-4.2.2 and 1.0rc2-4.2.1. Both do the same BUG!
HELP ME!!! SOS!!!
I tried to write in command line vbitrate=5000, vbitrate=4000, vbitrate=3000 and saw the same BUG: displaying message and encoding 2-nd pass with bitrate about 2000 !!!!!
Only if I wrote vbitrate=2000 Mencoder didn't display the message about "requested bitrate is not necessary".
How can I encode with vbitrate=6000 ??? HELP PLEASE!!!
Sorry, my English is awful, I am from Eastern Europe...
Help me... please!..

Fishman0919
23rd December 2007, 17:39
It's not a bug... it's mencoder telling you that with the setting you have chosen... Using all of requested bitrate is not necessary for this video with these parameters. and it doesn't use them.

Some more like this might work better...

"C:\MPlayer-athlon-svn-25088\mencoder.exe" "D:\test\HC-QuEnc.AVS" -o "D:\test\HC-QuEnc.AVS_pass1.m2v" -ovc lavc -lavcopts vcodec=mpeg2video:vpass=1:vrc_maxrate=9000:vrc_buf_size=1835:keyint=12:vmax_b_frames=2:brd_scale=1:dc=9:turbo:aspect=16/9:vqscale=3:vb_strategy=1:vqmin=1:vqmax=31:vb_qfactor=1.25:vb_qoffset=0:lmin=0.01:lmax=31.00:vi_qfactor=0.10:vi_qoffset=0:vqcomp=0.75:vqblur=0:mbd=1:precmp=256:cmp=256:subcmp=256:me_range=128:preme=2:vme=4:dia=3:predia=3:sc_threshold=0:sc_factor=4:bidir_refine=4 -of rawvideo -ffourcc MPG2
"C:\MPlayer-athlon-svn-25088\mencoder.exe" "D:\test\HC-QuEnc.AVS" -o "D:\test\HC-QuEnc.AVS_pass2.m2v" -ovc lavc -lavcopts vcodec=mpeg2video:vpass=2:vbitrate=6000:vrc_maxrate=9000:vrc_buf_size=1835:keyint=12:vmax_b_frames=2:brd_scale=1:dc=9:aspect=16/9:vqmin=1:vqmax=31:vb_qfactor=1.25:vb_qoffset=0:lmin=0.01:lmax=31.00:vi_qfactor=0.10:vi_qoffset=0:vqcomp=0.75:vqblur=0:mbd=1:precmp=256:cmp=256:subcmp=256:me_range=128:preme=2:vme=4:dia=3:predia=3:sc_threshold=0:sc_factor=4:bidir_refine=4 -of rawvideo -ffourcc MPG2

Divet
6th January 2008, 02:00
:vqscale=3:

Excuse me! This is a constant quantizer encoding!!!
It's not an encoding with variable quantizer by 2 passes!!!
So, Mencoder doesn't dispaly the message about "bitrate is not necessary..."
In all other experiments I see this awful message :(

Last experiment was with MPlayer Sherpya-SVN-r25513-4.2.2
and with this command line:

mencoder film.avs -o film.m2v -of rawvideo -ovc lavc -lavcopts vcodec=mpeg2video:aspect=4/3:dc=10:vrc_buf_size=1835:keyint=12:vmax_b_frames=2:mv0:qprd:mbd=2:me_range=128:preme=2:bidir_refine=4:vbitrate=6000:vrc_maxrate=9000:dia=3:predia=3:vfdct=6:precmp=6:cmp=6:subcmp=6:vpass=1:vb_strategy=2

and in second pass the same command line, but without vb_strategy=2 and with vpass=2

Fishman0919
6th January 2008, 05:00
Excuse me! This is a constant quantizer encoding!!!
It's not an encoding with variable quantizer by 2 passes!!!

The first pass can be a constant quantizer or VBR... it doesn't matter...
but you have to specify one or the other. You didn't mencoder -of mpeg -mpegopts format=dvd -ovc lavc -lavcopts vcodec=mpeg2video:vpass=1:vrc_buf_size=1835:vrc_maxrate=9000 film.avs -o NUL -nosound

the second pass I wrote...
vcodec=mpeg2video:vpass=2:vbitrate=6000:vrc_maxrate=9000

...is a VBR pass... so the final encoding will be VBR


Edit: If you are going to use precmp=6:cmp=6:subcmp=6

you should try precmp=262:cmp=262:subcmp=262 because it also use chroma... but precmp=258:cmp=258:subcmp=258 which is the same as precmp=2:cmp=2:subcmp=2 without chroma is visibly the same'ish but much faster

Divet
6th January 2008, 19:33
The first pass can be a constant quantizer or VBR... it doesn't matter...
but you have to specify one or the other. You didn't

I tried also
for the first pass :vcodec=mpeg2video:vpass=1:vbitrate=6000:vrc_maxrate=9000
and for the second pass :vcodec=mpeg2video:vpass=2:vbitrate=6000:vrc_maxrate=9000
and got the same result - "bitrate is not necessary"!!!!!!!


you should try because it also use chroma...

I know! But... but in the latest mencoder docs I find this:
"+256 Also use chroma, currently does not work (correctly) with b-frames"! But b-frames are present in MPEG-2 DVD! How to be?..

Fishman0919
6th January 2008, 20:31
Some B frames may not be show correct chroma but will look fine.

Divet
7th January 2008, 21:00
Finally, I found, that "bitrate not necessary" appearance depends on video matherial source!!!
I always set vbitrate parameter to 6000.
Many films with long black screen at the beginning of the film give "bitrate not ntcessary" and bitrate about 2000,
but some films with quick and little details at the beginning give me good bitrate about 5000 and no message.
Mencoder is very intelligent :)