digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Video Encoding and Conversion (http://www.digitalfaq.com/archives/encode/)
-   -   FFMPEG vs FFVFW vs Mencoder ? (http://www.digitalfaq.com/archives/encode/8159-ffmpeg-vs-ffvfw.html)

Amenophis 02-23-2004 02:31 PM

Quote:

Originally Posted by digitall.doc

Well, I already used all this settings, with lots of macroblocks during the explosion, that didn't improve raising bitrate from 5000 to 8000. I didn't try adding noise, but I still don't understand why the encoder doesn't make use of higher bitrate avaliable to improve the image and avoid this macroblocks...

Maybe you've to lower the min.quanziter (=1). some movies can be compressed completery at quant2 with about 4000 kbit/s, so you need to lower the quant if you want to use more bitrate

bilu 02-23-2004 02:55 PM

@Amenophis

quantizer=1 should be avoided. See this post:

http://www.kvcd.net/forum/viewtopic.php?p=63511#63511


Bilu

digitall.doc 02-23-2004 02:55 PM

Hi amenophis:
I will try min quant=1, but I think I read in man-page he didn't advise min quan=1, but don't remember why.
About your statement:
Quote:

some movies can be compressed completery at quant2 with about 4000 kbit/s
when I encoded it again with vbitrate=8000 and got the same filesize, I thought that the encoder already had compressed completely the film and couldn't improve it even raising bitrate. But, how can I take profit of higher bitrate, if any, to avoid the macroblocks in fast scenes? I'll try ypur quant=1 suggestion. Maybe adding noise?. Any suggestion anout adding noise in mencoder?
Where did you take the parameter value for vi_ vb_ and so? Are the applyable to any film?
EDIT: phew, bilu, I was slower for just a second, friend :lol:

bilu 02-23-2004 03:02 PM

Quote:

Originally Posted by digitall.doc
Well, I already used all this settings, with lots of macroblocks during the explosion, that didn't improve raising bitrate from 5000 to 8000. I didn't try adding noise, but I still don't understand why the encoder doesn't make use of higher bitrate avaliable to improve the image and avoid this macroblocks...
I didn't try SATD instead of default (?) SAD to see if this improves quality (avoids these macroblocks), but I didn't want to make encoding even slower...

Did you look at the source? Maybe the blocks are already there...
Besides noise or sharpening I have very few ideas left :?

Quote:

From a theoretical point of view... what values, thinking in quality terms, would you advise for b_qfactor, vi_qfactor, vb_qoffset, and vi_qoffset
Until I try mencoder myself, and based on my Xvid experience, I think the defaults are fine. Others may test and present a better parameters than me - experience DOES count here :)

Quote:

And what about a command line for 2pass encoding
Same goes here ;)
Have a look my previous posts about the average bitrate for the 2nd pass.

EDIT: can you post your command-line? Are you using B-frames?

Bilu

Amenophis 02-23-2004 03:09 PM

additionally you could use a matrix with low values, so you get more bitrate/quality without changing the quantizer

bilu 02-23-2004 03:14 PM

Quote:

Originally Posted by Amenophis
additionally you could use a matrix with low values, so you get more bitrate/quality without changing the quantizer

Others can help you here, I'm curious too :D

Bilu

digitall.doc 02-23-2004 05:14 PM

Here's the last mencoder settings I've tried
Code:

mencoder -of mpeg -ovc lavc -nosound -lavcopts vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,
40,26,27,29,36,39,38,40,48,27,29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79:inter_matrix=16,18,20,22,
24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34,36,
38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44:
mbd=2:vrc_minrate=300:vrc_maxrate=8000:vbitrate=8000:vrc_buf_size=1835:vmax_b_frames=2:naq:trell:cbp:scplx_mask=0.5:
mv0:vqsquish=0:vqblur=0:vqcomp=1:vrc_eq=tex:vqmax=4:keyint=15:aspect=16/9 D:\Temp\1.avi -o D:\Temp\encoded.mpg

I still have to get rid off vqcomp, vqmax, naq and scplx_mask as you advised. As you can see I'm making use of notch matrix.
And no, macroblocks aren't in the source (Star Wars Episode II DVD).
About 2-pass, I don't really ask for a working command, we'll have to test. I ask, for instance, how do I state which functions just working in first pass and which in second, and so on.
Quote:

Until I try mencoder myself,...
Go and try it, man. 8)

rds_correia 02-23-2004 06:35 PM

Quote:

Originally Posted by bilu
Until I try mencoder myself,...

Quote:

Originally Posted by digitall.doc
Go and try it, man. 8)

Now I think digitall.doc has it all: you really have to try this baby, bilu :wink:

digitall.doc 02-24-2004 05:16 AM

