On Thu, Apr 06, 2006 at 04:14:54PM -0700, Steven M. Schultz wrote: > > On Thu, 6 Apr 2006, Nicolas wrote: > > > When you've determined the bitrate, how do you choose the value for -q ? > > Pick a number between 2 and 8 :-) There are higher values (up to 31) > but in practice they're not used (not often). > > Folks think of "-q" as being "quality" and indirectly that's true. > > The encoder though does not make decisions based on "high quality" > or "low quality". > > It might be helpful to think of "-q" as representing the amount of > compression applied to a frame. Low values of 'q' mean LESS compression > is being applied - this retains more information which of course > means bigger files (higher bitrate). High values of 'q' mean MORE > compression - the extreme of 31 is the most aggressive compression > offered. Very small files (low bitrate) but probably unwatchable. > > Might be better to think of the specified value of 'q' as being > the "quantization floor" or "mimimum amount of compression applied" > rather than "quality". The value you specify is the value that the > encoder will NOT go BELOW. The encoder can (indeed MUST) go HIGHER > than the value you specify - that's the 'q=' lines logged by the > encoder. > > Part of the "art of selecting '-q'" is realizing that too low of a > value does NOT improve the quality at all - if you can't see the > difference between -q2 and -q3 why waste the bits? Similarily for > '-q 4' vs '-q 5'. If you can't see the difference then why spend > the extra bits for 4 when 5 would work ok? > > Using a lower value than necessary means that frames will be less > compressed and use more bits for no purpose - they're wasted. True, > it's "higher quality" but quality you can't see is pointless. Put > feature or short subject on the DVD with the bits that are saved by > setting the quantization floor up a point. > > There aren't any firm/fixed rules for how to set the '-q'. If you > set it too low either 1) the encoder will raise it to what is necessary > to accomodate the bitrate constraints or 2) you're wasting bits > on invisible quality. If you set it too high then you're tossing > quality away ;( > > Sorry to be so "vague" but it is a bit of an art form - there's no > "use -q N" magic rule. > > You might find that '-q 5' will avoid the rate spike you're fighting. > Maybe '4' is not applying quite enough compression in a few places. > Might be worth a try as an experiment. > > Cheers, > Steven Schultz
Steven, You wrote: > Might be better to think of the specified value of 'q' as being > the "quantization floor" or "mimimum amount of compression applied" > rather than "quality". Could that explain why I can't get a smaller m2v file when increasing the q amount? I used -q 4 and -q 6, and the file size does not really change... As usual, I'm still experimenting on my "noisy Hi8 tapes". ;-) BTW, I now use: yuvcorrect -v 0 -T INTERLACED_BOTTOM_FIRST | yuvscaler -v 0 -I ACTIVE_702x560+8+8 -M BICUBIC | y4mspatialfilter -L 5,0.94,1,1.00 -C 4,0.94,1,1.0 | yuvmedianfilter -v 0 -t 0 | yuvdenoise -v 0 -s 1,2,2 -g 0,0,0 -t 2,3,3 | mpeg2enc -v 0 -r 32 -4 1 -2 1 -D 10 -g 6 -G 15 -q 4 -b 9200 -f 8 -o $1 I tried several values for y4mspatialfilter and yuvdenoise, but I really can't reduce noise without loosing too much details. The image is flatened, and I really want to keep all the details. However, I'm worrying about the values I get when mplexing the audio and video stream: INFO: [mplex] Average bit-rate : 8652000 bits/sec INFO: [mplex] Peak bit-rate : 9354000 bits/sec The average and peak bit-rate are only 7% different. I understand that's because the video is really noisy. But does that proves mpeg2enc can't cope with all the noise, and the 9200kbps bitrate I use isn't enough? I hope that's ok, because I would like to respect the mpeg2 standards, and I don't want to blur too much my video... What's your opinion? Nicolas. ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users