Explanation of "keyint", "vqmin","vqmax","vqscale" etc

For help and support with PS3 Media Server in general
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

Explanation of "keyint", "vqmin","vqmax","vqscale" etc

Postby Law » Mon Jun 01, 2009 8:57 am

Hi guys,

I've got a wireless G link to my PS3 and a 3.16GHZ Core2Duo with 4 gigs of RAM. I've been fiddling with my quality settings because I can see some artifacting in the quality setting "Good for HD wifi" (i.e. the one with keyint 25).

I'd like to tune it a bit but I'm not sure what all these settings mean. I've spent some time on the internet researching them but I cant find a detailed document telling me what vqmin, vqmax, vqscale, keyint, and all of those things mean and their affect on CPU usage and network bandwidth. Essentially I want maximum quality that wont nuke my CPU (some of my experiments resulted in my CPU topping out at 100%) and wont go over my network bandwidth.

a) Can someone please provide a detailed explanation of the individual settings, or point me to proper documentation that isn't written in shorthand or assumes you're a video codec expert?
b) Also, if someone with a similar setup like mine could tell me what their custom settings were to get higher quality than the "Good for HD wifi" setting but without going over network bandwidth or nuking their CPU, that would be great!

Posts: 4
Joined: Sat May 09, 2009 9:15 am

Re: Explanation of "keyint", "vqmin","vqmax","vqscale" etc

Postby pmos69 » Mon Jun 01, 2009 10:32 am

you should search the forums first:
Posts: 147
Joined: Mon Jan 19, 2009 3:37 pm

Re: Explanation of "keyint", "vqmin","vqmax","vqscale" etc

Postby Law » Mon Jun 01, 2009 11:45 am

Thanks, that helped, but by no means did it answer all of my questions.

For example, why would you use vqscale on some of your quality settings but not on others? Having an understanding of each of the relevant functions on a technical level will of course enable me (and other posters I'm sure) that are constrained by wifi to finetune their quality without having to run up and down the stairs to see what happens when you change variable X, but not Y.
Posts: 4
Joined: Sat May 09, 2009 9:15 am

Re: Explanation of "keyint", "vqmin","vqmax","vqscale" etc

Postby otmanix » Mon Jun 01, 2009 12:46 pm

There are two variables which PMS doesn't know:
1. the CPU-power avialable for transcoding
2. the maximum network bandwith
Both variables combined with MPG2 video quality settings in PMS (quantizer- and keyframe values) will lead to very different results, depending on your CPU and network.

So if you have a weak wireless network connection and a not up to date CPU forget about streaming/transcoding HD videos.

Another topic is what Video engine do you use for playback?

Is it MEncoder/Tsmuxer? (which doesn't transcode but remux as default) If yes, the MPG2 video quality settings aren't used at all...
Is it Avisynth/Mencoder, Avisynth/ffmpeg oder Mencoder? If you use Avisynth and CPU-power is the bottleneck you can use CoreAVC for optimization (http://otmanix.de/english/2009/06/01/java-ps3-media-server-for-dummies-chapter-5-videolan-and-avisynth/).


Consider reading MPEG2 Encoding howtos if you want to have detailed infos about quantizer and keyframe settings.
Also consider to use 200Mbit/s DLAN instead of WLAN which will just work as expected...
I provide NO application support via PM, so please post your question to the forum.
PS3 Media Server related articles on my blog: http://otmanix.de/?cat=11&lang=en
User avatar
Posts: 528
Joined: Fri Jan 30, 2009 12:40 am
Location: Bavaria, Germany

Re: Explanation of "keyint", "vqmin","vqmax","vqscale" etc

Postby meskibob » Mon Jun 01, 2009 1:04 pm

Just as a side note, you may still experience some artifacts, even with the best quality settings, simply due to external interference with other wireless devices around you. viewtopic.php?f=6&t=534&p=2770
I provide NO application support via PM or email, so please post your question to the forum per the Forum Rules.
Posts: 4806
Joined: Mon Jan 19, 2009 4:11 pm

Re: Explanation of "keyint", "vqmin","vqmax","vqscale" etc

Postby Azrael » Mon Jun 01, 2009 11:16 pm

Ok, since I came here to try to find the same thing.. and didn't, I tried to find what I could on the definitions of these. Much of this comes from the mencoder manual: http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html#CODEC%20SPECIFIC%20ENCODING%20OPTIONS%20(MENCODER%20ONLY). The manual from what I hear is a bit dated, and CPU processing has gotten a lot better, so their defaults and recommended values are likely on the high range for modern machines.

keyint - Keyframes - the value is one keyframe every "value" seconds. Lower values means more keyframes and a higher bandwidth usage. Impact on CPU is low. High action movies benefit from more keyframes.
Code: Select all
maximum interval between keyframes in frames (default: 250 or one keyframe every ten seconds in a 25fps movie. This is the recommended default for MPEG-4). Most codecs require regular keyframes in order to limit the accumulation of mismatch error. Keyframes are also needed for seeking, as seeking is only possible to a keyframe − but keyframes need more space than other frames, so larger numbers here mean slightly smaller files but less precise seeking. 0 is equivalent to 1, which makes every frame a keyframe. Values >300 are not recommended as the quality might be bad depending upon decoder, encoder and luck. It is common for MPEG-1/2 to use values <=30.

Wiki Definition of Quantization - http://en.wikipedia.org/wiki/Quantization_(signal_processing)
vqmin/vqmax - Minimum and Maximum Quantization values - This is your basic "quality" setting. Higher numbers means rougher encoding but lower CPU usage. From what I can tell, the encoder will attempt to keep the bitrate and CPU usage more constant with a min/max setting. This makes these two ranges better for WiFi streaming to reduce spikes. This is how close the encoder attempts to match the source material, with 1 being a "perfect" match but since it's still an algorithm, approaching the equivalent of "infinity" things can get.. weird. Encoder manual itself does not recommend a 1 although I assume they have improved it since this manual was written.
Code: Select all
minimum quantizer
   1 - Not recommended (much larger file, little quality difference and weird side effects: msmpeg4, h263 will be very low quality, ratecontrol will be confused resulting in lower quality and some decoders will not be able to decode it).
   2 - Recommended for normal mpeg4/mpeg1video encoding (default).
   3 - Recommended for h263(p)/msmpeg4. The reason for preferring 3 over 2 is that 2 could lead to overflows. (This will be fixed for h263(p) by changing the quantizer per MB in the future, msmpeg4 cannot be fixed as it does not support that.)

Code: Select all
   Maximum quantizer, 10−31 should be a sane range (default: 31).

vqscale - Fixed quantization - Like vqmin/max but a fixed "quality". This is used when bandwidth matters less than video quality. Bitrate will fluctuate with the contents of the video. I only assume that CPU can spike as well when it hits a complicated section of video.
Code: Select all
   Constant quantizer / constant quality encoding (selects fixed quantizer mode). A lower value means better quality but larger files (default: −1). In case of snow codec, value 0 means lossless encoding. Since the other codecs do not support this, vqscale=0 will have an undefined effect. 1 is not recommended (see vqmin for details).
Posts: 2
Joined: Mon Jun 01, 2009 10:45 pm

Return to General Help and Support

Who is online

Users browsing this forum: No registered users and 8 guests