Hi Rui:
have you played with 2pass encoding?
I'm curious about how to set mencoder to do that.
I'd try it and see if is so slow to forget it.
Well, we played a lot with ffvfw, and now playing with mencoder. And it seems that with mencoder we managed
to avoid main ffvfw drawback: too high bitrates. Don't you think so?.
It seemes to me that we limited bitrates in mencoder.
BUT, maybe still far from getting the best of it, because in my fast action scene test I still get too much blocks (seen on PC monitor).
Did you see the last settings I posted in this thread, following bilu advise?. What do you think about them?. What can we improve in
order to get a better output?.
He, he, enjoying a lot with this... :wink:

bilu 02-24-2004 05:52 AM

Code:

mencoder -of mpeg -ovc lavc -nosound -lavcopts vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,
40,26,27,29,36,39,38,40,48,27,29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79:inter_matrix=16,18,20,22,
24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34,36,
38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44:
mbd=2:vrc_minrate=300:vrc_maxrate=8000:vbitrate=8000:vrc_buf_size=1835:vmax_b_frames=2:naq:trell:cbp:scplx_mask=0.5:
mv0:vqsquish=0:vqblur=0:vqcomp=1:vrc_eq=tex:vqmax=4:keyint=15:aspect=16/9 D:\Temp\1.avi -o D:\Temp\encoded.mpg

Remove vmax_b_frames=2, default will be B-frames disabled.
B-frames are not that good on high action, or else there wouldn't be a switch like this for the 2nd pass:
Quote:

vb_strategy=<0-1>
strategy to choose between I/P/B frames (pass 2):
0 always use the maximum number of B frames (default)
1 avoid B frames in high motion scenes (will cause bitrate misprediction)
Remove vqquish=0, default is vqsquish=1 and seems better.
Remove vqcomp=1, not needed when using vrc_eq=tex.
Remove vqmax=4, this may limit mencoder's capability to keep in the 8000 Kbps range.

If not enough, then try:

Remove scplx_mask=0.5 and naq, spatial deblocking without temporal influence may end up looking bad on high action scenes too, who knows?
Use default matrix instead of the Notch matrix.


Bilu

bilu 02-24-2004 06:00 AM

Quote:

Originally Posted by rds_correia
Quote:

Originally Posted by bilu
Until I try mencoder myself,...

Quote:

Originally Posted by digitall.doc
Go and try it, man. 8)

Now I think digitall.doc has it all: you really have to try this baby, bilu :wink:

OK, let me tell you a story :)

I have two machines at home, one is a Pentium 200 w/ 64 Mb RAM and 6 GB, the other *was* a PIII-850 with 128 MB RAM and 20 GB.

I said *was* because the board is dead: it lived one extra month with a borrowed stronger power source, but it's dead again. Some condensers/resistors/whatever are leaking. :roll:

I already checked out yesterday on the FIC boards site that the FIC PT-2007 from my P200 will handle the 20 GB disk from the other machine.

But that disk was from a machine running XP and NTFS 5.1 and has documents, I don't wanna risk mounting it on my P200 VectorLinux 4.0 .

I don't have finantial conditions for an upgrade at this precise moment, or else I would have already backed up that disk and shoved it into my P200 - this will be my DVD backup machine ! :twisted:

Until then my 6GB disk isn't big enough for that :roll:


Bilu

rds_correia 02-24-2004 07:12 AM

Quote:

Originally Posted by digitall.doc
Hi Rui:
have you played with 2pass encoding?
I'm curious about how to set mencoder to do that.
I'd try it and see if is so slow to forget it.

Hi Digitall.doc,
No I haven't tried 2-pass because I never liked the idea of having to wait almost twice the time. Don't get me wrong, I aim to find the best quality but I'm not willing to wait one week :wink: for a movie encode.
Quote:

Originally Posted by digitall.doc
Well, we played a lot with ffvfw, and now playing with mencoder. And it seems that with mencoder we managed
to avoid main ffvfw drawback: too high bitrates. Don't you think so?.
It seemes to me that we limited bitrates in mencoder.

By now it does seam so but I'm not quite sure. What about those "buffer underflows" and those "PTS SCR"? Maybe they appear when we try to constrain the bitrate, and I think I could tell you that "buffer underflows" are bad when you get a lot of them on very dark low action movie parts.
Quote:

Originally Posted by digitall.doc
BUT, maybe still far from getting the best of it, because in my fast action scene test I still get too much blocks (seen on PC monitor).

That's what I'm saying :?
Quote:

Originally Posted by digitall.doc
Did you see the last settings I posted in this thread, following bilu advise?. What do you think about them?. What can we improve in
order to get a better output?.

