CQTester nur EXE downloads: 7259 - (VB Runtime necessary)
CQTester Help (This text) downloads: 313

There are some methods to fit a film on one CD in the CQ mode of TMPGenc (I will not discuss the question whether CQ is better than 2 pass VBR here...): Tok, CQMatic, DVD2SVCD, "by hand" calculation..., but all these methods couldn't convince me, since they support usually no TMPGEnc cuts, or are quite complicated or not batches are possible. Therefore I developed the CQTester. The approach is relatively simple: The xxx.tpr file is analyzed (i.e. for cut points) and from the used ranges approx. 1 sec. is encoded per minute film (you may change this default of course). The size of the resulting MPG file is projected to the total film length and from the deviation a new CQ value is computed. With this CQ value the next test is run and so on. (CQMatic has a similar approach).
After max. 9 attempts a "suitable" CQ value should have come out. The "prediction accuracy" is approx. 2-3% deviation.
CQTester has been developed under Windows2000 and XP (the program uses the PSAPI.DLL which is available only in these operating systems) but it should run in W98/ME also.
Other requirements:
To work with CQTester at least one range MUST be "cut". However the range may be the whole film. In this case go to "Settings" in TMPGEnc, select "Advanced" double click "Source range" but mark nothing. Click on "Cut editing" and select "Cut except currently selected area". Do not just select a "start frame" and an "end frame" WITHOUT to cut - "Start frame" must be 0 and "End frame" -1!. If you use Stream type "Video only", then only the whole film MAY be cut (otherwise your audio wouldn't fit to your cut video). An example is in the appendix.

If you want to use elementary video and audio streams, the CQTester can multiplex the streams after encoding with bbmpeg, for this option the modified version is necessary from the DVD2SVCD homepage: www.dvd2dvd.org . The necessary bbMPEG version is to be found left down: bbMPEG v1.24 beta 18 (SemiCLI In the bbMPEG settings "run in batch mode" must be activated. If the final destination for the film is a DVD, and you plan to use dvdauthor (i.e. with my GUI for dvdauthor) to do the authoring, then you may choose to multiplex with mplex. In this case the multiplexing with mplex is done with the option - f 8 to create a dvdauthor compatible MPG file. Please use this option only for DVD compliant audio/video streams.
Additionally CQTester can convert the audio file with BeSweet into the target format (with some captures of DVB Streams I had no more sound after 10-20 min in the encoded mpeg - if the audiostream was transcoded with BeSweet before = > no more problems), for this option an installed BeSweet is necessary, to be found here dspguru.doom9.net

After the first start of CQTester some file paths must be set. Click "Settings":
The paths to TMPGEnc.exe, RunbbMPEG.exe, mplex.exe and BeSweet.exe may be typed in or selected (path to RunbbMPEG.exe, mplex.exe and BeSweet.exe is only necessary if you want to use these options). "Use BeSweet for audio file before encoding" can be activated only after a valid path to BeSweet.exe is present. Similar "Auto multiplex with bbmpeg after encoding" works only with valid path to RunbbMPEG.exe. A detailed description of the individual attitudes is in the
You may choose either "fixed Test settings"  where the samples have a fixed length and a fixed frequency (the intervall between tho samples), or "dynamic Test settings" (default setting) where the length of the samples is calculated as multiples of the used GOP length and the frequency is calculated according to the given percentage of the total film. "Default min/CD" is the default amount of minutes at which the CQTester would splitt the Film on two (or even more) CDs (see
"Number of CD's").

In the main windows the value for "MB per CD" depends on the CD size (1MB = 1048576 bytes!). Everyone may change as he likes it. These settings as well as the setting for MB per CD are stored in the Windows registration. "Number of CD's" is determined according to the film length and the set value for "default min/CD" from the TMPGEnc project (can be changed for each project). The CQ value is likewise read first from the TMPGEnc project file but can be changed before you start and changes naturally during the optimization.
You may load your project file (saved before in TMPGEnc) with the "Open" Button or type it in (with the full path).
Afterwards the contents of the projects file is analyzed (results are in the right window) and shown in the lower window.

Now you may change the number of CD's (standard is 1 CD per 90 min film) the "start" CQ value to adapt and if necessary project-specifically also still the MB per CD value (e.g. if one wants to pack two films on CD...). If  you have selected elementary streams in TMPGEnc (both Video+Audio or video only), additionally the size of the audio file is computed (according to the audio bit rate set in the TMPGEnc project) as well as the multiplex - overhead (the usual overhead of bbmpeg is used). Both values can be also changed here (necessarily if you are using another mux - program or several audiostreams are desired). These values are added to the determined size of the video file during the optimization and the result is compared with the "MB per CD" value.

Then there are the following possibilities:
"TestCQ": Only one run with the momentarily set CQ value is done and a prediction for the entire film is given (in the popup window). This is practically to test whether the film with a personal CQ border would still fit.


"Opt. CQ": The optimization with up to 9 runs is started. The "results" are to be seen in the lower window. Can be used to predict the CQ values of some projects and encode them with TMPGEnc's own batch procedure.

"Opt. + Enc." The optimization and afterwards the encode for the whole film (with the optimized CQ value) is started, if selected the conversion of the audio file with BeSweet is also done. If you have selected elementary video and audio streams as output, these are multiplexed after encoding. If the option "Close after encode" is activated, CQTester is terminated after encoding. The steps of the optimization are stored in a log file, if one wants to check it.

"Stop" terminates the optimization (but not TMPGEnc).

"Quit" terminates the program.

If one wants to encode several films, you must create the TMPGEnc projects before and save them (TMPGEnc text format. Then you can load these projects successively into the CQTester. If necessary the number of CD's and MB per CD can be adapted individually (for elementary Streams also the audio and Mux size) then click on "Add To Batch". In order to remove a project from the batch list again, first click "Show Batch" select the project to be removed and click on "Remove". In addition one can check the batch list here before start. To change the settings for a specific project in the batch list remove it and add the project again (with the new settings). If the list is OK, start with "Batch Run". With version 0.19 or higher the batch list may also be saved and reloaded. Attention: The list is not rechecked for errors.


Much fun,

The default for the optimization (dynamic Test Settings) is a samplelength of 2 GOPs. This is suitable if you encode with a DVD compliant GOP length (like 15 frames per GOP). In this case CQTester would use 30 frames per sample which corresponds to a samplelength of 1.2 seconds (PAL = 25 FPS assumed).  Given a percentage of 2% one sample is encoded each minute of the film. If you use a much longer GOP length, then you may get better results if you set the multiplier to 1 GOP (otherwise one sample is encoded every 5 or even more minutes of the film and therefore the differences between different offsets rise).
Specialists may use also different values for the optimization, by default for "Fixed Test settings" a 0.72 sec. sample is encoded every 60 sec. of the film. One can also change these defaults in the Settings. In addition the sample starting is not second 0, but the second indicated by "start offset (sec.)". During the optimization the CQTester always changes between two different offsets (thus with the default settings always between second 2 and second 31). Sometimes the test function oscillates (e.g. with same CQ one gets 105% with the offset 2 seconds and of 95% with an offset of 31 seconds). In this case the offset is shifted automatically for some seconds. If after 9 "attempts" no suitable CQ to be determined an average value is computed (with "leases square fit" by the last 8 attempts). The "process" of the optimization can be viewed with "ShowGraph". Here you can also visualize "old" optimizations, if you load the appropriate CQTester log files.
You can also change the entry for the BeSweet options. Most simply, if you use the BeSweet GUI, and copy the appropriate part of the command line into the text field "BeSweet settings".
One note to Automux with bbmpeg: Since the settings differ somewhat, whether MPEG1 or MPEG2 streams are encodet, the CQTester uses two "Templates" for starting bbmpeg: defaultmpeg1.ini and defaultmpeg2.ini. These two files correspond to the "default.ini" file which is saved by bbmpeg, if you save your settings there. If you want (or need) other settings, then replace  the defaultmpeg1.ini and/or defaultmpeg2.ini with your preferred default.ini and rename it accordingly. Alternatively you may use a text editor to adapt the settings.

Because it was so far the most frequent problem, here is an example of the necessary cut for "whole film" with TMPGEnc