PDA

View Full Version : perl script for analyzing xvid 2nd-pass output (v.2)


canadian_fbi
9th April 2002, 05:26
a while ago, primitive posted some perl scripts that analyze debugview output of first and second passes, and write information about frame sizes and quants into a file readable by spreadsheet programs. for a detailed description of what these scripts do (and therefore the basic features of this new script), see this thread:
http://forum.doom9.org/showthread.php?s=&threadid=22005

well, i found the second script particularly useful for analyzing the second pass quants, and made some modifications to it. basically it has the following new features:

- input/output file can now be input from command-line
(format: second_pass_analyze.pl <input> <output>)
- calculates average quant value for all frames
- displays total number of i-frames and p-frames
- displays quant distribution of i-frames and p-frames
- calculates average quant value for i and p-frames
(hopefully this will be made obsolete soon by the addition of b-frames ;) )

if you don't want to input filenames at the command-line, entering no arguments will use the default values hardcoded as $infile and $outfile_second, in case you always have the same log file name and don't want to type it in every time. similarly, it will also work if you just input the input filename, by writing results to the default output name. don't try passing the output filename argument only though :)

download this new version of the second pass analyzer here: http://www.disconnect.net/second_pass_analyze.pl
i found it particularly useful when i got curious as to what quants i-frames were getting... turns out they were a lot higher than they should've been and i had to lower the max on them. any comments would be very welcome as this is the first perl script i've written (modified actually) since my internet programming class :|

p.s.: thanks to primitive for starting this script and making it freely available to modify and improve and whatnot.

primitive
9th April 2002, 23:56
I love you.

I had thought that no one was using my little hack/script/whatever, but I'm glad it's been useful to someone. You basically implemented everything else I thought would be useful to have but never bothered doing (finer stat reporting) / didn't know how to do (command line args).

Time to try the new one out!

-p

philippas
10th April 2002, 06:45
I have no idea about perl, how do you run the pl script ?

primitive
10th April 2002, 07:08
Originally posted by philippas
I have no idea about perl, how do you run the pl script ?

If you are running a linux distribution, you already have it on your machine. just type "perl <script_filename>"

If you are running windows, you most likely don't already have Perl. Go to http://www.activestate.com and download their distribution of the Perl runtimes for win32. After installing that, you will be able to run and debug scripts from the command line. If you'd prefer something graphical, download Komodo as well; it's an IDE for Perl that'll give you a nice frontend without having to delve into that hellhole most people refer to as the Windows command line.

-p

philippas
10th April 2002, 07:15
Thanks! :)

canadian_fbi
10th April 2002, 23:38
hey, sorry i didn't reply sooner, i've been quite busy lately. actually i worked on this script instead of more important (and less interesting) things for school i should've been doing :)

primitive, have you tried out this latest script yet? it's really not that much different than yours, other than just adding the analysis of separate types of frames. i wonder if only analyzing the movie frames and discarding the credit frames would be something useful... so that way you don't have an odd spike in your graph at a high quantizer value, and your avg. quant is better describing picture quality throughout the main movie, without getting artificially bumped up by the credits. though if you were encoding credits at a % level instead of at a fixed quant (like i do) you might want to know what the credits are doing.

canadian_fbi
14th April 2002, 06:49
for those interested... i've made a couple improvements to this script:

- movie-only mode added. by entering "-m" (or -movie), the script will ignore the credits portion of an encode. useful if you use constant quants in your credits and you don't want a bunch of high credit quantizers showing up in your graph or bogging down the average.

- the script will now automatically detect multiple movies in one debugview log file (in the form 1stpass-2ndpass-1stpass-2ndpass, etc.), and generate separate log files for each. i often encode a movie followed by an iron chef episode overnight, so now this will automatically generate a separate stats report for each.

let me know if anyone finds any bugs - i haven't tested this *that* rigorously. and let me know if anyone finds it useful :)

you can download this script here (http://www.disconnect.net/second_pass_analyze.pl).