Maybe I'm not cut off for understanding mencoder explanations.
So I'm maybe not the right person to give that kind of advise.
I will test your command line though.
It seems that Bilu can explain it perfectly even without having tested the encoder and still I don't get it. :oops:
It's as if you were all reading more/different documentation than the one I have, which I'm sure you're not.
I'm completely missing something.
But this is my 1st time with you guys trying to understand an encoder.
Maybe next time I don't pose so many questions.
Quote:

Originally Posted by digitall.doc
He, he, enjoying a lot with this... :wink:

I've been my friend but not so much in the last days since sometimes I don't understand a word that you're all saying...
But I can't wait for some guy to unveil the best command line for mencoder, yet. :D
Cheers

digitall.doc 02-24-2004 08:08 AM

Hi all,
bilu, yesterday night I tried all your suggestions, that patiently you had already suggested earlier :? . Know what?,
to my susprise it didn't change anything (filesize neither visual quality) 8O .
I'll explain: I changed to vqsquish=1 and removed vqcomp=1. Changed to vrc_eq=tex. Removed vqmax=4
(and let default). And believe me, nothing changed.
Tried removing scplx_mask=0.5 and naq, and again to my susprise filesize raised (well, not really surprising
since you stated that scplx_mask filters image, but it was supposed to decrease image quality,... and bigger
filesize??)
Then I remembered that nocht matrix is supposed to cut frequencies and lower bitrate, so I tried using default
matrix instead of the Notch matrix. File size grew, but no image improvement.
My interest in higher bitrate and bigger filesize is getting better quality (thinking on KDVD). Don't mind lower
bitrate, but I want to get the better quality possible with this encoder, and if filesize is too big, I'll filter, apply Notch
matrix, or whatever needed to fit the film in media. But I'm not getting to this point. Image quality is quite good, but
still didn't get rid off these blocks. I tried adding noise (-vf noise=lumaa50) but still (less) blocks.
Any advise? :wink:

bilu 02-24-2004 08:57 AM

scplx_mask=0.5 works like a deblocker, so it's normal that by disabling it the movie filesize grows.

I think we need to focus more on that scene :twisted:
Please give some feedback about what Bitrate Viewer reports.
Maybe you need to rise bitrate up to the 9800 limit.

Or change to SATD (slower) :?

Bilu

bilu 02-24-2004 09:00 AM

@rds_correia

I'd like to know specifically what you're not understanding.
If you understand you can help me explain to others ;)

Please post your questions, I'm sure someone else will have the same doubts.

About FFVFW, maybe some of the misconceptions made before with mencoder (like the abusive use of vqscale which doesn't respect bitrates) are the same being done in FFVFW.

Could someone post what's being used in FFVFW now?


Bilu

digitall.doc 02-24-2004 10:39 AM

@bilu,
hmmm, if I encode a film without b-frames, won't the file grow really a lot?. And, is it DVD compliant?.
I mean, GOP for DVD must be 15, isn't it?. And GOP structure for DVD compliancy must be
IBBPBBPBBPBBPBBI... isn't it?
I'm not just looking for a solution for my scene, but learning the way to do our encodings, to get the better
quality possible, but always compliant with DVD standard.
I may try to raise up 9800, but as I told you I raised from 5000 to 8000, without changing filesize, neither
quality. Maybe was due to Notch matrix.
I'll try SATD, and post here the "slowering" magnitude, and filesize and quality.
What about 2-pass?. A fast first pass, and second pass for quality?. Any ideas?. Will it really take double
encoding time?. I would like to test it, but I don't know how.

kwag 02-24-2004 11:28 AM

Quote:

Originally Posted by bilu
Remove vmax_b_frames=2, default will be B-frames disabled.
B-frames are not that good on high action, or else there wouldn't be a switch like this for the 2nd pass:

8O
Removing B frames will make worse quality, no matter what encoder :!:
That is, if bitrate is kept at the same reference.
Removing P frames is even worse quality.
If you remove B frames, you have to compensate with a higher bitrate, and then quality is better.
Removing B and P frames is the BEST quality, but only at very high bitrates ( ~50,000Kbps or more ).
MPEG-2 is used that way in broadcast studios.

-kwag

rds_correia 02-24-2004 11:34 AM

Hya Kwag,
Have you given mencoder a try yourself?
Would like to share your results with us?
Thanks pal.
Cheers

kwag 02-24-2004 11:38 AM

Quote:

Originally Posted by rds_correia
Hya Kwag,
Have you given mencoder a try yourself?

No, I haven't had time :roll:
Quote:

Would like to share your results with us?
I will, when I have some time to fool around with it :D

-kwag

incredible 02-24-2004 11:56 AM

Quote:

Removing B frames will make worse quality, no matter what encoder :!:
That is, if bitrate is kept at the same reference.
I underline that as P Frames ONLY work predictious means they refer to the Frames BEFORE where B Frames also do refer to FOLLOWING frames.

If you would only use P Frames you could receive a stream where an visible sudden quality "refresh" occurs when the playback reads an I Frame.
Cause in the Frame run within the I Frame Interval the Frames would get only worse and worse ;-)

rds_correia 02-24-2004 12:41 PM

Quote:

Originally Posted by bilu
@rds_correia

I'd like to know specifically what you're not understanding.
If you understand you can help me explain to others ;)

Please post your questions, I'm sure someone else will have the same doubts.

Ok buddy,
Maybe I'll start by posting my current command line and avs script:
The Avs script:
Code:

Mpeg2Source("c:\xxxxx.d2v")
undot()
Limiter()
asharp(1, 4)
BicubicResize(688,400,0,0.6,4,12,712,552)
STMedianFilter(3, 3, 1, 1 )
MergeChroma(blur(1.5))
MA_Soft() #light MA function made by Inc., faster BTW.
AddBorders(8,80,8,96)
Limiter()
#Slicer(2,15,30,2,0) #sampler function made by Inc. for Ping-Pong prediction. Pretty cool BTW.

And the mencoder command line:
Code:

mencoder -of mpeg  -ovc lavc -lavcopts vcodec=mpeg2video:
intra_matrix:inter_matrix:mbd=0:vbitrate=3000:vrc_maxrate=8000:vrc_minrate=300:
vrc_buf_size=1835:keyint=15:vqmin=2:vqmax=24:vmax_b_frames=2:vb_qfactor=1.2:
vi_qfactor=0.8:vb_qoffset=0.75:vqblur=0.3:vlelim=-4:vcelim=2:vfdct=6:
aspect=4/3 -nosound c:\zzzzz.avi -o c:\wwwww.mpg

Notice that I don't post the intra/inter matrices. I'm using Notch matrix.
The way I see it the tricky part is:
Code:

:mbd=0:vbitrate=3000:vrc_maxrate=8000:vrc_minrate=300:
vrc_buf_size=1835:keyint=15:vqmin=2:vqmax=24:vmax_b_frames=2:vb_qfactor=1.2:
vi_qfactor=0.8:vb_qoffset=0.75:vqblur=0.3:vlelim=-4:vcelim=2:vfdct=6:

So I have vrc_minrate=300 & vrc_maxrate=8000 & vbitrate=3000.
From what I understood so far these are for min & MAX & average bitrate.
I have been using these since the days I saw russiansexpat using mencoder in Linux.
Then there are keyint=15 for max GOP size and vrc_buf_size=1835 for vbv buffer size, right?
Then I have vqmin=2 and vqmax=24 for quantizer settings. I understand how these work,
but since we're already using min, MAX & avg bitrate do we need these?
Last one that I know is vmax_b_frames=2 for 2 b frames like IBBPBBPBBP.
All the others I don't understand how they work (lack of good manual/linux manpages always disapointed me a bit)
and don't know what they are doing there.
More what would you change in my command line to seek for 2 movie KDVD.
Last but not least where do I get more or less quality?
This baby is way different in settings when comparing with CCE/tmpg...
Quote:

Originally Posted by bilu
About FFVFW, maybe some of the misconceptions made before with mencoder (like the abusive use of vqscale which doesn't respect bitrates) are the same being done in FFVFW.
Could someone post what's being used in FFVFW now?
Bilu

I can't because I haven't been using ffvfw for a while.
Only use the makeAVIS that comes with it to make a fake avi for mencoder.
Hope you can give me some help with the above issue.
Cheers

vhelp 02-24-2004 02:12 PM

Hay guys,

I've got an :idea: ... can we all agree upon a "standard" in the command
line params "layout".

So that when we are working out issues w/ a given param string(s) we can
knew exactly where to look for it, when we're all dealing with params.

Here's an example.

Lets all keep things w/in a "group", and those that think a given param or
set of params belong in a "group", lets all agree to keep them together,
especially if they work w/ relation to other params, or "group"'s of params.
.
.
Then, we can include the new agree upon "standard" inside a Sticky post :!:

But, if you all think it's not necessary, then by all means, just ignore my
idea :lol: and 8)

In the mean time, I'll start the first part, and you can include/add in yours.
Later, I'll add this feature inside my GUI as a guage :roll: Then, in my GUI,
I'll "sectionalize" the items, for easy minipulations w/in the GUI :!:
(which I hope to share with you all here and elsewheres soon)

Quote:

Bitrate:
mbd=0:vrc_minrate=1200:vrc_maxrate=8000:vbitrate=2 800:vrc_buf_size=1835:keyint=18
Noise:
Filters:
** etc etc

keyint is set to 18, because, if I understood, this is for GOP. But, I thought
it was for KEYFRAMES, as in divX and AVI's :grrr:

Also, if we can agree upon exacly, which param string does "exactly" what,
we can add that into our Sticky. A glossary. I know there is an .HTML doc,
but it's confusing, and it has left all of us to discover what all these cryptic
param string/options/subgroups are for ourselves. And, being that we are
all working together (I use that loosely) we may as well work as a consortium
and in the process, create a "standard" glossary of commands/params or
whatever you want to call it :screwy:

Think about it :roll:
-vhelp

bilu 02-24-2004 06:52 PM

Quote:

Originally Posted by digitall.doc
@bilu,
hmmm, if I encode a film without b-frames, won't the file grow really a lot?. And, is it DVD compliant?. I mean, GOP for DVD must be 15, isn't it?. And GOP structure for DVD compliancy must be
IBBPBBPBBPBBPBBI... isn't it?
I'm not just looking for a solution for my scene, but learning the way to do our encodings, to get the better quality possible, but always compliant with DVD standard.

It will grow a lot, but I don't believe that abandoning B-frames would break up compatibility with standards. I'll have to check.
But a parameter like this has a reason to exist, right:
Quote:

vb_strategy=<0-1>
strategy to choose between I/P/B frames (pass 2):
0 always use the maximum number of B frames (default)
1 avoid B frames in high motion scenes (will cause bitrate misprediction
For 1-pass encodes, and if you still want to use B-frames to be sure of compatibility, you can use b_qfactor=1.0 and vb_qoffset=0. This would make it use B-frames but use the same quantizer as P-frames. Filesize will grow but you will be able to see if it was a overquantized B-frames problem on that high-action scene.

A middle-term between filesize and quality once you discover that this was the problem will be using b_qfactor=1.0 and playing with vb_qoffset between 0 and 1.25 (default value). This will assure a fixed quantizer increase over P-frames, not a multiplied one like when using b-qfactor > 1.
Remember that Bquant=Pquant * b_qfactor +vb_qoffset.


Bilu

digitall.doc 02-24-2004 06:57 PM

Quote:

Originally Posted by bilu
A middle-term between filesize and quality once you discover that this was the problem will be using b_qfactor=1.0 and playing with vb_qoffset between 0 and 1.25 (default value). This will assure a fixed quantizer increase over P-frames, not a multiplied one like when using b-qfactor > 1.
Remember that Bquant=Pquant * b_qfactor +vb_qoffset.

Understood now (I think)
Nice explanation.
Now at work. I'll try tomorrow.
Lots of tests to do tomorrow. Maybe my wife will leave me.... :?

bilu 02-24-2004 07:02 PM

Quote:

Originally Posted by kwag
Removing B frames will make worse quality, no matter what encoder :!:
That is, if bitrate is kept at the same reference.
Removing P frames is even worse quality.
If you remove B frames, you have to compensate with a higher bitrate, and then quality is better.
Removing B and P frames is the BEST quality, but only at very high bitrates ( ~50,000Kbps or more ).
MPEG-2 is used that way in broadcast studios.

I agree with you. B-frames compress about 4x better (at least in MPEG-4) than P-frames, which means much more bitrate freed for use in P and I frames.

But they make you loose quality in high action (explosions,etc.) and anime movies and they're not recommended in this case. But as I mentioned on my previous post, playing a bit more with vb_qoffset and less with b_qfactor can improve a lot on this field.
Quote:

Default
=====
Pquant= 4 -> Bquant= 4*1.25 +1.25 = 6.25
Pquant=20 -> Bquant= 20*1.25 +1.25 = 25 + 1.25 = 26.25

difference between P and B quants:

P=4 -> 2.25
P=20 -> 6.25

B_qfactor=1
========
Pquant= 4 -> Bquant= 4*1 +1.25 = 5.25
Pquant=20 -> Bquant= 20*1 +1.25 = 21.25

difference between P and B quants:

P=4 -> 1.25
P=20 -> 1.25
Until digitall.doc shows what quantizers does Bitrate Viewer shows for that scene, this approach may be helpful.


Bilu

bilu 02-24-2004 07:16 PM

Quote:

Originally Posted by incredible
I underline that as P Frames ONLY work predictious means they refer to the Frames BEFORE where B Frames also do refer to FOLLOWING frames.

If you would only use P Frames you could receive a stream where an visible sudden quality "refresh" occurs when the playback reads an I Frame.
Cause in the Frame run within the I Frame Interval the Frames would get only worse and worse ;-)

I don't quite agree and I'll explain why.
Every guy doing MPEG-4 anime encodes right now disables B-frames completely because it damages the edges. So the fact that B-frames get info from the next frame may not necessarily garantee better frame quality. Usually it does get better quality, but high action and anime are exceptions.

But as said before, B-frames are better compressed precisely because they have information of both the previous and the next frames, so probably a lot of info becomes redundant and hence discarded. But when forcing a B-frame to be more compressed than a P-frame and you're doing high action or anime you probably won't get pleased with the results.

IMHO B-frame compression factor (relative to P or I frames) should be dynamic, changing as much as the previous and next frames differ.
High-action B-frames compression factor should be lower than doing low-action. Slower movements keep much more info from one frame to another and are so much easier to compress. :roll:

Maybe no one did this until now because on high-action P and I frames also get much lower quantizers, so the factor's influence will be less.
Nevertheless on those scenes it may be too much :?


Bilu

bilu 02-24-2004 08:04 PM

Quote:

:mbd=0:vbitrate=3000:vrc_maxrate=8000:vrc_minrate= 300:
vrc_buf_size=1835:keyint=15:vqmin=2:vqmax=24:vmax_ b_frames=2:vb_qfactor=1.2:
vi_qfactor=0.8:vb_qoffset=0.75:vqblur=0.3:vlelim=-4:vcelim=2:vfdct=6
Use mbd=2 instead of mbd=0. Use vqblur=0 instead of vqblur=0.3 or else it may hurt on sudden high-action scenes.
Quote:

Then I have vqmin=2 and vqmax=24 for quantizer settings. I understand how these work,
but since we're already using min, MAX & avg bitrate do we need these
vqmin=2 is default, vqmax=24 is optional. So no need for them :)
Quote:

Last one that I know is vmax_b_frames=2 for 2 b frames like IBBPBBPBBP. All the others I don't understand how they work (lack of good manual/linux manpages always disapointed me a bit) and don't know what they are doing there.
About

vb_qfactor=1.2
vi_qfactor=0.8
vb_qoffset=0.75

Formulas explained above. Something like this:

Iquant= Pquant * Ifactor + Ioffset
Bquant= Pquant * Bfactor + Boffset

both factors and offsets are related to P-frames quantizers.

In this case B quantizer = P quantizer * 1.2 + 0.75

vqblur=0.3 averages a frame quantizer with previous quantizers, bad for sudden high-action.
It would make terror movies even more terrifying ;)

vlelim=-4
vcelim=2
vfdct=6

Quote:

vlelim=<-1000-1000>
single coefficient elimination threshold for luminance. Negative values will also consider the dc coefficient (should be at least -4 or lower for encoding at quant=1):
0 disabled (default)
-4 (JVT recommendation)

vcelim=<-1000-1000>
single coefficient elimination threshold for chrominance. Negative values will also consider the dc coefficient (should be at least -4 or lower for encoding at quant=1):
0 disabled (default)
7 (JVT recommendation)

Mencoder's vfdct=<0-10>
dct algorithm:
0 automatically select a good one (default)
1 fast integer
2 accurate integer
3 mmx
4 mlib

FFMPEG's `-dct_algo algo'
set dct algorithm to algo. Available values are:
`0' FF_DCT_AUTO (default)
`1' FF_DCT_FASTINT
`2' FF_DCT_INT
`3' FF_DCT_MMX
`4' FF_DCT_MLIB
`5' FF_DCT_ALTIVEC
vcelim and vlelim: http://www.mplayerhq.hu/DOCS/tech/encoding-tips.txt
Quote:

TIPS FOR ENCODING

That being said, with video you have some tradeoffs you can make. Most
people seem to encode with really basic options, but if you play with
single coefficient elimination and luma masking settings, you can save lots
of bits, resulting in lower quantizers, which means less blockiness and
less ugly noise (ringing) around sharp borders. The tradeoff, however, is
that you'll get some "muddiness" in some parts of the image. Play around
with the settings and see for yourself. The options I typically use for
(non-animated) movies are:

vlelim=-4
vcelim=9
lumi_mask=0.05
dark_mask=0.01

If things look too muddy, making the numbers closer to 0. For anime and
other animation, the above recommendations may not be so good.

============
ABOUT VLELIM, VCELIM, LUMI_MASK AND DARK_MASK PART I: LUMA & CHROMA


The l/c in vlelim and vcelim stands for luma (brightness plane) and chroma
(color planes). These are encoded separately in all mpeg-like algorithms.
Anyway, the idea behind these options is (at least from what I understand)
to use some good heuristics to determine when the change in a block is less
than the threshold you specify, and in such a case, to just encode the
block as "no change". This saves bits and perhaps speeds up encoding. Using
a negative value for either one means the same thing as the corresponding
positive value, but the DC coefficient is also considered. Unfortunately
I'm not familiar enough with the mpeg terminology to know what this means
(my first guess would be that it's the constant term from the DCT), but it
probably makes the encoder less likely to apply single coefficient
elimination in cases where it would look bad. It's presumably recommended
to use negative values for luma (which is more noticable) and positive for
chroma.

The other options -- lumi_mask and dark_mask -- control how the quantizer
is adjusted for really dark or bright regions of the picture. You're
probably already at least a bit familiar with the concept of quantizers
(qscale, lower = more precision, higher quality, but more bits needed to
encode). What not everyone seems to know is that the quantizer you see
(e.g. in the 2pass logs) is just an average for the whole frame, and lower
or higher quantizers may in fact be used in parts of the picture with more
or less detail. Increasing the values of lumi_mask and dark_mask will cause
lavc to aggressively increase the quantizer in very dark or very bright
regions of the picture (which are presumably not as noticable to the human
eye) in order to save bits for use elsewhere.
So vcelim and vlelim are thresholds to be used to consider a macroblock on one frame different from the macroblock from the frame before. This saves on motion vectors, increases image stability and saves bitrate. IMHO we should follow the JVT recommendations here.

About vfdct, as you can see from both Mencoder's and FFMPEG's documentation the value 6 is not existant or at least not documented. Better should auto (default).
Quote:

More what would you change in my command line to seek for 2 movie KDVD. Last but not least where do I get more or less quality
Unless you're aiming at high-bitrate encode which doesn't seem to be the case you're much better with a two-pass process, no doubt about it. Or else low-action will get low quantizers and high-action will be screwed up by high quantizers trying to fit in the average bitrate.
The only way to get a fair bitrate distribuition is called 2-pass. High bitrates work for 1-pass because every frames gets as good as the max quantizer lets.

About parameters, look at my posts above for digitall.doc . Trell, mbd=2,cbp and mv0. At least these got my attention, there may be others around.


Bilu

digitall.doc 02-24-2004 08:05 PM

Quote:

Originally Posted by bilu
Maybe no one did this until now because on high-action P and I frames also get much lower quantizers, so the factor's influence will be less.

Well, according to your example, that's just what may happen:
Quote:

Default (b_quant=1.25)
=====
Pquant= 4 -> Bquant= 4*1.25 +1.25 = 6.25
Pquant=20 -> Bquant= 20*1.25 +1.25 = 25 + 1.25 = 26.25

difference between P and B quants:

P=4 -> 2.25
P=20 -> 6.25
Even with default value (1.25), with P low quantizer difference is 2.25, with P high quantizer, difference is 6.25.

Er, what about a 2 pass command example :?: Noone already tested it?.
Don't know what to begin with.
Willing to have more to play with... :D

digitall.doc 02-24-2004 08:09 PM

@bilu:
I was posting when you were posting... again, nice explanation in last post.
vhelp asked for something like this in other htread: to know what functions to use, and what parameters, and what are those parameters for. This way, we can tweak it better for our purpose.
Cool.

bilu 02-24-2004 08:13 PM

About 2-pass encoding

I don't know which would be better as a 1st pass (when fitting one movie per DVD):

1) Encode with vqscale=2;
2) Encode with avg bitrate = max bitrate;

The information would probably be different in all those scenes where vqscale=2 would have gone over the max bitrate limit. And probably the information would be worse, or else there wouldn't be a problem doing 1st passes with vqscales bigger than 2.

But on the other side if the 1st pass fitted the DVD there would be no need for a 2nd pass... ;)


Bilu

digitall.doc 02-24-2004 08:20 PM

Sorry bilu, big noob here :oops:
I need, if possible, one or two steps backward...: how do I say mencoder to encode first pass with some settings and second pass with other. I mean:
1st pass:
vqscale, vbitrate=vrc_maxrate, 2 B frames, ... whatever
2nd pass:
no B frames, vqblur, trell, mv0, vbitrate=desired average bitrate,...
Don't know if I explain well myself. I can't still think about how to encode in every pass, if I even don't know how to make mencoder encode in each pass with different settings... if possible.
Sorry if I'm like a pain. :roll:

bilu 02-24-2004 08:22 PM

Quote:

Originally Posted by digitall.doc
Even with default value (1.25), with P low quantizer difference is 2.25, with P high quantizer, difference is 6.25.

Willing to have more to play with... :D

Well you could start by telling us about the quantizers on that Star Wars explosion. It's a good place to start testing the b_qfactor influence... ;)


Bilu

bilu 02-24-2004 08:34 PM

Quote:

Originally Posted by digitall.doc
Sorry bilu, big noob here :oops:
I need, if possible, one or two steps backward...: how do I say mencoder to encode first pass with some settings and second pass with other. I mean:
1st pass:
vqscale, vbitrate=vrc_maxrate, 2 B frames, ... whatever
2nd pass:
no B frames, vqblur, trell, mv0, vbitrate=desired average bitrate,...
Don't know if I explain well myself. I can't still think about how to encode in every pass, if I even don't know how to make mencoder encode in each pass with different settings... if possible.
Sorry if I'm like a pain. :roll:

2-pass example (for MPEG-4, but the important stuff is here):
http://www.mplayerhq.hu/DOCS/HTML/en...eat-divx4.html

As you see, it's easy :)

Meanwhile, I found that I'll use Linux instead of FreeBSD for encoding:
http://www.bsdnewsletter.com/2003/10/Features110.html

IMPORTANT NOTE: Except for vqscale=2 or vbitrate=vrc_maxrate if used on 1st pass, DON'T CHANGE PARAMETERS BETWEEN PASSES!!!! 8O 8O 8O

Bilu

vhelp 02-24-2004 08:38 PM

@ bilu,

which explosion is that from (scenewise) ??

..the one where the plain lands (the decoy gal is on) or some other scene?

I have another scene that I"m working on, which I think is a pretty good one
to work with, because it's got low-light in those scenes, and there is lots of
fire, and then it finishes off w/ another quiet low-light (red) scene.
.
.
That scenes is from my Fifth Element disk. You can find it at end of chp 6
and leads right into 7. If you got this DVD, take a look, and let me know
what you think of it, as a test scenario to use in mencoder/ffvfw etc etc :!:

-vhelp

bilu 02-24-2004 08:42 PM

@vhelp

I don't know what scene it is, digitall.doc didn't told :lol:

Big explosions and very fast action scenes are allways good for this sort of test. I have that DVD at home and will take a look, but I trust your judgement - it's an explosion, so it must be good :lol:

Off to bed now. Bye.


Bilu

bilu 02-25-2004 05:27 AM

Obligatory reading about Mencoder:

http://www.mplayerhq.hu/MPlayer/rele.../man_page.html
http://www.mplayerhq.hu/DOCS/HTML/en/mencoder.html
http://www.mplayerhq.hu/DOCS/tech/encoding-tips.txt

Note: Most docs are MPEG-4 focused, but there's lot of common information.

Bilu

vhelp 02-25-2004 10:47 AM

Hi bilu,

I've U/L'ed that clip I mentioned last night. The one from
the dvd, "The Fifth Element".. chp 6/7.

There were other encoding tests that I performed on this same
scene (ie, TMPG, ffvfw, and now, w/ MEncoder) :!:

In any event, since you already have the DVD, (mine is NTSC)
You can run your own tests, and compare against mine. See
if you get the same results, or whatever.

The only problem I still have w/ mencoder is the caos of
error messages it spits out. IMO, MEncoder is very picky/fussy about
everything !!

DOWNLOAD:

* 5_enc.m2v

-vhelp

rds_correia 02-25-2004 12:17 PM

Hi vhelp,
I'm sorry for not having posted about my experiences with mencoder under windows 98 se but right when I was going to try it, the harddrive of the laptop died...
Since parts for such an old laptop are very expensive, the company gave me a new one with XP Home preloaded...
But I promisse if I find a PC with windows 98 I'll give it a shot.
As to mencoder being very picky with options, I haven't been experiencing much messages on my latest trials.
Have you downloaded your build from the official site? That's the one I've been using along with the files provided by Vmesquita to recognize makeAVIS.
Or maybe the problem is OS version related :?

@all
Can someone post their experiences with mencoder under windows 98?

Cheers

vhelp 02-25-2004 12:44 PM

@ rds,

I've tried the log file thing, but its only for 2pass encodes 8O and I only do
one pass :!: - - so, nothing gets writen to file. FWIW, I use the following
param in my string for mencoder:

Code:

-passlogfile=h:\mencoder\5_enc.txt
** But, even w/out the .txt it still will not write any log file.

From the .HTML docs:
--------------------
Quote:

-passlogfile <filename>
......When encoding in 2pass mode, MEncoder dumps first pass' informations to the
......given file instead of the default divx2pass.log.
@ rds, and others...

I'm really desporate to find out HOW to avoide the errors. It sounds to me, like
the settings ALL have to work in concert, else the errors poor out. And, if a
given area ina scene is too much for a diven mencoder setting, errors will poor
out still.
.
.
I refuse to believe that its an OS thing. We are all working from the same build
and same command-line param strings, and values. But, one thing I did notice, and
that is, when ever I try others param string (when they are posted) I almost alwasy
get a different quality result. Sometimes, I get nothing but green video. ie,
when you posted amenophis's code, and I used it as a test, I got nothing but green
in my video, but, when I comment that line out, and used MY param string, I got a
perfect video (minus the errors, of course)

-vhelp

vhelp 02-25-2004 12:48 PM

PS: oh, did anyone D/L the sample I posted earlier here, I did w/ mencoder yet ??

You should be able to open it w/ all apps, except DVD2AVI. Even bviewer
opens it fine. I even got the green flat-line in bviewer's windoer :roll:

-vhelp


All times are GMT -5. The time now is 12:17 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.