View Full Version : avs2qxvid.bat [AVS to Quality XviD]


henryho_hk
16th December 2006, 18:11
You wrote an AVS. You wanna encode it to a good quality XviD file. But you don't like GUI. This batch script is for you.

Download the full package (version 2.5h) here:
http://www.sendspace.com/file/ni08oz
(7zip compressed twice with password XviD_presets)

The main purpose of my batch script is to implement Teegedeck's XviD presets (http://forum.doom9.org/showthread.php?t=119399) using squid_80's version of xvid_encraw (http://forum.doom9.org/showthread.php?t=98469). The main features are:


Automatic preset selection through 3% compressibility test
Audio encoding using LAME, OggEnc2 and BePipe (which requires MS .NET framework)
Single audio track muxing (mp3, ogg and ac3) with audio time shift support (in DGIndex naming style)
MKV chapter support via zone definitions
Progressive & interlaced encoding
Anamorphic encoding (PAL_16:9, NTSC_4:3, etc.)
Target size or bitrate by KB, MB, GB, Kbps and bppx (audio size included for KB, MB & GB, yet no overhead calculation)
Batch AVS encoding, with independent settings for each AVS
Zone weights ... useful for credits (experimental, potential interference with presets)
(Newer) standalone support (also experimental; customized from Teegedeck's Fast & HQ presets ~~ custom matrix warning), plus plugh's alt 2-pass mode (read bin\xvid_presets_25h.csv)
Kopernikus's HVS mods & custom params (read bin\xvid_presets_25h.csv)
Free creation of your own presets (read bin\xvid_presets_25h.csv)
Free choice of custom matrix (read bin\xvid_presets_25h.csv)


This is how you use this batch script: Say, you have abcdef.avs ready in certain directory. Now make a plain text file abcdef.enc.txt in the same directory with one single line reading "TGHQ-CT 1.45GB". NTSC 16:9 footage? Make it "TGHQ-CT 1.45GB NTSC_16:9" Interlaced encoding? Append "TFF" or "BFF" at the end of the line. Audio track? Put it inside the AVS or make a separate mp3 or ogg in the same directory. OGM chapters? Create another plain text files abcdef.zones.txt listing the frame numbers (The default zone weight is 1.0 and you can put something like 0.1 next to the frame number for credit zones). When all is ready, drop abcdef.avs onto avs2qxvid.bat and then wait for your CPU load to drop to zero. ^_^ You can at most drop 9 AVS files onto the batch at a time.

The following Teegedeck presets are supported: TGHQ-CT, TGFAST-CT, TGEDIT-00 and TGANIME-00. I have hacked a MTK-CT for standalones. If you know your source's compressibility, you can specify the levels directly (-30, -45, -58 or -90), e.g. TGHQ-58, MTK-45, etc. Note that if the target size or bitrate is too high or too low, it may not be respected, especially if you skip the compressibility test and levels directly.

To activate Kopernikus's HVS mods in your own presets, name them with prefix "HVS" and then specify the HVS params in the last column of bin\xvid_presets.csv, substituting the required double-quotes with single quotes.

Giving your own presets a suffix of "MTK" will enforce some standalone friendly parameters such as VBV and -alt2pass. Other options like QPel and b-frames are still at your own discretion. BTW, If you use the MTK presets, the batch script will always split your movies into AVI file(s) of 2000MB@ unless an OGG audio file or a zone list file is found in the same directory (in such cases a MKV file will be muxed.)

henryho_hk
26th December 2006, 15:39
Version 2.4a is now obsolete.

buzzqw
26th December 2006, 16:06
sorry henryho_hk but why compress twice and to password protected ? 7zip is a good archive program and i think your work is pubblic accessible...

BHH

henryho_hk
26th December 2006, 16:42
Version 2.5

Muxing is now performed using AVIMux_GUI, producing:
1. AVI for standalones (through MTK-nn presets).
2. OpenDML AVI (when zone file is not present).
3. MKV (when zone file is present).
4. Sorry that OGM support is removed.

Note: Version 2.5 is now obsolete.

henryho_hk
26th December 2006, 16:43
.... why compress twice and to password protected? ....

Just for a false sense of security. ^_^

elguaxo
26th December 2006, 18:03
11. Kopernikus's HVS mods & custom params

I started reading the HVS mods thread. The concept sounds great, but all those parameters were too much for me to start testing... I was waiting for some presets and here they are.

I see you use 2 options:
"-hvs_aq 'lc_lum 130 - theta lc_lum 140 - theta + lc_lum 40 - theta - lc_lum 50 - theta - 80 gl_lum - theta * quant +'"
"-hvs_aq 'quant 1 + lc_lum gl_lum 2 / - theta - lc_lum gl_lum 7 * 8 / - theta - lc_lum gl_lum 7 * 8 / 32 + - theta + lc_lum gl_lum 2 / 128 + - theta +'"

What is the idea behind these settings? Thanks!

henryho_hk
27th December 2006, 16:07
I started reading the HVS mods thread. ... I was waiting for some presets and here they are.

These presets are primarily for Teegedeck's (non-HVS) quality presets. I created the so-called HVS presets solely for experiments. I need the double-quotes to enclose the "columns" and therefore single-quotes are used within the column values. When I construct the real command-line, the single-quotes are changed back to double-quotes.

As for the ideas behind the HVS params, let's discuss in the HVS mods thread.

ChrisW77
27th December 2006, 21:19
This looks great, but can anyone help a newbie ?

Lets say I have a simple script

LoadPlugin("C:\AviSynth\plugins\DGDecode.dll")
LoadPlugin("C:\AviSynth\plugins\MVTools.dll")

video=mpeg2source("D:\video\project1.d2v", cpu=4, iPP=true, idct=5, info=3)
audio=MPASource("D:\video\project1 T01 DELAY 0ms.mpa")
AudioDub(video, audio)
ColorMatrix(hints=true)
ConvertToYV12(interlaced=false)
Crop(2,2,-2,-2,align=true)
Lanczos4Resize(640,360)

It's progressive, 16:9 720x576 Mpeg2 25fps PAL file.
Saved as simpletest.avs.
What would I add to simpletest.enc.txt ?
And how do you know what to add to simpletest.zones.txt

I just need a example, then hopefully I can figure out other tests from a example.

Any help, most appreciated, cheers.

henryho_hk
28th December 2006, 01:24
I have put some online help and usage samples in the batch script. You can read it by running the batch script without any parameters (double-click on the batch script). The default settings are pretty good actually and you can simply drag and drop your AVS on the batch script.

The format of simpletest.enc.txt is, for example,
-----start------------------------------------------------------
TGHQ-CT 0.147bppx VGA_1:1
-----end--------------------------------------------------------
or if you want to specify in kbps
-----start------------------------------------------------------
TGHQ-CT 1200kbps VGA_1:1
-----end--------------------------------------------------------
or if you want to specify a preset level (over/under-size warning)
-----start------------------------------------------------------
TGHQ-45 1200kbps VGA_1:1
-----end--------------------------------------------------------
or if you want anamorphic encoding (i.e., no resize inside AVS)
-----start------------------------------------------------------
TGHQ-45 1200kbps PAL_4:3
-----end--------------------------------------------------------
or if it is an interlaced footage
-----start------------------------------------------------------
TGFAST-45 1200kbps PAL_4:3 TFF
-----end--------------------------------------------------------

As for zone file, you simply list the zone points (frame numbers) on every line, e.g.:
-----start------------------------------------------------------
0
104435
298597
403768
-----end--------------------------------------------------------

BTW, since your footage is progressive, you should remove "iPP=true" in your AVS script.

pancserzso
28th December 2006, 01:29
Good idea, but it's still buggy on my xp64 machine.

It says 'Files' is not recognized as an internal or external command,
operable program or batch file.

Files was unexpected at this time.

I think it's a C:\Program Files\, just an idea

pancserzso
28th December 2006, 01:35
FIX:

I moved it onto the root of the drive and now it works!

ChrisW77
28th December 2006, 01:48
Thanks for your help, henryho_hk :)
I'll have a closer look at the batch script.

Oh, and thanks for pointing out the "iPP=true", I didn't spot that.

henryho_hk
28th December 2006, 15:58
BTW, ChrisW77, although I've included audio encoding from AVS, I suspect that it may lower the video encoding speed. Hence, I suggest you to encode the audio separately and let my script to do the muxing only.

henryho_hk
28th December 2006, 16:13
Thank you for pointing out this bug, pancserzso.

The script was designed to allow spaces in the batch or the script filename/paths but the recently added codes have some quotation marks missing. Hopefully I have put in all necessary ones now and it will work again.

Note: Version 2.5a has been replaced by 2.5b.

ChrisW77
28th December 2006, 21:03
Still couldn't get it to work, it seems to say something in the DOS window, then closes. Perhaps, it was a similar message pancserzso's, but it was too quick to see.

I just named a .enc.txt file the same as the .avs file, and added

TGFAST-CT 1300kbps PAL_16:9 test.avs

to it, and it just disappears. If I take out test.avs, it acts just like when you double-click your batch file, and gives the same info thats in the batch file.
I didn't use a zones.txt file, in the end, as it looked like you didn't actually require it unless you need to specify key points ?

When that new attachment has been verified, I'll try that one, and see how it goes. Damn, I hate being a newb, at time. :p

henryho_hk
29th December 2006, 00:16
It should be:

TGFAST-CT 1300kbps PAL_16:9
or
TGFAST-CT 1300kbps PAL_16:9 PRO

"PRO" means progressive. As for zone file, you can also specify the zone weights such as credits. I have not tried to test it much and you can help to evaluate it.

BTW, does the included sample work for you?

ChrisW77
29th December 2006, 01:59
BTW, does the included sample work for you?

It does, yes. Comes up with "Checking Source....", Streaming Frame 0, and ends up with "All Completed......" "Press any Key to Continue", and you end up with 2 files sample_MTK-45_br_1381.avi, and sample_MTK-45_br_1381.stl.avi.

As I type this, I've used your "TGFAST-CT 1300kbps PAL_16:9 PRO", but this time I copied the 2 files, test.avs and test.enc.txt, to the actual directory i put avs2qxvid_25, which is simply C:\avs2qxvid_25, and now it works :D
If I keep the 2 files in a different directory, it doesn't work, but in the same directory, it works. I can live with that, as long as I have the space on the c: drive.

Thanks again, henryho_hk :)

Just to add, the original file, using the script in my first post, was 720x576, with a DAR of 1.778 (16:9). Now, after using "TGFAST-CT 1300kbps PAL_16:9 PRO", I'm left with a nice looking xvid, but the DAR is now 2.586 (31:12), yet the SAR remains 1.778 (16:9). Weird. Any ideas ?

henryho_hk
29th December 2006, 15:30
ChrisW77, version 2.5a should allow you to put the batch script directory and the AVS directory anywhere you like (as long as the directory & file names are supported by the system code page). Actually, 2.5 works too (although you can't have any space character in the names).

The ARs are indeed correct. Unlike monitor pixels being squares (VGA_1:1), the TV pixels are rectangles. NTSC_16:9, PAL_4:3, and so on are called "pixel aspect ratio" (PAR) or "sample aspect ratio" (SAR), as reported in the form of "Video Type" and "Aspect Ratio" by DGIndex.exe. "Display aspect ratio" (DAR) is a combination of the resolution and SAR, e.g.:

2.586 = (640 / 360) * (16 / 11)

Yes, PAL_16:9 has pixels in 16:11. It's ~~REALLY~~ confusing. As for your script, since you have performed a resize operation already, you should perform a "square pixel encode" and use VGA_1:1. On the other hand, you may consider keeping the vertical resolution at 576 (humans are more sensitive to vertical resolution) and then either:

1. encode at PAL_16:9 without any resize; or
2. encode at VGA_1:1 while stretching the width (ouch.... I hate these calculations)

BTW, you can also use MPEG4Modifier to correct your encoded footages by setting their PAR as "Square Pixels". There won't be any re-encode and it runs fairly fast.

ChrisW77
29th December 2006, 20:27
Thanks again, henryho_hk. I'll get the newer file, and will have a few tests using this. Thing is, it's still waiting for approval.

It's ~~REALLY~~ confusing. As for your script, since you have performed a resize operation already, you should perform a "square pixel encode" and use VGA_1:1. On the other hand, you may consider keeping the vertical resolution at 576 (humans are more sensitive to vertical resolution) and then either:

It is confusing, but I see what you are saying. I'll have to have a read up about PARS and DARS.

1. encode at PAL_16:9 without any resize; or
2. encode at VGA_1:1 while stretching the width (ouch.... I hate these calculations)

I mostly resize when I use filters, as it's a nice speed up as the filters can work on a smaller frame size, as opposed to filtering 720x576. I need a faster CPU.

I'll have a look at MPEG4Modifier, as that sounds a great program.

Thanks again for your help. :)

henryho_hk
30th December 2006, 07:41
it's still waiting for approval.

I've just updated the links in the 1st post. You can download the latest version there.

I forgot to put the DAR (no, not PAR this time) value in the MKV header when muxing. This is corrected in version 2.5b.

cmw
24th January 2007, 15:37
Ok, I'm a bit stumbled here:

For startes, dragging the samples.avs on the script makes the avimux.exe crash (that nifty little "send problem report" window occurs).

Edit: It may aswell be an other problem, since when i watch the batch script working, instead of actually doing sth, xvid_encraw just seems to output the help, as if the given command was invalid (thus probably resulting in avimux to crash because theres nothing there to mux).

Here is the output:



"Checking Source...."
Streaming frame 224 (of 240, 93.33%)
240
Das System kann die angegebene Datei nicht finden. //File cannot be found... which file? probably the error is here
Fehlender Operand //Missing Operator
Fehlender Operand
(standard_in) 1: parse error
(standard_in) 1: parse error

start "6% Compressibility Test - Single Pass" /b /wait /belownormal "C:\autok\bi
n\xvid_encraw_20061213.exe" -zones 0,w,1,KO -threads 3 -packed -progress 100 -m
ax_key_interval -interlaced 2 -par 7:5 -quality 4 -vhqmode 0 -max_bframes 2 -bq
uant_ratio 162 -bquant_offset 0 -qtype 1 -qmatrix "C:\autok\matrix\Didees-SixOfN
ine.cqm" -nochromame -turbo -single -cq 3 -stats "C:\autok\tmp\sample.ct.stats"
-type 2 -i "C:\autok\sample.ct.avs" -avi "C:\autok\sample.ct.avi"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


xvid [warn]: Can't find xvid_plugin_ssim, ssim calculations will be disabled
xvid_encraw built at 22:48:46 on Dec 13 2006
Usage : xvid_encraw [OPTIONS]

Input options:
-i string : input filename (stdin)
-type integer: input data type (yuv=0, pgm=1, avi/avs=2)
-w integer: frame width ([1.2048])
-h integer: frame height ([1.2048])
-frames integer: number of frames to encode

Output options:
-dump : save decoder output
-save : save an Elementary Stream file per frame
-o string : save an Elementary Stream for the complete sequence
-avi string: save an AVI file for the complete sequence
-mkv string: save a MKV file for the complete sequence

BFrames options:
-max_bframes integer: max bframes (2)
-bquant_ratio integer: bframe quantizer ratio (150)
-bquant_offset integer: bframe quantizer offset (100)

Rate control options:
-framerate float : target framerate (25.0)
-bitrate [integer] : target bitrate in kbps (700)
-size integer : target size in kilobytes
-single : single pass mode (default)
-cq float : single pass constant quantizer
-pass1 [filename] : twopass mode (first pass)
-full1pass : perform full first pass
-pass2 [filename] : twopass mode (2nd pass)
-altpass2 [filename] : twopass mode (2nd pass alt)
-zq starting_frame float : bitrate zone; quant
-zw starting_frame float : bitrate zone; weight
-max_key_interval integer : maximum keyframe interval (300)

Single Pass options:
-reaction integer : reaction delay factor (16)
-averaging integer : averaging period (100)
-smoother integer : smoothing buffer (100)

Second Pass options:
-kboost integer : I frame boost (10)
-kthresh integer : I frame reduction threshold (1)
-kreduction integer : I frame reduction amount (20)
-ostrength integer : overflow control strength (5)
-oimprove integer : max overflow improvement (5)
-odegrade integer : max overflow degradation (5)
-chigh integer : high bitrate scenes degradation (0)
-clow integer : low bitrate scenes improvement (0)
-overhead integer : container frame overhead (24)
-vbvsize integer : use vbv buffer size
-vbvmax integer : vbv max bitrate
-vbvpeak integer : vbv peak bitrate over 1 second

Other options
-noasm : do not use assembly optmized code
-turbo : use turbo presets for higher encoding speed
-quality integer : quality ([0..6]) (6)
-vhqmode integer : level of R-D optimizations ([0..4]) (1)
-bvhq : use R-D optimizations for B-frames
-qpel : use quarter pixel ME
-gmc : use global motion compensation
-qtype integer : quantization type (H263:0, MPEG4:1) (0)
-qmatrix filename : use custom MPEG4 quantization matrix
-interlaced [integer] : interlaced encoding (BFF:1, TFF:2) (1)
-nopacked : Disable packed mode
-noclosed_gop : Disable closed GOP mode
-lumimasking : use lumimasking algorithm
-hvs_aq string : use custom adaptive quantisation equation
-hvs_lmb string : use custom lambda equation
-stats : print stats about encoded frames
-ssim [integer] : prints ssim for each frame ([0..4]) (2)
-ssim_file filename : outputs the ssim stats into a file
-debug : activates xvidcore internal debugging output
-vop_debug : print some info directly into encoded frames
-nochromame : Disable chroma motion estimation
-notrellis : Disable trellis quantization
-imin integer : Minimum I Quantizer (1..31) (2)
-imax integer : Maximum I quantizer (1..31) (31)
-bmin integer : Minimum B Quantizer (1..31) (2)
-bmax integer : Maximum B quantizer (1..31) (31)
-pmin integer : Minimum P Quantizer (1..31) (2)
-pmax integer : Maximum P quantizer (1..31) (31)
-drop integer : Frame Drop Ratio (0..100) (0)
-start integer : Starting frame number
-threads integer : Number of threads
-progress [integer] : Show progress updates every n frames (10)
-par integer[:integer] : Set Pixel Aspect Ratio.
1 = 1:1
2 = 12:11 (4:3 PAL)
3 = 10:11 (4:3 NTSC)
4 = 16:11 (16:9 PAL)
5 = 40:33 (16:9 NTSC)
other = custom (width:height)
-help : prints this help message

NB: You can define 64 zones repeating the -z[qw] option as needed.
Das System kann die angegebene Datei nicht finden.
Das System kann die angegebene Datei nicht finden.

Source FPS =
No. of frames for CT = 0
Size of selected frames = 0
Target Bitrate = kbps
(standard_in) 1: parse error
(standard_in) 1: parse error
Compressibility Test =
Selected Level = 30

Preset to use = TGFAST-30

start "TGFAST-30 - Pass 1/2" /b /wait /belownormal "C:\autok\bin\xvid_encraw_200
61213.exe" -zones 0,q,3,KO/20,q,3,KO/30,q,3,KO/50,q,3,KO/100,q,3,KO/150,q,3,KO/2
00,q,3,KO -threads 3 -packed -progress 100 -max_key_interval -interlaced 2 -par
7:5 -quality 5 -vhqmode 1 -max_bframes 2 -bquant_ratio 162 -bquant_offset 0 -qt
ype 1 -qmatrix "C:\autok\matrix\eqm_v3ulr_rev3.xcm" -nochromame -turbo -lumimask
ing -pass1 "C:\autok\tmp\sample.stats" -type 2 -i "C:\autok\sample.avs"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


xvid [warn]: Can't find xvid_plugin_ssim, ssim calculations will be disabled
xvid_encraw built at 22:48:46 on Dec 13 2006
Usage : xvid_encraw [OPTIONS]

AGAIN XVID-HELP

NB: You can define 64 zones repeating the -z[qw] option as needed.
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
1 Datei(en) kopiert. //1 file copied

start "Muxing" /b /wait /min /belownormal "C:\autok\AVIMux_GUI_1_17_7\AVIMux_GUI
.exe" "C:\autok\tmp\sample.amg"

All completed..............
Drücken Sie eine beliebige Taste . . . //press a button


-----------------------------
-----------------------------



Well now I have this avs:


DGDecode_mpeg2source("C:\Temp\DVD\win\VTS_01_1.d2v")
edeintted = last.AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
TDeint(order=1,edeint=edeintted)
crop( 6, 0, -2, -2)

LanczosResize(640,480) # Lanczos (Sharp)


Now since the avs itself does all the resizing/cropping I want, do I still have to add a 4:3 to the .txt? Or a 1:1? Also, the avs has the deinterlacing stuff in it, would i still have to add tff?

Then, I have multichannel mp4 audio I want to mux in. Now I understand that this batch does not do that, but it doesn't matter, as long as I can take the size into account. Now if I do a bitrate calculation and then add the calculated kbps to the .txt file, that should give me the predictet filesize by the bitrate calculator, shouldn't it? (as long as I don't use too abstruse values).

I've ripped my stuff since years now, but his one gets over my head :)

henryho_hk
24th January 2007, 17:40
cmw, I have only tested my batch script under english windows. Hence, it may have some errors under other locale. I found that some errors had occurred at the beginning and so the script failed to obtain the FPS, which is to be used to determine the maximum key frame interval. You can see that "-max_key_interval" was not followed by any value. As a quick fix, could you please try putting "mode con cp select=437" at the start of the batch script?

As you have put in the resizing stuffs in the AVS already, you should use 1:1 in the .enc.txt. For the target size, you can indeed specify the target size (as KB, MB or GB) in the .enc.txt instead of kbps or bppx.

cmw
24th January 2007, 17:59
POST OBSOLETE!

I figured it out lol. It was avisynth all along. Apparently too old a version (allthough I just installed it like a month ago. Also you claim that the version is needed for audio encoding only (which apparently is not true ;) )

Anyways, it works now :)


Also, there is a minor other bug. If you call the batch without avs so the help appers, the "& ESS" in the text messes up a bit and creates an error msg. Can be fixed by replacing the "&" with "and"

henryho_hk
25th January 2007, 01:02
Yup, my batch script works with official AVISynth 2.5.7 too. I am now testing whether it works with tsp's multi-threaded version of AVISynth 2.5.7.

cmw
25th January 2007, 02:09
That would be most helpful, since encoding with a avs which does deinterlace is INCREDIBLY slow (and i guess multithreading SHOULD speed it up...)

henryho_hk
25th January 2007, 16:13
AVS scripting is so wonderful that I prefer leaving it to human. ^_^

I have been using the following deinterlacers with different characteristics:

1) adeint(tff=?) -- great speed and fairly good results
2) 5-tape-lowpass by ffdshow's AVS plugin -- great speed, mostly for fixing progressively resized interlace footages by blending
3) tomsmocomp(?,5,1) -- good speed, mostly when the source is blocky and I have no mood to bother with it
4) leakkerneldeint(order=?) -- good speed and good results
5) tdeint(order=?) -- fairly slow speed and excellent results
6) tdeint(order=?,mtnmode=0) -- faster with quality trade-off, but still look better than leakkerneldeint()
7) MVBob() -- extremely slow, but it worths
8) MCBob() -- a never-ending miracle ;)

They give very different compressibility results too. Do try them.

cmw
25th January 2007, 18:03
Yeah I only used tdeint so far and it's a real pain... I'll try some of the others, thanks for this list.

Now I've done a few Rips and achieved excellent quality with all of them. There's only one problem remaing: AVImux will still crash after encoding is done. It does also crash if I drag the .amg file directly into the program.

Here is one of my amgs:


CLEAR
LOAD C:\Temp\DVD\wing\wing_TGHQ-90_br_1636.avi
LOAD
SELECT FILE 1
ADD VIDEOSOURCE
SET OUTPUT OPTIONS
WITH SET OPTION
DELAY 1 0
OVERWRITEDLG 0
CLOSEAPP 1
DONEDLG 0
MAXFILES OFF
STDOUTPUTFMT MKV
VIDEO LNGCODE 1 und
AUDIO LNGCODE 1 und
AUDIO NAME 1 undefined
WITH MKV
CUES 1
CUES VIDEO 1
CUES AUDIO 1
CUES AUTOSIZE 1
LACE 3
END WITH
NUMBERING OFF
MAXFILESIZE OFF
END WITH
START C:\Temp\DVD\wing\wing_TGHQ-CT_br_1636.mkv


Also, could you please add support for mp4 audio (so that if you have a .mp4 audio file with the same name it will take it into consideration for a given size (NOT reencode it).

What also would be great: Mutliple Audio Tracks support (like moviename.1.mp4(mp3,ogg), moviename.2.mp4(mp3,ogg).


Just a few thoughts, maybe you'll consider them :)

henryho_hk
26th January 2007, 01:18
The second "load" is problematic in the amg script. It should specifythe audio filename. If you don't have an audio file in the same directory and the avs script does not generate audio, the script should not run AVIMuxGUI at all. That's really strange.

For mp4 audio, I will check whether AVIMuxGUI can extract the audio track from a MP4 stream. Still, I would stay in the MKV container for the time being.

cmw
26th January 2007, 02:31
Yes that would be perfect (since I alway rip my xvid video stream and a mp4 contained aac stream into mkv (yeah it's a bit silly but it works quite fine^^) ).

It would be great if avimux could do that^^ (optionally you could use mkvmerge, it has commandline support too and muxes almost anything into mkv^^

henryho_hk
26th January 2007, 11:09
I support Vorbis audio (ogg container), especially using Blacksword's optimized Lancer aoTuV build. http://wiki.hydrogenaudio.org/index.php?title=Ogg_Vorbis

cmw, is the AMG script problem you mentioned in #17 reproducible?

cmw
26th January 2007, 14:18
Yes, it just happens everytime I do a rip. Now I have usually the ripped ac3 in the same folder (but not even with the same name) aswell as a mp4 (also not the same name as the .avs). No mp3 or ogg around anywhere...

It's quite convenient though as it kind of notifies me when it's done while I'm watching a video or sth, pops righ in front of me ;)

As for Vorbis Audio, I had some bad experiences with it, when it comes down to 6ch ogg vorbis, the channel mapping was just screwed up (didn't try it out lately, but maybe it got fixed). I like my 6ch, but ac3 consumes too much space so I got to like multichannel aac (allthough VLC can't play that hence to some mysterious bug, but that's another story^^)

henryho_hk
26th January 2007, 15:35
foobar2000 is working nicely in transcoding 6-ch AC3 to OGG. For playback, the new ffdshow tryouts (http://sourceforge.net/project/showfiles.php?group_id=173941) are worth trying.

-----------------------------------------------

Version 2.5e is uploaded. ~ I hope it can fix the no-audio muxing problem.

cmw
27th January 2007, 22:17
Version 2.5e fixes it. Now, it doesn't start AVImux anymore if there's no mp3/ogg in the folder :)

Still, mp4 support would be great :)

buzzqw
28th January 2007, 10:21
mirror of 2.5e www.64k.it/andres/data/a/avs2qxvid_25e_full.7z
(7zip compressed twice with password XviD_presets)

BHH

SealTooGreat
8th February 2007, 21:28
I can not make drag'n'drop sample.avs to avs2qxvid_25e.bat to work
sample.avs:
DGDecode_mpeg2source("E:\Videos\DVDRip TEMP\VTS_02_1.d2v")
crop( 8, 8, -8, -8)
LimitedSharpenFaster(ss_x=1.3, ss_y=1.3, Smode=3, strength=80, overshoot=7)
Tweak(sat=1.5, bright=9, cont=1.1)
trim(95691,96213)
sample.enc.txt:
TGHQ-58 0.2bppx 64:45 PRO
DOS prompt says:

"Checking Source...."
AVIStreamGetFrameOpen failed
1
Missing operand.
Missing operand.
(standard_in) 1: parse error
(standard_in) 1: parse error

Preset to use = TGHQ-58

start "TGHQ-58 - Pass 1/2" /b /wait /belownormal "D:\Program Files\DVDRip Progra
ms\avs2qxvid_25e_full\bin\xvid_encraw_20061213.exe" -zones 0,q,3,KO -threads 1 -
progress 100 -max_key_interval -par 64:45 -packed -quality 5 -vhqmode 1 -max_bf
rames 2 -bquant_ratio 162 -bquant_offset 0 -qtype 1 -qmatrix "D:\Program Files\D
VDRip Programs\avs2qxvid_25e_full\matrix\Didees-SixOfNine.cqm" -nochromame -turb
o -pass1 "D:\Program Files\DVDRip Programs\avs2qxvid_25e_full\tmp\sample.pass" -
type 2 -i "D:\Program Files\DVDRip Programs\avs2qxvid_25e_full\sample.avs"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


xvid_encraw built at 22:48:46 on Dec 13 2006
Usage : xvid_encraw [OPTIONS]
*OPTIONS LIST*
NB: You can define 64 zones repeating the -z[qw] option as needed.

start "TGHQ-58 - Pass 2/2" /b /wait /belownormal "D:\Program Files\DVDRip Progra
ms\avs2qxvid_25e_full\bin\xvid_encraw_20061213.exe" -zones 0,w,1.0,KO -threads 1
-progress 100 -max_key_interval -par 64:45 -packed -quality 6 -vhqmode 4 -qpel
-max_bframes 2 -bquant_ratio 162 -bquant_offset 0 -qtype 1 -qmatrix "D:\Program
Files\DVDRip Programs\avs2qxvid_25e_full\matrix\Didees-SixOfNine.cqm" -imin 3 -
imax 4 -pmin 3 -pmax 5 -bmin 3 -bmax 5 -chigh 10 -clow 3 -bvhq -bitrate -pass2
"D:\Program Files\DVDRip Programs\avs2qxvid_25e_full\tmp\sample.pass" -stats "D:
\Program Files\DVDRip Programs\avs2qxvid_25e_full\tmp\sample.stats" -type 2 -i "
D:\Program Files\DVDRip Programs\avs2qxvid_25e_full\sample.avs" -avi "D:\Program
Files\DVDRip Programs\avs2qxvid_25e_full\sample_TGHQ-58_br_.avi"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


xvid_encraw built at 22:48:46 on Dec 13 2006
Usage : xvid_encraw [OPTIONS]
*OPTIONS LIST*
NB: You can define 64 zones repeating the -z[qw] option as needed.

All completed..............
Press any key to continue . . .

And nothing....there's no avi output!
*edit*
Missing xvidcore.dll was reported, earlier...than i've solved that by coping it from your "xvid_celticdruid" folder to "c:\windows\system32" folder

henryho_hk
9th February 2007, 09:30
You need AVISynth 2.5.7 too.

Dams
9th February 2007, 14:30
Hi henryho_hk,
I download your soft, but I didn't use it yet, and I was wondering if I can set the max frame intervall , as I use to made Xvid movie from PAL source, I often use 250 for this parameter..

henryho_hk
9th February 2007, 17:35
max frame interval is automatically determined from the fps. ^_^

SealTooGreat
9th February 2007, 17:44
@henryho_hk
I'm using AVS 2.5.7 RC3 (alpha).....December 31, 2006!

henryho_hk
10th February 2007, 11:26
bin\avsutil.exe is not working. Let me check that dependency it needs.

squid_80
10th February 2007, 11:54
AVIStreamGetFrameOpen failed

That means for some reason avsutil couldn't play the file given as input. Installing a YV12 codec will probably fix it. (Sounds like xvid isn't installed properly?)

buzzqw
10th February 2007, 12:09
confirm the solution given by squid_80, reinstall xvid (koepi build) fix it

BHH

henryho_hk
11th February 2007, 06:15
Yeah, the bundled celticdruid's MTK xvid build does not install the directshow filter. I am using FFDShow and so I did not notice this problem.

squid_80
11th February 2007, 06:47
Does it install the vfw component though? That version of AVSUtil is pretty old, to play a file it requires the stream to be RGB or a codec that can convert whatever format it is to RGB.

henryho_hk
11th February 2007, 10:48
Yeah, VFW component is installed. I am using AVSUtil and writefile() to obtain the details of the avs script. Is there a newer version of AVSUtil?

squid_80
11th February 2007, 16:31
There is, I must have forgotten to upload it. The text output is slightly different (I use it for benchmarking) but it still returns the framecount in %errorlevel%. I'll upload it tomorrow.

vanger
12th February 2007, 08:14
what's wrong in such usage?
D:\avs2qxvid>avs2qxvid_25e.bat COMPTEST 700MB zxxxz91.avs

Usage:
avs2qxvid_25e.bat {TGHQ/TGFAST/MTK}-{30/45/58/90/CT} <value>{bppx/kbps/KB/MB/G
B} {PAR} {FOD} {input1.avs} {input2.avs} ...
avs2qxvid_25e.bat {COMPTEST} <value>{bppx/kbps/KB/MB/GB} {PAR} {FOD} {input1.a
vs} {input2.avs} ...

Taking input1.avs, input2.avs ... and producing input1.avi, input2.avi ...
in the corresponding directories.

TGHQ and TGFAST are original Teegedeck's 2-pass XviD quality presets. MTK
is quick and dirty adaptation of TGFAST (hopefully) to work with mpeg4
standalones players.

If the AVS has audio, it will be compressed into CBR/ABR MP3 or OGG at about
128kbps (MP3 is for MTK). If an audio file inputN.mp3 or inputN.ogg
is present, it will also be used. In both cases, if you specify the target
size, the audio size will be taken into account into size prediction. An AVI
or MKV (for its chapter support) will be muxed.

-30, 45, 58 and 90 are the Teegedeck's preset levels. It governs many
critical settings of XviD encodes, such as quantizer ranges and matrices.

Target size can be specified in bit per pixel, kbit per sec, kilobytes,
or gigabytes. Beware that _Quality_ takes precedence over the size and
bitrate and so it is possible to have oversize or undersize.

You can also use "-CT" and let the compressibility test to pick a right level
according to your desired target size or bitrate. 3 of the input will be
used for the comp test if there are more than 500 frames. It works well most
of the time unless you enter extreme values, e.g. 650MB for a 10s clip (too
big) or 100MB for a 1080p movie (too small). Note: If the AVS ends with a
"return" statement, 3 sampling won't work and the full clip will be tested.

Anamorphic encode is also supported. You can specify a pixel aspect ratio
(PAR) of 1:1 (default), PAL_4:3, PAL_16:9, NTSC_4:3, NTSC_16:9 or anything lik
e
xxx:yyy. Your player (software/standalone) will perform the resize.

In case you need a comp test only, use COMPTEST. After the test, a file named

input.enc.txt will be generated in the source directory. And then, when you
specify only input.avs in the command line, the script will try to look for
input.enc.txt for the compression options. If not found, it will assume
"TGFAST-CT 0.15bppx VGA_1:1".

In case you want to force key-frames for, e.g., chapter points, create a text
input.zones.txt listing all the frame numbers there. If audio (separate file
or audio in AVS) is also present, the program will mux them into a MKV
container with these chapter points.

All credits go to Teegedeck for his great quality presets and squid_80 for his

wonderful xvid_encraws.exe and avsutil.exe.

Examples:

Compress input.avs using TGHQ-58 preset at a reference size of 700MB.
> avs2qxvid_25e.bat TGHQ-58 700MB 1:1 PRO input.avs

Compress input1.avs and input2.avs as PAL 16:9 and TFF using TGFAST preset at
a preference bitrate of 1300kbps. The preset level of indivdual avs will be
selected according to each comp test result.
> avs2qxvid_25e.bat TGFAST-CT 1300kbps PAL_4:3 TFF PAL_16:9 input1.avs input2.
avs

Compress input.avs using the default of TGFAST-CT and 0.15bppx, or according
to the settings in input.enc.txt in the same directory. This is also what
got executed when you drag and drop a AVS (or a number of AVS) onto this
script.
> avs2qxvid_25e.bat input.avs

Test the compressibility of input.avs for the target size of 0.5GB.
> avs2qxvid_25e.bat COMPTEST 0.5GB input.avs

Press any key to continue . . .


the avs script:
DirectShowSource("D:\capture\video\gen.mkv",fps=25,audio=false)

squid_80
12th February 2007, 14:08
New AVSUtil (http://members.optusnet.com.au/squid_80/avsutil.zip), as promised. (I can make a build that isn't dependent on the VS2005 runtime library if you like, but it will blow up in size to be 80k instead of 7.5k.)

henryho_hk
12th February 2007, 15:18
Do you mean this runtime library?
http://download.microsoft.com/download/d/3/4/d342efa6-3266-4157-a2ec-5174867be706/vcredist_x86.exe

squid_80
12th February 2007, 15:30
Yes, if it's for VS2005 (I can't tell from the url and I'm not going to download it just to find out).

henryho_hk
12th February 2007, 15:43
what's wrong in such usage?

Sorry for the typo in the online help. Try:

avs2qxvid_25e.bat COMPTEST-CT 700MB 1:1 PRO zxxxz91.avs

"1:1" is ignored and does not really matter. "PRO" means progressive footage; you can also specify "TFF" or "BFF".

squid_80
13th February 2007, 13:31
FYI I found a bug today in AVSUtil that causes it to incorrectly report the number of frames in AVI files larger than 2GB. I'll try and get another new version uploaded soon.

EDIT: New version is available now, same url as above.

Dams
14th February 2007, 16:32
@squid_80 : for what is used your software named AVSUtil ?
do you have a post on it ?

henryho_hk
14th February 2007, 16:44
AVSUtil is an essential tool for my script. ^_^

Dams
14th February 2007, 17:09
sorry daddy, I didn't see it :helpful:

:o

vanger
15th February 2007, 09:13
Sorry for the typo in the online help. Try:

avs2qxvid_25e.bat COMPTEST-CT 700MB 1:1 PRO zxxxz91.avs

"1:1" is ignored and does not really matter. "PRO" means progressive footage; you can also specify "TFF" or "BFF".
It works, :thanks:

pdanpdan
15th February 2007, 21:32
New AVSUtil (http://members.optusnet.com.au/squid_80/avsutil.zip), as promised. (I can make a build that isn't dependent on the VS2005 runtime library if you like, but it will blow up in size to be 80k instead of 7.5k.)
Hi, with this version of avsutil I get an error stating that there is a configuration problem and cannot be started

vanger
16th February 2007, 06:45
how to make comptest for 2pass encoding and get quality near q=2 ?

a want to get bitrate for max quality (in reasonable limits)

kastiauto
16th February 2007, 12:03
Why preset: MTK-CT xxMB won't do second pass? TGHQ-CT xxMB was OK.

__

Installing that XViD included in this package solved the problem and now 2 pass in MKT is working.
avs2qxvid_25e_full_\xvid_celticdruid\xvid.inf

henryho_hk
17th February 2007, 04:14
how to make comptest for 2pass encoding and get quality near q=2 ?

"Quality near q=2" is vague since you did not mention the matrix. For me, 6of9 or V3UHR at q=3 looks better than H.263 at q=2. (Very) generally speaking, I think TGHQ-90 or TGFAST-90 would be your choice. The trick is to pick the right target size. Since the comp-test result value (not the quantizers!) is in linear with the target bitrate/size, I think you can try this:

1) Pick a target reasonable bitrate, say 1600kbps for 640x480x29.97fps, and do a COMPTEST-CT pass.
2) Assuming that you obtain a comp test result of 42, you can project for the desired target: 1600*95/42 = 3620kbps
3) Do a TGFAST-90 at a target bitrate 3620kbps. It would be quite likely that the average quantizer is around 2 with the 6of9 matrix.

vanger
17th February 2007, 05:34
I'm right, that that comp test result (approximately) is quality in percents?

henryho_hk
17th February 2007, 14:47
Comp test results is approximately the target size divided by the compressed file size (using some specific compression settings). It shows how compressible your source is (i.e., how well your source can be compressed). More compressible means lower quantizers, sharper matrix, etc. can be used. Hence, a high comp test result means higher encode quality _at the right settings_.

cmw
22nd February 2007, 10:45
Hey man, I know that it's intended that your bat favors quality over given filesize, but couldn't you please add an option which will strictly restrain the encoder to output EXACTLY the size that I want? :) That would be really great (like adding something to the enc.txt 700MB FIX or sth). I can't get p0rn done properly for 700MB because all the movement and brightness leads to low compressibility levels ;)

vanger
23rd February 2007, 10:43
MTK-90 priduces oversized files, but with TGHQ-90 there is no problem.
Any ideas for solve this?

henryho_hk
23rd February 2007, 16:10
vanger, try "MTK-CT" and let it pick the level. "COMPTEST-CT" is meant actually for TGHQ and TGFAST only.

henryho_hk
23rd February 2007, 16:32
cmw, try TGFAST-CT or TGHQ-CT.

SealTooGreat
27th February 2007, 03:41
I've switched to AviSynth 2.5.7 - January 7, 2007.
Now,It works great with TGHQ-58 0.2bppx 64:45 PRO!
MediaInfo reports bppx=0.193....It have missed for 0.007:D

henryho_hk
27th February 2007, 11:43
SealTooGreat, try TGFAST-CT or TGHQ-CT and it should be closer to 0.2bppx.

SealTooGreat
28th February 2007, 23:21
I've used TGHQ-CT 0.23bppx 64:45 PRO!
MediaInfo reports bppx=0.230....It have missed for 0.000 :eek: :D :D :D
Quality is GREAT!!!

henryho_hk
1st March 2007, 15:45
What preset was finally chosen by the program? Was it TGHQ-45?

SealTooGreat
1st March 2007, 22:03
It've chosen TGHQ-58.
What should I type in sample.enc.txt for 1pass Q2?
Have you thought of creating small GUI for xvid_encraw?

henryho_hk
2nd March 2007, 06:40
What should I type in sample.enc.txt for 1pass Q2?

To have 1pass Q2, you need to create your own presets by modifying bin\xvid_presets_25e.csv. The exact method is not (and probably won't be) documented properly.

vanger
14th March 2007, 12:07
MTK-CT still produces oversized files :(
The TGFAST-CT is at exact bitrate...

SealTooGreat
14th March 2007, 16:46
AviSynth script:
DGDecode_mpeg2source("E:\Videos\DVDRip TEMP\Superman Returns\VTS_01_1.d2v",cpu=4,info=3)
ColorMatrix(hints=true)
crop( 0, 72, 0, -72)
Tweak(sat=1.38,bright=9,cont=1.1)
fft3dfilter(plane=3, sigma=2)
fft3dfilter(plane=0, sigma=.5, sharpen=.2)
trim(68400,71000)
Used preset MTK-CT 0.21bppx 64:45 PRO. Your batch encoder have chosen MTK-58.
MediaInfo says: 0.155 bppx
Without fft3dfilter in the script. MediaInfo reports: 0.200 bpxx

Kamui-
15th March 2007, 05:57
Good stuff,
I was wondering if it was too much to ask if you could add a few stuff listed below:

Options in xvid_presets:
yes/no packed bitstream
yes/no trellis
% i-frameboost
% I-frame closer than 1 are reduced by
Target bitrate in kb
Target filesize in kb
X many threads

xvid_presets_25e.csv to be in another format, excel for an example or a gui to make it easier to import ur own settings.

henryho_hk
15th March 2007, 06:55
Well, this is really meant to be a non-gui batch mode program. The parsing of xvid_presets_25e.csv is rather simplistic and it is limited to 26 columns (A-Z). Also, only xvid_encraws parameters are available. #threads is determined from %NUMBER_OF_PROCESSORS% and target size/rate can be specified from <name>.enc.txt. As for other options, I need to find a way to accommodate more than 26 parameters.

Yet, I think my immediate task is to decompose the batch file into more manageable pieces.

Jerry_Sm@rt
27th March 2007, 06:43
Hi,henryho_hk
Could u provide any mirrors?or anyone would like to help
I can not access to your link to download the pack.
And the file i download from buzzqw's mirror was broken(using download tools).

henryho_hk
27th March 2007, 12:45
Used preset MTK-CT 0.21bppx 64:45 PRO. Your batch encoder have chosen MTK-58. MediaInfo says: 0.155 bppx

If all the quantizers are at the minimum value already, I think the compressibility test has produced a wrong value and your movie deserves MTK-90. It could happen as that was merely a sampled check, which "happened" to pick up more difficult scenes than the average movie.

buzzqw
27th March 2007, 13:11
@Jerry_Sm@rt

my link is ok... i can download without problem

BHH

SealTooGreat
30th March 2007, 02:49
If all the quantizers are at the minimum value already, I think the compressibility test has produced a wrong value and your movie deserves MTK-90. It could happen as that was merely a sampled check, which "happened" to pick up more difficult scenes than the average movie.
...so it doesn't have nothing with fft3dfilter and its usage?!

boombastic
30th March 2007, 18:58
If i don't create any xxx.enc.txt where xxx.avs is the script to encode i know that the default profile for xvid is used but what determines if mkv or avi is going to be created?I want only and always avi not mkv.....

henryho_hk
31st March 2007, 05:00
MKV is created if there is ogg audio or chapters (.zones.txt).

henryho_hk
31st March 2007, 05:03
...so it doesn't have nothing with fft3dfilter and its usage?!

It does matter. Otherwise your encode will be way more over-sized. Probably you need to apply stronger parameters (sigma=0.5 for luma seems too low).

SealTooGreat
31st March 2007, 21:49
^ Strange.
Without fft3dfilter, I've got 0.20bppx, 0.01 less then it should be (0.21). I can't see any over-size.
With fft3dfilter, I've been getting way less(0.15bppx)...so I don't understand why should I apply stronger denoise parameter as you've suggested.

henryho_hk
3rd April 2007, 02:08
When you use MTK-CT, take a look at the file <filename>.ct.avi in the TMP directory. If the script chooses MTK-58 with and without fft3dfilter, it means the two .ct.avi is of similar size with and without fft3dfilter and it is really an exceptional case. If they are of vastly different size and the script always chooses MTK-58, I have made a calculation error in the script.

Try starting with no TMP directory. If possible, please also note the compressibility test result (a few lines above the chosen preset in the screen output).

boombastic
12th April 2007, 18:27
i always want to keep the original audio file,how can i avodi avs2xvid to encode it to mp3 or ogg?

celtic_druid
13th April 2007, 03:49
I modified it here so that it would take external AC3 audio and simply mux it. That would mean that without modification, it can't do it.

henryho_hk
13th April 2007, 06:53
External AC3/DTS/WAV/etc. file is (long) on my to-do list. I am still trying to figure out the right interleave setting for AVIMux.

celtic_druid
13th April 2007, 07:10
I used
AUDIO INTERLEAVE 4 FR
since that is what is in "Profile - Standalone AVI - AC3.amg"

henryho_hk
14th April 2007, 14:07
Version 2.5f is out:

back to 3% comp test
ac3 muxing
HQMTK presets coarsely hacked from Teegedeck's HQ presets


NEW: Some mistakes found:

1) Please change Line 498 from
if /I not "%SRCAUD:~-4%"==".ogg" (
to
if not "%SRCAUD%"=="" if /I not "%SRCAUD:~-4%"==".ogg" (

2) Please change Line 771 from
set PP1=!PP0! -pass1 "%SRCTMPP%.pass"
to
set PP1=!PP0! %SIZP% -pass1 "%SRCTMPP%.pass"

henryho_hk
15th April 2007, 16:12
Guys & gals, I am thinking of multi-part 2-pass parallel encoding. The idea is as follows:


Run a sampled compressibility test over the whole movie.
The total size of all (non-excluded) compressed frames is Z megabytes, while those for the first half and 2nd half are Z1 and Z2 respectively (Z1+Z2=Z but i believe that Z1<>Z2)
With the overall target size, T megabytes, we determined the preset level, say ">58% Preset".
Kick off 2 jobs, both at ">58% Preset", with the 1st half of the movie targeting T*Z1/Z megabytes and the 2nd half targeting T*Z2/Z megabytes. As the length and the parameters are the same, the 2 jobs should spend similar encoding time and our dual-core CPU can be fully occupied. We can also use CPU affinity tools to specify the cpu core for each job.
Finally, join the two halves together and mux the audio in.


Does it sound like a good idea?

halsboss
19th April 2007, 08:20
Dunno if this helps the OP, but here's draft .VBS scripts to do a few simple things. Sometimes easier to program things than in batch files...

http://forum.doom9.org/showthread.php?p=990992#post990992

Only trying to help.

henryho_hk
20th April 2007, 02:34
Thank you very much for your suggestion. Indeed, it can replace some helper utilities (esp. bc.exe for calculation). I know vbs programming too but I am currently too lazy to replace the old bat codes.

ronnylov
24th April 2007, 14:24
Is it possible to do only a compressibility test with this script (and not doing the final encoding)? I am having problems doing compressibility test with Enc.

henryho_hk
24th April 2007, 16:57
avs2qxvid.bat COMPTEST-CT 700MB 1:1 PRO input.avs

Icemaan
29th April 2007, 16:15
Hallo
Sorry for my English i Know it is not so good . I hope you understand me .
I have test this excellent Tool but i Have some Questions for better understand.
My Test File have a size from 87 Mb and for Test I want to reduce it to 40 Mb
First i have make a Compress Test with this Parameters
Avs2qxvid_25f.bat COMPTEST-CT 40MB 1:1 PRO Video-720.avs
The Result looks Like This
Tot: enctime(ms) =2141.00, length(bytes) = 82066
Avg: enctime(ms) = 71.37, fps = 14.01, length(bytes) = 2735, psnr y = 4
6.36, psnr u = 43.34, psnr v = 44.51
I frames: 2 frames, size = 14857/ 29714, quants = 3 / 3.00 / 3
P frames: 10 frames, size = 3657/ 36574, quants = 3 / 3.00 / 3
B frames: 16 frames, size = 986/ 15778, quants = 4 / 4.00 / 4

Source FPS = 2500000/104271
No. of frames for CT = 16
Size of selected frames = 31065
Target Size in KB = 40960KB
Compressibility Test = 2335
Selected Level = 90
Recommended Preset = TGHQ-90

Then I Encode the Test file with the Parameters
avs2qxvid_25f.bat Video_720.avs

Now my Questions
Did the Commandline avs2qxvid_25f.bat Video_720.avs take the Video_720.enc.txt to encode the File because my Finished Avi is only 8 Mb big.Isthis normaly or what i must make to have one 40mb Avi .
The Source file is a 1920x1080 Hd Evo File

Icemaan

henryho_hk
1st May 2007, 07:58
A 1920x1080 video never get so small unless it lasts for one or two seconds only. Try to watch the encoded clip and see if it shows any error. It you are testing a short clip, try Celtric Druid's 10.03.2007 xvid build (http://tirnanog.fate.jp/mirror/XviD/xvid.cvs.head.MTK.2007.03.10.7z).

henryho_hk
13th May 2007, 06:17
I am thinking of multi-part 2-pass parallel encoding

Preliminary testing is quite good. I am looking forward to version 3 with multi-part encoding. Yet, I have two questions. (1) Should I split the footage according to the number of logical processors (e.g. hyperthread) or the number of true physical core? (2) How to make it more memory friendly? It's about 300MB ram per job in my computer.

Revgen
16th May 2007, 02:12
Why is the "threads" option disabled?

I changed

rem set /a NUMTHRD=%NUMBER_OF_PROCESSORS%

to

set /a NUMTHRD=%NUMBER_OF_PROCESSORS%

and it worked fine for me. FPS was a little higher. Went from 2.49FPS to 3.17FPS for my encode. The video turned out fine.

I'm using 2.5F

Revgen
16th May 2007, 02:17
Guys & gals, I am thinking of multi-part 2-pass parallel encoding. The idea is as follows:


Run a sampled compressibility test over the whole movie.
The total size of all (non-excluded) compressed frames is Z megabytes, while those for the first half and 2nd half are Z1 and Z2 respectively (Z1+Z2=Z but i believe that Z1<>Z2)
With the overall target size, T megabytes, we determined the preset level, say ">58% Preset".
Kick off 2 jobs, both at ">58% Preset", with the 1st half of the movie targeting T*Z1/Z megabytes and the 2nd half targeting T*Z2/Z megabytes. As the length and the parameters are the same, the 2 jobs should spend similar encoding time and our dual-core CPU can be fully occupied. We can also use CPU affinity tools to specify the cpu core for each job.
Finally, join the two halves together and mux the audio in.


Does it sound like a good idea?

Doesn't ELDER do something similar? If you could include the freatures with your program and do what ELDER does, it could be a hit.

henryho_hk
16th May 2007, 06:43
ELDER is much more sophisticated. You can spread the encoding jobs over several computers with ELDER. I am planning for local computer encodes only. Also, I think the bitrate allocation are different. I use linear interpolation based on compressibility test while ELDER uses another method.

--------------------------

%NUM_OF_PROCESSORS% is disabled solely because I was testing multi-part encoding that night. If you are using 2.5f, please apply the amendments in post #90 as well.

Revgen
16th May 2007, 18:02
Well whatever you do sounds like a good idea if it means more speed while maintaining good quality.

Thanks for script.:)

Irakli
20th May 2007, 01:43
Hi

I have a small question. I noticed that packed bitstream is always enabled for the encoding. Is there any way to disable it?

Revgen
20th May 2007, 07:21
Hi

I have a small question. I noticed that packed bitstream is always enabled for the encoding. Is there any way to disable it?

Open the avs2qxvid_25f.bat in notepad and change:

set PPK=-packed

into

set PPK=-nopacked

AtomicStryker
26th May 2007, 11:17
I've got a problem with your cool Batch, it won't find the installed Avisynth on my comp - running Win XP Prof x64 SP2. How does your script "look" for Avisynth, can i specify it's folder somehow?

I already thought it might be related to the Program Files (x86)-naming, so i copied the Avisynth-folder into Program Files, but that didn't help. Avisynth is perfectly functional, I use MeGUI to encode stuff and wanted to use your batch for a Compress. Check

buzzqw
26th May 2007, 13:13
maybe is missing the registry key..
you could check HKLM/Software/Avisynth and look for plugindir2.5 key... or simply reinstall avisynth 2.57

BHH

henryho_hk
26th May 2007, 13:40
The batch looks for %SystemRoot%\System32\avisynth.dll

I believe that the DLL installation directory is different for XP x64 (is it something like wow64?) If you have AVIsynth installed, you can remove that checking completely. I would also like to know whether avsutil works under XP x64.

celtic_druid
26th May 2007, 14:16
If you are using 32bit apps then you should launch the batch with a 32bit command prompt, that way system32 and sysWOW64 are the same thing. If you are using 64bit tools then avisynth.dll would be in system32 for real.

I'll test it some time later with 64 and 32 bit tools, see how it goes.

AtomicStryker
26th May 2007, 16:04
Alright then ... how do i launch a 32bit console?

Ah, found it myself, go to the sysWOW64 folder and launch the cmd.exe there, then proceed to use the batch.

Works! Using a 32bit command prompt, that batch finds avisynth

Thanks a ton

squid_80
26th May 2007, 16:17
I would also like to know whether avsutil works under XP x64.
It certainly does. Also I forgot to let you know the source for it is available on my website ( http://members.optusnet.com.au/squid_80/sources/avsutil_src.zip ).

AtomicStryker
26th May 2007, 21:01
In spite of the "tweaks" to the .bat given in this thread, the xvid-encoder doesn't utilize my second CPU core .. funny enough the set %NUM_OF_PROCESSORS% thing made the script use 2 threads (0 cpus detected lol) instead of 1, but still they're running core 1 solely.

It's even funnier because another part of your batch (the one recoding audio to an .ogg, even when i only choose COMPTEST - is that necessary?) actually DOES take advantage of both cores...

Oh, and the lines you give to correct that script errors in are wrong, or atleast Notepad++ tells me so


Uhh - and as a sidenote: What the hell is pcrecpp.dll? MeGUIs mkvmerge tool demands it (along with a few other missing .dlls, but those i could download) and i can't even find it on google .. some sort of Opensolaris source??????

celtic_druid
26th May 2007, 22:57
MeGUI just uses the regular mkvmerge from mkvtoolnix.
Main site down here but you can get it at:
http://www.videohelp.com/tools/MKVtoolnix
dependencies included and you can use 7-zip to unpack if you don't want to install.

foxyshadis
27th May 2007, 00:51
pcre -> perl-compatible regular expressions. It's usually called just pcre.dll though.

squid_80
27th May 2007, 16:00
In spite of the "tweaks" to the .bat given in this thread, the xvid-encoder doesn't utilize my second CPU core .. funny enough the set %NUM_OF_PROCESSORS% thing made the script use 2 threads (0 cpus detected lol) instead of 1, but still they're running core 1 solely.If it's detecting 0 cpus then you don't have a multithreaded capable version of xvid installed.

henryho_hk
28th May 2007, 00:40
Ithe xvid-encoder doesn't utilize my second CPU core .. another part of your batch (the one recoding audio to an .ogg, even when i only choose COMPTEST - is that necessary?) actually DOES take advantage of both cores...

I am using wingogo (optimized version of LAME 3.88) and the Blacksword Lancer build of oggenc. Both can keep your cores busy automatically. If you use the bundled version of XviD (uninstall existing one, install this one and load defaults), you will also see certain degree of multi-core activities. You can also try the "MT" AVS plugin for multi-thread avs processing.

It's also intentional to encode audio for comp-test because if you specify target size in KB/MB/GB it also includes the audio size.

As for the syntax error, I don't see any error in my 2.5g. Nevertheless, I had released 2.5h to prevent further confusion. In addition, I wrote a small assembly program to detect the number of CPU cores instead of using %NUM_OF_PROCESSERS%. If you have a multi-CPU system or multi-core AMD system, please help me to test it.

AtomicStryker
29th May 2007, 22:06
If i might ask: What included Xvid? As far i can see, there's Xvid_Encraw included, but no Xvid.dlls or Setups

I uninstalled my 1.1.2 (Koepi) Xvid Build and tried to use your batch again, i get an error message about "xvidcore.dll not found"

celtic_druid
29th May 2007, 22:36
There was definitely an xvidcore.dll included at some stage. But yeah v1.1.2 would explain it since the 1.1 branch isn't multithread capable.

Shouldn't be any need to uninstall your exisiting Xvid version either though. Simply putting a 1.2.x dll in the same dir as encraw should be enough.

Lux Delux
29th May 2007, 23:46
Hi, I've a question but first want to thank you for the excellent work! Keep it up!

Anyways, when the enocde finishes I get 2 .avi files instead of just one. One of 'em is a few bytes bigger for some reason.

Any ideas? :)

EDIT: aaaah damn I'm so stupid :o just noticed it does automatic muxing and since I haven't selected any audio track it muxes it with some small file from TMP.

Is there perhaps an option to disable automatic muxing?

henryho_hk
30th May 2007, 15:31
If i might ask: What included Xvid?

Sorry, I left out the xvid directory by mistake. The package is now updated.

henryho_hk
30th May 2007, 15:34
... it muxes it with some small file from TMP. Is there perhaps an option to disable automatic muxing?

It never muxes anything from the TMP. It was picking up a mp3 or ogg in the same directory. And, tidying up your conversion directory would help avoiding this problem. ^_^

AtomicStryker
30th May 2007, 21:31
Alright, using the new, updated package and the Xvid within i get 2 CPUs detected, 2 threads used and actual Dualcore-Encoding yay ;)

EDIT:

A Suggestion: To add Windows x64 Compatibility (means FINDING avisynth.dll in the sysWOW32 folder without launching a special 32bit commandline) simply insert
if not "%AVISDLL%"=="" if not exist "%AVISDLL%" (
set AVISDLL=%SystemRoot%\SysWOW64\avisynth.dll
)

above this part here

if not "%AVISDLL%"=="" if not exist "%AVISDLL%" (
echo AVISynth not found. Please download it from:
echo http://bengal.missouri.edu/~kes25c/
echo and install it
pause
goto :EOF
)

Tested, works
Thus, i also get to drag&drop my .avs files again

Lux Delux
30th May 2007, 23:50
It never muxes anything from the TMP. It was picking up a mp3 or ogg in the same directory. And, tidying up your conversion directory would help avoiding this problem. ^_^

Ah I see, didn't know it does that, thanks for the tip :)

This is a truly excellent alternative to my old vdubmod encoding ways and am looking forward to the next update! ;)

celtic_druid
31st May 2007, 05:20
Looking in SysWOW64 folder directly I think is a bad idea. The whole idea behind the folder is that it appears as system32 to 32bit apps.

AtomicStryker
31st May 2007, 17:13
Adding that piece of code simply makes the batch look into the syswow64 folder IF it didn't find its dll in the system32 one. I don't see an option or reason to have windows use the 32bit console instead of its 64bit one.. there might be a flag or something to run the batch in 32bit though


ADD:

I was able to crank CPU-Usage a bit higher and get about 15% better FPS by using the MT Plugin for Avisynth and the SetMTMode(2,2) command before proceeding the .avs as usual ... MTSource(DirectShowSource("etc") gave me crippled Performance

henryho_hk
10th June 2007, 05:50
I am still working on the new version featuring multi-part encode. Yet, I have come up with a question. 32bit XP is limited to about 3.5GB. What about 32bit apps in 64bit XP/Vista? Does each of them has ~3.5GB or is the whole 32bit sub-system limited to ~3.5GB?

elguaxo
18th June 2007, 14:59
Automatic preset selection through 3% compressibility test

I would like to do a larger comptest, 6% perhaps. What lines should I change?

One is this:
SelectRangeEvery^(466, 14^)

Anything else? Thanks in advance.

fight2win
18th June 2007, 17:03
is this app better than megui?

henryho_hk
19th June 2007, 14:08
I would like to do a larger comptest, 6% perhaps. What lines should I change?

Yeah, change it to "233,14". Keep the 2nd number at 14. I was doing it in earlier versions too. Yet, as advised by Teegedeck, we need only a rough estimate for the preset selection and so 3% comptest should be sufficient.

elguaxo
19th June 2007, 14:48
:thanks:

salman1
23rd June 2007, 01:30
i have this .avs file and i would like to use this awesome and beautiful batch file. can some one please help me. Thanks...

DGDecode_mpeg2source("My source was here",cpu=4,info=3)
ColorMatrix(hints=true)
edeintted = AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
tdeintted = TDeint(edeint=edeintted,order=1)
tfm(order=1,clip2=tdeintted).tdecimate(hybrid=3)
crop( 8, 0, -4, -2)
removeblend() #remove ghost and duplicate frames
removedirt() #remove mess,dirt, and dust
removegrain(mode=17) # Heavy Noise
tweak(sat=0.75)
limitedsharpenfaster(dest_x=640, dest_y=480)

Guest
23rd June 2007, 01:54
@salman1

You have apparently made no attempt at all to use this tool, nor have you specified what kind of help you need. Your threads show a pattern of giving insufficient information to allow people to help you. So, specifically, what kind of help do you need with this? Please show evidence of having done some research on it and tried it out. Otherwise, a less tolerant mod might start thinking rule 1.

salman1
23rd June 2007, 02:18
i just need to know how to set up file size with this? Thanks a lot..

Guest
23rd June 2007, 03:32
It's all there if you just bother to read stuff:

avs2qxvid_25e.bat ... <value>{bppx/kbps/KB/MB/GB} ...

E.g.:

avs2qxvid_25e.bat ... 700MB ...

I figured that out after reading the thread for 2 minutes. Post #9 explains:

"I have put some online help and usage samples in the batch script. You can read it by running the batch script without any parameters."

And post #47 shows the actual help output.

salman1
23rd June 2007, 03:46
Thanks.. i read before posting for help or i don't understand.

henryho_hk
23rd June 2007, 04:17
is this app better than megui?

This batch script is really aiming at batch processing. MeGUI is a GUI application. Hence, I don't know how to compare them. :p

HackAR
27th June 2007, 13:50
First pass is done without problems, but second one wont start:

start "MTK-58 - Pass 2/2" /b /wait /belownormal "D:\Download\avs2qxvid_25h_full_1\avs2qxvid_25h_full_\bin\xvid_encraw_20070203.exe" -zones 0,w,1.0,KO -threads 1 -progress 100 -max_key_interval 250 -packed -vbvsize 3145728 -vbvmax 4854000 -vbvpeak 8000000 -quality 6 -vhqmode 1 -max_bframes 1 -bquant_ratio 162 -bquant_offset 0 -qtype 1 -qmatrix "D:\Download\avs2qxvid_25h_full_1\avs2qxvid_25h_full_\matrix\Didees-SixOfNine-HVS.cqm" -imin 3 -imax 4 -pmin 3 -pmax 5 -bmin 3 -bmax 5 -chigh 15 -clow 5 -bvhq -bitrate 1440 -altpass2 "Y:\tmp\1_DIREKT.pass" -stats "Y:\tmp\1_DIREKT.stats" -type 2 -i "Y:\1_DIREKT.avs" -avi "Y:\1_DIREKT_MTK-58_br_1440.avi"

Got 'An unhandled win32 exception occured in xvid_encraw_20070203.exe [2532] ...'

my avs:
SetMemoryMax (128)
Loadplugin("DGdecode.dll")

v1 = mpeg2source("DIREKT 2.d2v", cpu2="xxxxoo")
v2 = mpeg2source("DIREKT 1.d2v", cpu2="xxxxoo")

v1 = Lanczos4Resize (v1, 720, 400) #16:9
v2 = Lanczos4Resize (v2, 720, 400) #16:9

t1 = Trim (v1,0,110803)
t2 = Trim (v2,110755,110800)
t3 = Trim (v1,110836,115861)
t4 = Trim (v2,115605,115700)
t5 = Trim (v1,115884,0)

v=t1+t2+t3+t4+t5

a= Tone (1.0, 440 , 48000, 2, "Silence", 1.0)
AudioDub(v,a)

Using WinXP 32bit, latest official Avisynth and Xvid 1.1.2. What went wrong?

celtic_druid
28th June 2007, 03:21
You could try using a recent 1.2.x build and see if that helps.

HackAR
28th June 2007, 11:38
:thanks:
It seems to help.
I just wonder why the latest version of XviD 1.2 is dated on 25.02.2006 :confused:

celtic_druid
28th June 2007, 12:27
It isn't. It is over a year newer than that.

Nic-
2nd July 2007, 04:09
i'm missing pcrecpp.dll too, how can i fix that ?

henryho_hk
9th July 2007, 14:17
pcrecpp.dll ? I have not met this error before. At which step is it complaining?

celtic_druid
9th July 2007, 16:33
Part of mkvtoolnix. Make sure that you don't just have mkvmerge, but also its dependencies.

henryho_hk
9th July 2007, 16:57
I am using AVIMux_GUI for MKV muxing. Perhaps Nic is using an old version of my script.

hannah
10th July 2007, 07:27
Ok I now have managed to crash avs2qxvid.bat.

Please find the crash info here:
http://maxupload.com/30DFE9DC

Some more info:
Running WinXp Pro Version 2002 SP2

The batch file works fine in all other presets however if I try to encode MTK mode it crashes always.

This is my .avs
SetMemoryMax(256)

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\RemoveGrainSSE2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\MVTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\degrainmedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\RepairSSE2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\LeakKernelDeint.dll")

Import("C:\Program Files\AviSynth 2.5\plugins\SeeSaw\SeeSaw.avs")

DirectShowSource("D:\Raw\Tape2\KitChan.07-05-18_22-21.00.avi")


ConvertToYV12(interlaced=true)
LeakKernelDeint(order=0,sharp=true,threshold=10)


a = last
b=a.degrainmedian(mode=1)
SeeSaw(a,b, NRlimit=4, NRlimit2=5, Sstr=1.5, Slimit=9, Spower=9, Szp=16, sootheT=80, bias=40 )


Trim(45200,45700)
____________________________________

My .enc.txt command is

MTK-45
___________________________________

Infos from Dos windows before it crashes:


"Checking Source...."
Streaming frame 0 (of 1, 0.00%)
Clock time: 2125
1
***************************************
BePipe by dimzon
***************************************
Script used:
# BEGIN
import("D:\Raw\Script\KitChan_Seesaw.avs")
# END


==> Priority set to Low.
Scanning for Audio Stream...
Found Audio Stream
Channels=2, BitsPerSample=16, SampleRate=32000Hz
Writing Header...
Writing Data...
0%LAME 3.97 32bits (http://www.mp3dev.org/)
CPU features: MMX (ASM used), SSE (ASM used), SSE2
Using polyphase lowpass filter, transition band: 15613 Hz - 16000 Hz
Encoding <stdin> to D:\Raw\Script\KitChan_Seesaw.mp3
Encoding as 32 kHz average 128 kbps j-stereo MPEG-1 Layer III (8x) qval=3
Done!
D:\Raw\Script\KitChan_Seesaw.mp3
Applying mp3 gain change of -2 to D:\Raw\Script\KitChan_Seesaw.mp3...
'E:\Software\Megui\Henry' is not recognized as an internal or external command,
operable program or batch file.

start "3% Compressibility Test - Single Pass" /b /wait /belownormal "E:\Software
\Megui\Henry Bat file\avs2qxvid_25h_full_\bin\xvid_encraw_20070203.exe" -zones
0,w,1,KO -threads 1 -progress 100 -max_key_interval 250 -nopacked -vbvsize 31457
28 -vbvmax 4854000 -vbvpeak 8000000 -quality 4 -vhqmode 0 -max_bframes 1 -bquant
_ratio 162 -bquant_offset 0 -qtype 1 -qmatrix "E:\Software\Megui\Henry Bat file\
avs2qxvid_25h_full_\matrix\Didees-SixOfNine.cqm" -nochromame -turbo -single -cq
3 -stats "D:\Raw\Script\tmp\KitChan_Seesaw.ct.stats" -type 2 -i "D:\Raw\Script\K
itChan_Seesaw.ct.avs" -avi "D:\Raw\Script\KitChan_Seesaw.ct.avi"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


xvid [info]: outputting statistics to D:\Raw\Script\tmp\KitChan_Seesaw.ct.stats
Trying to retrieve width and height from input header
xvid [info]: Avisynth detected
xvid [info]: Input colorspace is YV12
xvid [info]: Input is 720 x 576, 25.000fps (25/1), starting from frame 0
xvid [info]: Number of frames to encode: 28
xvid [info]: xvidcore build version: xvid-1.1.3
xvid [info]: Bitstream version: 1.1.3
xvid [info]: Detected CPU flags: ASM MMX MMXEXT SSE SSE2 TSC
xvid [info]: Detected cpus = 0, threads requested = 1, threads in use = 1

Tot: enctime(ms) =3375.00, length(bytes) = 1132672
Avg: enctime(ms) = 116.38, fps = 8.59, length(bytes) = 39057, psnr y = 3
8.61, psnr u = 47.32, psnr v = 47.37
I frames: 1 frames, size = 127857/ 127857, quants = 3 / 3.00 / 3
P frames: 14 frames, size = 55890/ 782460, quants = 3 / 3.00 / 3
B frames: 13 frames, size = 17104/ 222355, quants = 4 / 4.00 / 4

Source FPS = 25/1
No. of frames for CT = 20
Size of selected frames = 705849
Target Bitrate = 1555kbps
Compressibility Test = 22
Selected Level = 30

Preset to use = MTK-30

start "MTK-30 - Pass 1/2" /b /wait /belownormal "E:\Software\Megui\Henry Bat fil
e\avs2qxvid_25h_full_\bin\xvid_encraw_20070203.exe" -zones 0,q,3,KO -threads 1 -
progress 100 -max_key_interval 250 -packed -vbvsize 3145728 -vbvmax 4854000 -vbv
peak 8000000 -quality 5 -vhqmode 1 -max_bframes 1 -bquant_ratio 162 -bquant_offs
et 0 -qtype 1 -qmatrix "E:\Software\Megui\Henry Bat file\avs2qxvid_25h_full_\mat
rix\Jawor_1CD_Matrix.xcm" -nochromame -turbo -lumimasking -bitrate 1555 -pass1 "
D:\Raw\Script\tmp\KitChan_Seesaw.pass" -type 2 -i "D:\Raw\Script\KitChan_Seesaw.
avs"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


Trying to retrieve width and height from input header
xvid [info]: Avisynth detected
xvid [info]: Input colorspace is YV12
xvid [info]: Input is 720 x 576, 25.000fps (25/1), starting from frame 0
xvid [info]: Number of frames to encode: 501, Bitrate = 1555kbps
xvid [info]: xvidcore build version: xvid-1.1.3
xvid [info]: Bitstream version: 1.1.3
xvid [info]: Detected CPU flags: ASM MMX MMXEXT SSE SSE2 TSC
xvid [info]: Detected cpus = 0, threads requested = 1, threads in use = 1
501 frames(100%) encoded, 10.87 fps, Average Bitrate = 3460kbps
Tot: enctime(ms) =46093.00, length(bytes) = 8668105
Avg: enctime(ms) = 91.82, fps = 10.89, length(bytes) = 17267
I frames: 2 frames, size = 69145/ 138290, quants = 3 / 3.00 / 3
P frames: 250 frames, size = 27376/ 6844019, quants = 3 / 3.00 / 3
B frames: 249 frames, size = 6770/ 1685796, quants = 4 / 4.00 / 4

start "MTK-30 - Pass 2/2" /b /wait /belownormal "E:\Software\Megui\Henry Bat fil
e\avs2qxvid_25h_full_\bin\xvid_encraw_20070203.exe" -zones 0,w,1.0,KO -threads 1
-progress 100 -max_key_interval 250 -packed -vbvsize 3145728 -vbvmax 4854000 -v
bvpeak 8000000 -quality 6 -vhqmode 1 -max_bframes 1 -bquant_ratio 162 -bquant_of
fset 0 -qtype 1 -qmatrix "E:\Software\Megui\Henry Bat file\avs2qxvid_25h_full_\m
atrix\Jawor_1CD_Matrix.xcm" -imin 3 -imax 5 -pmin 3 -pmax 5 -bmin 3 -bmax 5 -chi
gh 30 -clow 15 -bvhq -lumimasking -bitrate 1555 -altpass2 "D:\Raw\Script\tmp\Kit
Chan_Seesaw.pass" -stats "D:\Raw\Script\tmp\KitChan_Seesaw.stats" -type 2 -i "D:
\Raw\Script\KitChan_Seesaw.avs" -avi "D:\Raw\Script\KitChan_Seesaw_MTK-30_br_155
5.avi"

xvid_encraw - raw mpeg4 bitstream encoder written by Christoph Lampert 2002-2003


xvid [info]: outputting statistics to D:\Raw\Script\tmp\KitChan_Seesaw.stats
Trying to retrieve width and height from input header
xvid [info]: Avisynth detected
xvid [info]: Input colorspace is YV12
xvid [info]: Input is 720 x 576, 25.000fps (25/1), starting from frame 0
xvid [info]: Number of frames to encode: 501, Bitrate = 1555kbps
xvid [info]: xvidcore build version: xvid-1.1.3
xvid [info]: Bitstream version: 1.1.3
xvid [info]: Detected CPU flags: ASM MMX MMXEXT SSE SSE2 TSC
xvid [info]: Detected cpus = 0, threads requested = 1, threads in use = 1
________________________________________

It crashes after this. My source is miniDV.

I have gone to squid's webpage and downloaded the lates encraw

http://members.optusnet.com.au/squid_80/

Same result.

Thanks for all the help.

hannah
15th July 2007, 23:33
My source is DV. Captured in Panasonic NV GS180. It’s live badminton games. I capture these videos in my computer through WinDV. After encoding and muxing, the video and audio is out of sync. Please see below the different ways I am doing it.

I have used Megui and avs2qxvid.bat. First of all thanks to the developers who had given us these wonderful tools. My comp test comes back with 45% compression. So the setting I am using is TGHQ – 45%. When I use Megui or avs2qxid.bat, ( am encoding sound in 128kbps CBR MP3) in my computer the encoded video plays fine and video, audio is in sync however I also like to play these videos in my DVD player. So I burn these videos on DVD and play in my DVD player. After first few secs, the video and audio freezes. It has to be to do with the way audio streams are muxed as I have played the same videos without any sound stream and it plays fine in my DVD players (and yes, QPEL was ticked while encoding and it does not cause any problem while playing back in my DVD player).

So to fix this audio freezing problem I started to use VDubMod.
This is the flow chart:
1) Encode the MP3 audio from my .avs script with setting MTK-30 in avs2qxvid.bat (which is VBR)
2) Or, encode the MP3 audio from my .avs script in Megui in 128kbps / 64kbps CBR
3) Encode the video with avs2qxvid.bat, setting TGHQ-45 2000kbps
4) Use VDubMod to mux the video with audio (tried both CBR and VBR)

I have used following settings in VDubMod: priss rocks, interleaving and video -> Frame rate ->changes so video audio duration match. I have used CBR or VBR audio to mux but it always gets out of sync. The reason I am using VdubMod to mux, because when I mux it through VDubMod, I can play these video in my DVD player however audio gets out of sync.
I cannot do the whole job in avs2qxvid.bat with setting: MTK –CT or MTK -45 as I have not been able to use these functions. See my posting just above.



Questions:
1. Why the video play back gets stuck when I mux the audio with Megui or avs2qxvid.bat. Please note the video stream with out any audio plays perfect in my DVD player.
2. How can I resolve this audio out of sync issue? Audio plays before the video and it gets more and more out of sync towards the end of the video.

Many thanks for your time.

Lux Delux
16th July 2007, 22:26
Howdy, I've been experimenting with some matrices at min quant 3 and everything seemed to work fine until I tried v3uhr and foxhome.

When 2 pass is about to start I get this

Trying to retrieve width and height from input header
xvid [error]: Bad Framerate 0.000000 (25/1)

And I get that with both PAL and NTSC sources.

:eek: It seems it has something to do with my computer as my pal tried it on his comp and second pass ran normally.

Please, if anyone has any idea what could be the cause of this I'd be very grateful :)

smok3
16th July 2007, 22:48
The batch looks for %SystemRoot%\System32\avisynth.dll

what iam doing in my latest batch-es is:

reg query HKEY_CLASSES_ROOT\avsfile\ >nul 2>&1
if %ERRORLEVEL%==1 (
echo warning, avisynth registry entrie was not found
pause

)

henryho_hk
19th July 2007, 04:52
Ok I now have managed to crash avs2qxvid.bat.

Could you please host somewhere the a small portion of the DV clip that will also crash xvid_encraw? This will help the diagnostics.

henryho_hk
19th July 2007, 04:54
reg query HKEY_CLASSES_ROOT\avsfile\ >nul 2>&1

Thanks. I will incorporate it in the long (over)due new version.

Revgen
24th July 2007, 18:38
@henryho_hk

The Xvid Encraw exe you included in 25h doesn't recognize my 2 cores. I had to use the exe provided in 25F instead.

celtic_druid
25th July 2007, 08:05
Thought it included dynamically linked encraw builds? If so then it should come down to the version of xvidcore.dll, not encraw.

elguaxo
25th July 2007, 15:19
A problem in the dual core detection is the .bat file:

line 693:
rem set NUMTHRD=%NUMBER_OF_PROCESSORS%

I changed it to:
set NUMTHRD=%NUMBER_OF_PROCESSORS%

I have a dual core. If I don't change this line the cores are being detected, but only one of them is used.

Revgen
27th July 2007, 18:22
A problem in the dual core detection is the .bat file:

line 693:
rem set NUMTHRD=%NUMBER_OF_PROCESSORS%

I changed it to:
set NUMTHRD=%NUMBER_OF_PROCESSORS%

I have a dual core. If I don't change this line the cores are being detected, but only one of them is used.

I changed that line. The program did not detect 2 cores. The one included in 25F did so just fine.

hannah
4th August 2007, 06:41
Sorry my originals are now deleted. However I will soon be doing some more live badminton videos and will be able to post afterwards. I got around using TGHQ-CT setting. Thanks again for this batch file.


Could you please host somewhere the a small portion of the DV clip that will also crash xvid_encraw? This will help the diagnostics.

DIEGO7-5
29th August 2007, 09:56
I would really like to give this a try but the download link for the latest version seems broken. Can someone provide a mirror?

elguaxo
29th August 2007, 12:23
http://s000.tinyupload.com/index.php?file_id=38035767182841511561

DIEGO7-5
29th August 2007, 12:43
Great! Thx!

hannah
30th August 2007, 01:49
Now that Xvid 1.1.3 Released do I need to do anything to upgrade xvid_encraw in avs2qxvid.bat (henryho_hk batch file)?

hannah
31st August 2007, 12:38
Could you please host somewhere the a small portion of the DV clip that will also crash xvid_encraw? This will help the diagnostics.

well it got solved now. I believe it was a wrong distribution of the batch file I had. I now have downloaded avs2qxvid_25h_full.7z again and MTK is working fine.

thanks again for such a wonderful tool.

henryho_hk
4th September 2007, 12:13
do I need to do anything to upgrade xvid_encraw in avs2qxvid.bat (henryho_hk batch file)?

Not unless you have put xvidcore.dll in the bin directory. Yet, I have just learnt that squid_80 has implemented some great performance enhancements in the new version of xvid_encraw. You may want to try it out. (I am still testing various stuffs in XP 64bit.... now thinking of switching back to 32bit.)

cmw
29th September 2007, 22:41
Hmm, I d/l the latest version (h) now and wanted to replace the xvid_encraw provided with it with the newest built from celtic druid. Allthough I recon that this would probably result in problems, I get a strange "Preset TG-H-30 not found" error right after the compressibitly test... Umm... (well i get this with the older version (e) aswell though, if i replace the xvid build (I currently use some build from march or sth..) Possible solution? :)

henryho_hk
7th May 2008, 16:53
Sorry for the late reply.

For the low bitrate encodes, you can changing TGHQ-30 to TGHQ-CT. The script will run a compressibility test and pick the right preset for you.

The target bitrate or size must be specified. If you want high quality, you can specify a unreasonable high value (say, 1bppx) and use TGFAST-90 preset (for -58 and -90, FAST and HIGH have similar quality).

alfixdvd
12th May 2008, 11:48
How to add options to the encode performed with with xvid-encraw.

For example -lumimasking.

henryho_hk
14th May 2008, 15:43
You can add additional options in the last column of bin\xvid_presets_25h.csv (put them inside the double quotes). Just make sure that they don't conflict with the existing options. F.Y.I. "-lumimasking" is already included in some of the presets and it is intendedly excluded from some of the other presets.

alfixdvd
15th May 2008, 07:55
thanks

Lenchik
17th May 2008, 13:26
Download the full package (version 2.5h) here:
http://dump.ru/files/f/f4007765508/
(7zip compressed twice with password XviD_presets)

It seems that link from the first post isn't working now.

xbox360
20th May 2008, 02:32
Download the full package (version 2.5h) here:
http://dump.ru/files/f/f4007765508/
(7zip compressed twice with password XviD_presets)

I need a download link, please help me asap.

henryho_hk
21st May 2008, 01:34
Sendspace link added

henryho_hk
28th June 2008, 14:43
The presets have a specified range of quantizers. Hence, it will definitely get oversized or undersized when the presets are not chosen according to a compressibility check on your footage. TGHQ-30 corresponds to the ">30% preset" and you should use it when the comp. test result is 30~45%. When your comp. test result is below 30%, you have a few choices: (1) apply more softening, denoising, etc. filtering to make it more compressible, (2) reduce the resolution, (3) increase the target size, (4) use H.264 .....

ve1itas
25th July 2008, 22:55
I've just started using your batch file. It's really great! :thanks:

However, my LG standalone player doesn't seem to work with both the MTK and HQMTK presets (-30 and -45). I've read somewhere that some standalone players don't support custom quantization matrices. So I tried changing the matrix in xvid_presets_25h.csv to MPEG. It's been working perfectly since then. :)

Now I am wondering if that was the correct way to fix the issue with my player. If so, do I need to change any other columns to balance the quality with the MPEG QM.

I also have a feature request. For 2-pass encoding, skipping the first pass if a pass file already exists would be a great time saver. For example,
- encode pass 1 HQMTK-45 700kbps
- encode pass 2 HQMTK-45 700kbps
- user decides to try HQMTK-45 1000kbps
- skip pass 1 HQMTK-45 1000kbps because it is the same as 700kbps's pass 1
- encode pass 2 HQMTK-45 1000kbps
If I understand correctly, this can be easily done by appending HQMTK-45 to the pass file name and then check if the file exists or not to skip pass 1. The script can also ask the user when the pass file is detected if the user wants to skip pass 1 or not. :)

Ranguvar
25th July 2008, 23:19
I also have a feature request. For 2-pass encoding, skipping the first pass if a pass file already exists would be a great time saver.
Since I don't know what the custom quant matrix is designed for, I'm not sure. But as for re-using the pass file, just thought I should let you know that it's not advisable to re-use a pass file that has big differences in the settings - bitrate changes of that much at such a low bitrate might be bad, basically nothing that will change the output a good deal.

henryho_hk
28th July 2008, 03:42
Perhaps I can create a MD5 checksum file on the AVS file and the 1st pass file. If the checksum matches, I will skip the 1st pass.

(Is it too much for a video encoding script? lol)

henryho_hk
29th July 2008, 12:52
However, my LG standalone player doesn't seem to work with both the MTK and HQMTK presets (-30 and -45).

Unlike Teegedeck's original presets which are carefully drafted, the MTK presets are merely settings I collected from this forum (I don't even own any standalone player :p). You are free to customize those MTK preset to suit your player, just beware that the quality will probably be worse Teegedeck's original ones. BTW, on the safe side, I would use H.263 for -30 and -45, and use MPEG for -58 and -90.

squid_80
29th July 2008, 13:10
But as for re-using the pass file, just thought I should let you know that it's not advisable to re-use a pass file that has big differences in the settings - bitrate changes of that much at such a low bitrate might be bad, basically nothing that will change the output a good deal.Unlike x264, xvid's first pass stats can be used safely for any target bitrate on the second pass.
Perhaps I can create a MD5 checksum file on the AVS file and the 1st pass file. If the checksum matches, I will skip the 1st pass.

(Is it too much for a video encoding script? lol) Maybe worthwhile. It's worth noting that if the script uses directshowsource it might be a good idea to transcode into a lossless format (either before the first pass or as the first pass is run), since directshowsource sometimes has non-deterministic output.

henryho_hk
29th July 2008, 16:34
Indeed, for scripts with mvdegrain3+nnedi+emask+tdeint, etc, I am making a lossless 0-pass file too. They are simply too slow for 2-pass encoding. I am thinking of integrating this step in my batch script too. [SetMTMode() has diminished the need for weighted multi-part parallel encodes.]

Ranguvar
29th July 2008, 22:51
Unlike x264, xvid's first pass stats can be used safely for any target bitrate on the second pass.

Ah, you're right! Apologies to henry for the misinformation; I forgot that Xvid's 1-pass is just a CQ 2 encode.

ve1itas
5th August 2008, 04:12
The page http://www.divx.com/divx/windows/codec/guides/audio.php says that "DivX Certified devices require that audio is interleaved every frame for the best possible playback experience". So, for MTK presets, should the interleave be set to 1 in the bat file?

henryho_hk
5th August 2008, 16:39
Oops.... too bad that it is currently impossible to customize the mux'ing parameters for different presets. Presuming that it won't break normal AVI files, you can try modifying line 917:


echo AUDIO INTERLEAVE 3 FR >> "!TMPAMG!"

ve1itas
6th August 2008, 10:29
I have another feature request. :) Currently the script can only pick, after a compressibility test, the level according to the user specified target size. To get a certain quality level, say HQMTK-45, users need to calculate the required bitrate manually after doing a COMPTEST. It would be very convenient if users can specify the desired quality level and let the script pick the bitrate automatically. This mode can be activated by a magic bitrate number, e.g. 9999kbps, or some other means. For example, I am happy with the quality of HQMTK-45 and always want to have this quality level regardless of file size. I could then say HQMTK-45 9999kbps and the script will do a compressibility test and pick the appropriate bitrate for me. :)

henryho_hk
7th August 2008, 09:27
By selecting a preset through compressibility test w.r.t. a target size/bitrate, this dumb batch script is simply picking up a set of parameters to give a "good looking" encode at that given size. :P

A 2-pass preset is not "a certain quality level". Actually, each 2-pass presets represent a range of quality levels defined by the quantizer limits. If you specify something like "HQMTK-45 9999kbps" (say, with DVD source), all frames will be assigned with the smallest quantizers and hence the quality is highest for this preset. If you specify "HQMTK-45 1kbps", all frames will have the highest quantizers and thus the lowest quality for this preset. I am sure that you will be amazed how different these two encodes are.

Hence, unless we have a way to specify a "certain quality level", I dunno how to implement your feature request. ^_^

ve1itas
7th August 2008, 17:07
Hence, unless we have a way to specify a "certain quality level", I dunno how to implement your feature request. ^_^

Can we use the bitrate that would produce Compressibility Test (!CPTRS!) equal to the desired level (-30, -45) as the appropriate bitrate for that level?

I was using the preset with a very low desired bitrate to produce the smallest file for that level. And then I saw that all frames had the highest quantizers as you have said. Then I thought maybe this's become a constant quantizer encoding and not the way to use the preset.
HQMTK-45 1kbps: (output file size ~18MB)
I frames: 88 frames, size = 16297/ 1434181, quants = 3 / 3.99 / 4
P frames: 2508 frames, size = 5605/ 14057406, quants = 3 / 3.99 / 4
B frames: 2404 frames, size = 1279/ 3077117, quants = 4 / 5.97 / 6

Since then, I would do a COMPTEST first and use the result to calculate the bitrate that would produce Compressibility Test (!CPTRS!) equal to 45%, 869kbps for the same clip as above. Encoding at this bitrate seems to have average quantizers in the middle of the range.
HQMTK-45 869kbps: (output file size ~20MB)
I frames: 88 frames, size = 18492/ 1627347, quants = 3 / 3.41 / 4
P frames: 2508 frames, size = 5954/ 14932705, quants = 3 / 3.75 / 4
B frames: 2404 frames, size = 1779/ 4276920, quants = 4 / 4.74 / 5

After read your post, I tried a very high desired bitrate. Again, the same quantizers were used for all frames.
HQMTK-45 9000kbps: (output file size ~45MB)
I frames: 87 frames, size = 28051/ 2440482, quants = 2 / 2.00 / 2
P frames: 2508 frames, size = 13502/ 33863450, quants = 2 / 2.00 / 2
B frames: 2405 frames, size = 3652/ 8784370, quants = 3 / 3.00 / 3

PS: The difference in quality of HQMTK-45 1kbps and HQMTK-45 9000kbps is not very visible for me. Is it a good idea to always use 1kbps?
PS 2: Maybe 0kbps, 0bppx, or 0MB would be a better way to activate this mode. :)

henryho_hk
8th August 2008, 00:37
Say, if the lowest quality level of HQMTK-45 is acceptable, you can simply add a single pass constant quality line in bin\xvid_presets_25h.csv, e.g.


"OPHQ45-40","S","6","4",".",".","1","162","0","heini_mr-sap.xcm","4.0",".",".",".",".",".",".",".",".",".",".","Y","Y",".","."


BTW, I suspect that the original curve compression parameters are preventing "HQMTK-45 869kbp" to achieve the highest quantizer.

ve1itas
8th August 2008, 05:53
Say, if the lowest quality level of HQMTK-45 is acceptable, you can simply add a single pass constant quality line in bin\xvid_presets_25h.csv, e.g.


"OPHQ45-40","S","6","4",".",".","1","162","0","heini_mr-sap.xcm","4.0",".",".",".",".",".",".",".",".",".",".","Y","Y",".","."

I've read that constant quantizer encoding is not a good use of disk space. A 2-pass encoding of the same file size would always have higher quality so it's better to use 2-pass. This is why I am trying to find and use the appropriate bitrate for HQMTK-45. Is it not so?

BTW, I suspect that the original curve compression parameters are preventing "HQMTK-45 869kbp" to achieve the highest quantizer.
Is this good or bad?

henryho_hk
8th August 2008, 07:15
When we give unreasonably high or low target bitrate to 2-pass encodes, we are forcing the rate control algorithm to resort to lowest/highest quantizers all the time. This is effectively a "constant quantizer mode".... with a pretty dummy first pass. In either case, the "2-pass" encode is almost equivalent to 1-pass mode.

The original curve compression parameters in the presets are used to reduce the bitrate variation throughout the footage, helping to maintain more consistent quality. This is particularly helpful for the presets selected according to compressibility test result.

Back to your original question, if you satisfied with the lowest or highest quality encode of a 2-pass preset, simply use their 1-pass equivalent. If you prefer something in between, it is much more difficult.

henryho_hk
11th August 2008, 03:04
Just bought myself a Q6600 running at 3.2G :devil: :devil:. Now I can evaluate more seriously the performance of MT() and/or concurrent multi-part encodes. :cool: :cool:

Livesms
19th September 2008, 20:29
Just bought myself a Q6600 running at 3.2G :devil: :devil:. Now I can evaluate more seriously the performance of MT() and/or concurrent multi-part encodes. :cool: :cool:

Any news ?

henryho_hk
20th September 2008, 03:07
Too busy on work these months for serious encode comparsions. Sorry ppls.

Edit: I did a quite a number of encoding experience with Q6600. Currently, I prefer running four single-threaded encoding tasks simultaneously. It does appear to complete faster than one single MT'ed AVS encoding session. The 2-pass target size of each portion is estimated by the size of their pass-0 temp file.

henryho_hk
4th September 2009, 05:53
For the color problem, would it be due to the color coefficient? Try http://forum.doom9.org/showthread.php?t=82217

As for WAV audio, I am afraid you need to do it manually because the batch script converts audio to MP3 or OGG by default.

henryho_hk
4th September 2009, 11:02
It sounds like a common output (overlay, vmr, etc.) symptom for YV12 (e.g. XviD, DivX, etc.). What codec do your fraps records use? Perhaps its RGB-only too.

henryho_hk
5th September 2009, 14:41
The color problem is how YV12 is being displayed in the computer, not really related to YV12 or XviD encoding itself. There are even some very computational intensive renderers (such as http://forum.doom9.org/showthread.php?t=146228) for this task. If the color is good when you force RGB output, you may try that thread for more info.

Livesms
18th October 2009, 22:34
Trying Windows Vista 7 x64 with my AMD 4850e + 780G (GA-MA78G-DS3H) + 2 * 2048 DDR2 PC6400 Kingston
And found unable to encode using script - AviMux refuse to start at all.
Downloaded AVI-Mux_GUI-1.17.8.zip from author's site (http://www.alexander-noe.com/video/amg/#download) - the same problem - just error screen.

Any chances to change muxing soft from AviMux to VirtualDubMod/NunDub - need only AVI Xvid + single track MP3 VBR muxing

henryho_hk
20th October 2009, 06:41
Yup, I just need to take the portion of muxing code from the older versions.....

Livesms
20th October 2009, 10:56
Yup, I just need to take the portion of muxing code from the older versions.....

Any new improvements with new versions?
Maybe xvid version update ?

henryho_hk
21st October 2009, 08:24
You can simply put an updated version of xvidcore.dll inside the BIN directory. And you can change the settings file (csv format) to override the presets, say, to enable VAQ on different presets.

Livesms
21st October 2009, 08:41
You can simply put an updated version of xvidcore.dll inside the BIN directory. And you can change the settings file (csv format) to override the presets, say, to enable VAQ on different presets.

And what about AviMux with Windows 7 ?
Cause I have no auto encode queue of avs scripts - after encode get's an error :(
Maybe is it possible to replace Avimux with NunDub for MP3 audio
- if there is the only MP3 / AC3 audio track - use NunDub (VirtualDubMod)
- if there is two or more audio track or other complicated situation - then use AviMux

In my case it will be the best way

henryho_hk
25th October 2009, 06:01
Extracted from version 2.4a....


set VDMPATH=%INSPATH%VirtualDub15102Mod2542
set VDMMEXE=%VDMPATH%\VirtualDubMod.exe

if not "%VDMMEXE%"=="" if not exist "%VDMMEXE%" (
echo VirtualDubMod not found. Please download:
echo http://prdownloads.sourceforge.net/virtualdubmod/VirtualDubMod_1_5_10_2_b2542.zip?download
echo and extract all contents in "%VDMPATH%"
pause
goto :EOF
)



:DOAVMUX

set SRCVFN=%~1
set SRCAFN=%~2
set MUXFLN=%~3

if /i "!SRCAFN:~-4!"==".mp3" (
set AUDFMT=0x00000202
set AUDOPT=1
)
if /i "!SRCAFN:~-4!"==".ogg" (
set AUDFMT=0x00000204
set AUDOPT=0
)

set ADELAY=0ms.xxx
for /f "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,10,21,22,23,24,25,26*" %%a in ("!SRCAFN:~-24!") do (
if "%%~a"=="DELAY" if "%%~c"=="" set ADELAY=%%~b
if "%%~b"=="DELAY" if "%%~d"=="" set ADELAY=%%~c
if "%%~c"=="DELAY" if "%%~e"=="" set ADELAY=%%~d
if "%%~d"=="DELAY" if "%%~f"=="" set ADELAY=%%~e
if "%%~e"=="DELAY" if "%%~g"=="" set ADELAY=%%~f
if "%%~f"=="DELAY" if "%%~h"=="" set ADELAY=%%~g
if "%%~g"=="DELAY" if "%%~i"=="" set ADELAY=%%~h
if "%%~h"=="DELAY" if "%%~j"=="" set ADELAY=%%~i
if "%%~i"=="DELAY" if "%%~k"=="" set ADELAY=%%~j
if "%%~j"=="DELAY" if "%%~l"=="" set ADELAY=%%~k
if "%%~k"=="DELAY" if "%%~m"=="" set ADELAY=%%~l
)
set ADELAY=!ADELAY:~0,-6!

set TMPVCF=%SRCTMPP%.vcf

echo VirtualDub.Open^("!SRCVFN:\=\\!","",0^);>"%TMPVCF%"
echo VirtualDub.RemoveInputStreams^(^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetSource^("!SRCAFN:\=\\!",!AUDFMT!,!AUDOPT!^);>>"%TMPVCF%"
echo VirtualDub.stream[0].DeleteComments^(1^);>>"%TMPVCF%"
echo VirtualDub.stream[0].AdjustChapters^(1^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetMode^(0^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetInterleave^(1,500,1,!ADELAY!,0^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetClipMode^(1,1^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetConversion^(0,0,0,0,0^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetVolume^(^);>>"%TMPVCF%"
echo VirtualDub.stream[0].SetCompression^(^);>>"%TMPVCF%"
echo VirtualDub.stream[0].EnableFilterGraph^(0^);>>"%TMPVCF%"
echo VirtualDub.stream[0].filters.Clear^(^);>>"%TMPVCF%"
echo VirtualDub.video.DeleteComments^(1^);>>"%TMPVCF%"
set CHAPNUM=0
if exist "%SRCPREF%.zones.txt" (
echo VirtualDub.video.AddChapter^(0,1,"Chapter 1"^);>>"%TMPVCF%"
set CHAPNUM=1
for /f "usebackq" %%A in (`type "%SRCPREF%.zones.txt"`) do if %%A NEQ 0 (
set /A CHAPNUM+=1
for /f "usebackq tokens=1,2* delims= " %%V in (`echo scale ^= 10 ^; x ^= %%A / ^( !ORIFFPS! ^) * 1000 + 0.5 ^; scale ^= 0 ^; x /^= 1 ^; x ^| "%BCFLEXE%" -l`) do echo VirtualDub.video.AddChapter^(%%V,1,"Chapter !CHAPNUM!"^);>>"%TMPVCF%"
)
)
echo VirtualDub.video.AdjustChapters^(1^);>>"%TMPVCF%"
echo VirtualDub.video.SetMode^(0^);>>"%TMPVCF%"
echo VirtualDub.video.SetRange^(0,0^);>>"%TMPVCF%"
echo VirtualDub.video.SetCompression^(^);>>"%TMPVCF%"
echo VirtualDub.video.filters.Clear^(^);>>"%TMPVCF%"
echo VirtualDub.subset.Clear^(^);>>"%TMPVCF%"
echo VirtualDub.subset.AddRange^(0,%ORIFR1%^);>>"%TMPVCF%"

if /i "!MUXFLN:~-4!"==".avi" (
if /i "%CTTYPE%"=="STL" (
echo VirtualDub.SaveSegmentedAVI^("!MUXFLN:\=\\!", 2000, 0^);>>"%TMPVCF%"
) else (
echo VirtualDub.SaveAVI^("!MUXFLN:\=\\!"^);>>"%TMPVCF%"
)
)
if /i "!MUXFLN:~-4!"==".ogm" echo VirtualDub.SaveOGM^("!MUXFLN:\=\\!"^);>>"%TMPVCF%"
echo VirtualDub.Close^(^);>>"%TMPVCF%"

echo.
start "VDM" /b /wait %SystemRoot%\regedit.exe /s %BINPATH%\vdm_no_welcome_splash.reg
echo start "Muxing" /b /wait /min /belownormal "%VDMMEXE%" /s"%TMPVCF%" /x
start "Muxing" /b /wait /min /belownormal "%VDMMEXE%" /s"%TMPVCF%" /x

rem move /y "%SRCVFN%" "%TMPPATH%"
rem move /y "%SRCAFN%" "%TMPPATH%"

goto :EOF

henryho_hk
25th October 2009, 06:13
Actually, you can enable the Win7's compatibility mode for AVIMUX_GUI. Try sth like "XP SP2".

Livesms
25th October 2009, 08:27
Actually, you can enable the Win7's compatibility mode for AVIMUX_GUI. Try sth like "XP SP2".

Didn't understand you. Can you explain?

henryho_hk
25th October 2009, 12:52
http://www.sevenforums.com/tutorials/316-compatibility-mode.html

Livesms
25th October 2009, 13:34
http://www.sevenforums.com/tutorials/316-compatibility-mode.html

OMG - it's works :))) :thanks::thanks::thanks:

SilaSurfer
2nd November 2009, 15:01
Hello Henryho-hk first off all thank you very much for this awasome tool, and Teegedeck for his awasome presets. I did couple of rips of my dvds and it looks great. I have couple of questions.
First: I do my encodes in Mpeg standard quant type because i watch my rips on standalone dvd player so I changed in presets file from the 6of9 matrix to Mpeg but I get undersized files and I think its because of comp check that uses 6of9 matrix. Is this editable so it may be changed?
Second: I'm always adding audio and splitting later so doing some of my rips i get splitting when file reaches 2000MB so where can I change this so i would have a single file using HQMTK presets. Thanks for your time and keep it up you've given us something to play with. hehe

henryho_hk
4th November 2009, 16:35
(((1)))

a) Download an updated version of XviD from http://www.free-codecs.com/download/Nic_XviD_Codec.htm

b) Replace the xvidcore.dll in the bin directory with the above updated one

c) Add two new presets in xvid_presets_25h.csv. Try them out.


"HVAQMTK-00","1","5","1",".",".","1","162","0","H263",".","2","31","2","31","2","31",".",".",".",".",".",".","Y","-lumimasking"
"HVAQMTK-00","2","6","1",".",".","1","162","0","H263",".","2","31","2","31","2","31",".",".",".",".","Y","Y",".","-lumimasking"
"H263VAQ-00","1","5","1",".",".","2","162","0","H263",".","2","31","2","31","2","31",".",".",".",".",".",".","Y","-lumimasking"
"H263VAQ-00","2","6","4",".","Y","2","162","0","H263",".","2","31","2","31","2","31",".",".",".",".","Y","Y",".","-lumimasking"


(((2)))

There are two ways to avoid the splitting.

i) [Seems not working....] Rename the HQMTK presets to something like HQMKK. (i.e., no "MTK" in the preset name)

ii) Look for the following codes in the batch file and switch to the 2nd cide segment.


rem if "!MUXFMT!"=="STL" (
echo AVI HAALIMODE 0 >> "!TMPAMG!"
echo OPENDML 0 >> "!TMPAMG!"
echo LEGACY 0 >> "!TMPAMG!"
echo RECLISTS 0 >> "!TMPAMG!"
echo NUMBERING $Name_$Nbr{2} >> "!TMPAMG!"
echo MAXFILESIZE ON >> "!TMPAMG!"
echo MAXFILESIZE 2000 >> "!TMPAMG!"
rem ) else (
rem echo AVI HAALIMODE 1 >> "!TMPAMG!"
rem echo OPENDML 1 >> "!TMPAMG!"
rem echo LEGACY 1 >> "!TMPAMG!"
rem echo RECLISTS 0 >> "!TMPAMG!"
rem echo NUMBERING OFF >> "!TMPAMG!"
rem echo MAXFILESIZE OFF >> "!TMPAMG!"
rem )

SilaSurfer
6th November 2009, 17:16
Thanks for your answer. With the HQMTK presets I can play avi files on my standalone just the filesize doesn't add up. With the 6of9 matrix it's harder to compress the video then with Mpeg standard so my filesizes are not wright. I was thinking of doing a compcheck with Mpeg standard matrix it would give me more
accurate results.

For Example: I'm converting a DVD movie and the resolution is 720x304, the original audio is used Ac3 448 6 channel. My aiming filesize is 1800MB. Now when I do a compcheck it gives me the result 81% so I go for HqMtk58(MPEG standard) and the resulting filesize is like 400 MB smaller. And when the first pass is done the avarage bitrate is 1408Kbit/s and desired one is 1834Kbit/s. This is not the only case.

Can I change like in the presets, compcheck settings (6of9 to Mpeg standard)


For the spliting part I came around that by tuning up a little the TGHQ presets removing Q-pel and replacing 6of9 with Mpeg standard. So I use this presets for videos that are over 2000MB

henryho_hk
8th November 2009, 11:32
The undersized problem is partly due to "-altpass2". Try changing it to "-pass2" in the batch script.

Also, 6of9 is not 100% standalone compatible. Use 6of9-HVS (I remember that I use it in the MTK presets). You also need to change the number of consecutive B-frames to "1" instead of "2".

SilaSurfer
8th November 2009, 19:18
Thank for your time Henryho_hk. I'm really taking your time I know, sorry. The custom matrices don't work on my standalone, none of the used ones. i tried them with short encodes from the movies. I just encoded Transformers from DVD and the filesize was correct.The compcheck gave me 60% and I encoded the movie with TGHQ58 preset (Mpeg standard and no Qpel). What I wanted to ask you if the settings for compcheck are editable so I can change settings like in the presets. Thanks again!

henryho_hk
9th November 2009, 01:00
Um.... If your player can take MPEG or H263 matrices only, I recommend you trying the universal preset "HVAQMTK-00" in post #207. To ensure that N-VOP is not generated, you can also use the new XviD builds in http://jawormat.republika.pl/xvid.html and add "-drop -1" in the xvid_encraw command line. (Tips: look for lines below "set ZZ1=,q,!P1Q!,K!CAT!!ZBS!")

Jawor
9th November 2009, 20:09
To ensure that N-VOP is not generated, you can also use the new XviD builds in http://jawormat.republika.pl/xvid.html and add "-drop -1" in the xvid_encraw command line.
xvid_encraw doesn't seem to accept --drop -1.

I uploaded special xvidcore.dll files that treat "0" like "-1".
1.2.2 (http://jawormat.republika.pl/XviD_122_encraw.zip)
1.3.-127 (http://jawormat.republika.pl/XviD_13-127_encraw.zip)

henryho_hk
10th November 2009, 01:03
squid's 20070831 version does accept "-drop -1". There is no error. But I need to test whether there is really no N-VOP generated.

SilaSurfer
10th November 2009, 15:14
Hey Henryho_hk I want to test something and I need your assistance. How can I change custom matrix usage in your batch file. I want to change to a diffrent custom matrix for Hqmtk presets. I'm on to something here and I don't know how to change that.


It's ok i figured it out.

SilaSurfer
10th November 2009, 17:39
Henryho_hk. I've done some researching, and I found something interesting that some matrices are fully supported by MediaTek1389XX chipsets which standalone players use. Five of them were labeled as perfect playback.

Andreas_78er matrix
Deedes Semi insane matrix
Hvs best picture matrix
hvs better picture matrix
hvs good picture matrix

The standalone that was tested uses MediaTek1389DE chip/decoder, the other ones from this family are GE, FE, EE(mine)

So I've done three encodes one with HVS best picture matrix, Semi insane and Andreas_78er matrix with your batch file. Just changed settings for matrices in batch file and preset file, other setting stayed as you wrote them. Avarage bitrate was 1500Kbit/s. I'm going to test them tonight on my dvd player.

Andreas_78er: compcheck 70%, 6of9 59%, Hqmtk58 preset, Visual quality is very good and resulting filesize is 25MB smaller than desired one

Hvs best picture: compcheck 97%, 6of9 59%, Hqmtk90 was used and resulting filesize is 18MB smaller than desired one

Semi insane matrix produces excellent results: hqmtk58 preset, resulting filesize 25MB larger then desired one

I hope this works on my player. Visual quality is very good with Andreas_78er matrix.

And I'm sorry for double posting.

SilaSurfer
11th November 2009, 15:51
Hello. Yesterday I tried encodes with matrices above and results are bad. Playback fine but with artifacts, with all of them so its Mpeg standard for me at the moment. You were right henryho_hk about "change the number of consecutive B-frames to "1" instead of "2". Now I'm getting right filesizes with HQMtk presets. Thanks again. I'm seriously thinking of buying a HTPC. hehe. One more question about ripping from dvd, What do you think is better "IEEE -1180 Reference" or "64-bit Floating Point" in Dgindex?

henryho_hk
13th November 2009, 03:42
Changing from "-altpass2" to "-pass2" is for fixing undersizing. Cons.B-frame=1 is for compatibility.

As for idct, it does not really matter. For best results, it is said that the encoding and decoding idcts should match each other. However, I dunno whether there is any way to check for the encoding idct. Hence, I use the "32-bit SSE2 MMX" all the time.

SilaSurfer
13th November 2009, 14:33
What I meant is that I'm happy with TGHQ presets with MPEG Standard and no Qpel, I get right filesizes. While I was looking at your batch file I found this url:
"http://members.optusnet.com.au/squid_80/xvid_encraw.zip"
so I downloaded latest Xvid_encraw version and replaced the one in you package, because I noticed somewhere on the net it is optimimized. Is this ok?
And where do you edit the setting so packed bitstream are not used during encodings, my player boorks on them, so I don't have to remove them via MPEG4Modifier. This is the last thing I need ,so thank you very much Henryho_hk for your time I appreciate it.

henryho_hk
13th November 2009, 15:17
Look for

set PPK=-packed
if /I "!ML:~-3!"=="-CT" set PPK=-nopacked

SilaSurfer
13th November 2009, 15:51
Thanks but what about Xvid_Encraw?

henryho_hk
13th November 2009, 16:39
Which version are you talking about?

SilaSurfer
13th November 2009, 16:51
The latest one from here http://members.optusnet.com.au/squid_80/xvid_encraw.zip
I changed the one from your package with this one and encoding is faster at least on my PC, could you try it out please.

henryho_hk
14th November 2009, 02:18
Isn't my batch using that version already? nvm. As long as it is from squid_80, it is always okay.

SilaSurfer
14th November 2009, 17:08
Well the one that I downloaded seems to use only one processor core, but I have a dual core processor and the one that was supplied with your batch file I remember that I saw while encoding both cores were used, but the downloaded one encodes faster at least here.
Your package: Xvid_Encraw 2007.02.03
Downloaded One: Xvid_Encraw 2007.08.31

SilaSurfer
18th November 2009, 16:51
What Xvid version do you use Henryho_hk with this presets, I've been having some problem while encoding LOTR: Fellowship of the Ring DVD Extended version. At th begining of the movie where studios logo comes up I see green blocks and this is only in the dark areas. Tried everything and it seems that xvid encraw is producing this anomaly, it is not present in the source, I also tried it on the shorter version of LOTR and it is there so two dvds, Idct is not a culprit because while encoding in Virtual dub I don't get this green "blocks" so I don't know what to do. Any suggestions, I would be very grateful

henryho_hk
19th November 2009, 12:11
Try Jawor's XviD compiles at http://forum.doom9.org/showthread.php?p=1342310#post1342310

Which software player are you using?

SilaSurfer
19th November 2009, 16:41
Thanks for your response. This is basicly the product of encoding I don't see it in Wmplayer classic when previewing avs script and I wan't to correct myself it is also present in Virtual dub after encoding with settings in xvid from TGHQ presets. It is like a big green block stretching from right side of the screen to the left, it is more visible for example when the studios logo is shown where there is so much darkness and also through the rest of the movie in very dark scenes.

Dvd Decrypter last version
Avisynth version 2.5.8 last stable one, tried also with 2.5.5
Xvid codec 1.2.2 stable from Koepi, uninstaled and did a fresh install
Dgindex 1.5.6 latest one tried also on 1.4.3 Tried 4 different Idcts still present

This is also seen on my standalone. Then I tried with Virtualdub again and encoded with Default xvid setting, it was still there but not so visible. Today I tried it on my sisters Pc, with these apps same thing. Now I will do something that I didn't do for a long long time, I am going to encode in divx so I can eliminate Xvid as a culprit. Using BsPlayer for watching. Any suggestions?



Update: Tried with Divx 7 version same script same settings in all apps and no green artifacts, so all of them are fine: Dgindex, Avisynth and ripping is ok. Something to do with Xvid. What do you think?. Could this be a version of Xvid that is producing this, if so should I try Jawors builds?

Update 2: It seems this is only produced with Koepi's version of Xvid 1.2.2 codec. I tried Jawor's 1.2.2 version with your batch file with TGHQ-90(6of9) preset and the green blocks are gone. I wonder if I can use Jawors version for all presets?

henryho_hk
24th November 2009, 04:13
yes, u can use Jawor's version for all presets.

SilaSurfer
25th November 2009, 14:24
Hey Henryho_hk thanks again for responding, I would post this problems that I have somewhare else on this forum but it is against the rules to post same question on other threads. The problems are still present but what is known now is that it is the decoding issue, this is why green blocks aren't visible with Jawors compile because it doesn't come with a decoder so when I was viewing it block were not there and it is also not present in VirtualDub when previewing the encoded video. Ffdshow decoding gives me the same thing. So here is what I found out so far:

1.Tried only Xvid 1.2.2 versions
2. It is only the problem with DVD sources, had some files on my disk that are captures from digital TV 720p resolutions that I did some time ago with x264 codec based on guides on this site, and I encoded them to xvid 480p with your batch file and Teegedeck presets and "no green blocks" anywhare so only when I'm encoding from dvd sources.
3. Basicly this green blocks are more ampliefied with diffrent settings used in xvid, more detail more green blocks. Not so visible with h263, more with Mpeg standard, a lot with 6of9.
4. Not visible while viewing in VirtualDub or if there is no xvid decoder present on my PC. Tried also Bsplayer, Wmplayer 9, Vlc Player and my standalone, so only software and hardware players. Running Vista 32bit on my sistem.

I think you have more experiance then me so if you could help I would be very grateful and thanks for everything.

henryho_hk
26th November 2009, 03:51
Try cutting about 5~10 seconds of "green-blocked" segment of the AVI and upload it to a somewhere so that we can take a look too. Make sure those green blocks are visible when loaded in Virtualdub.

SilaSurfer
27th November 2009, 11:14
Ok here you go, I uploaded it on the same page where you uploaded your batch file.

http://www.sendspace.com/file/9x1pbo

Green block is not visible in VirtualDub thats the point it is only visible in software and hardware players and if I use Xvid, Divx and FFdshow decoders. When there is no decoder present on my pc if I uninstall them no green block. Take a look in fullscreen, it is from the beginning of the movie about 1000 frames where this is visible. Thanks for your help.

Update!
I think this is due to low bitrate usage by the codec, because of high compression in those dark areas of the video, when I encoded the movie with h263 matrix the green blocks are not present, so if I would like to encode it with for example Tghq-58 preset I need to "lower the compressibility-force higher bitrates" in those areas. What do you recommend?

henryho_hk
6th December 2009, 10:51
Try removing "-lumimasking" from the preset you are using.

SilaSurfer
6th December 2009, 15:40
I don't see it:

"TGHQ-58","1","5","1",".",".","2","162","0","6OF9","3",".",".",".",".",".",".",".",".",".",".",".",".","Y","."
"TGHQ-58","2","6","4",".","Y","2","162","0","6OF9",".","3","4","3","5","3","5","10","3",".",".","Y","Y",".","."

It is only present in "30" presets:

"TGHQ-30","1","5","1",".",".","2","162","0","STUL","3",".",".",".",".",".",".",".",".",".",".",".",".","Y","-lumimasking"
"TGHQ-30","2","6","4",".","Y","2","162","0","STUL",".","3","5","3","5","3","5","30","15",".",".","Y","Y",".","-lumimasking"

I don't use those presets, only TGHQ-45-58-90

I was thinking, maybe using Blockbuster filter in those areas but I don't have experiance with it.

henryho_hk
9th December 2009, 10:34
You need MTK or HQMTK presets for standalone hardware players.

Yet I dunno why your computer has playback problems. There are no such problems in my computer, in ms media player (+ffdshow), mpc-hc or kmplayer.

SilaSurfer
13th December 2009, 16:43
You need MTK or HQMTK presets for standalone hardware players.

I forgot to mention that I've changed a DVD player which has Zoran chipset with mine and is handling CQMs very good.

Yet I dunno why your computer has playback problems. There are no such problems in my computer, in ms media player (+ffdshow), mpc-hc or kmplayer.

I presume you are using ffdshow for decoding in all cases, if so do you have any filtering enabled in ffdshow? If it is my computer, then why is it also present on my satndalone? I'll try Blockbuster and see if that changes anything. Thanks for everything

henryho_hk
14th December 2009, 05:42
The TGHQ and TGFAST presets use 2 consecutive B frames, QPel, etc. Standalone players are usually not happy with these settings.

Green blocks appear to be decoding errors. I suspect that some outdated codecs are taking the role in ur computer. Our computers are usually much more capable and flexible than the standalone players, unless somethings are messing up, such as codec packs, renderers, display drivers (very rarely), etc.

chesterman
9th January 2010, 01:08
The TGHQ and TGFAST presets use 2 consecutive B frames, QPel, etc. Standalone players are usually not happy with these settings.

Green blocks appear to be decoding errors. I suspect that some outdated codecs are taking the role in ur computer. Our computers are usually much more capable and flexible than the standalone players, unless somethings are messing up, such as codec packs, renderers, display drivers (very rarely), etc.

Agreed.

boveyking
9th March 2010, 01:32
I tried to produce an avi with avs2qxvid, there is no audio. I also tested with xvid_encraw, there is still no audio.

Before testing with this tool, I tried with avs2Avi, there is no audio too.

Does anyone know why there is no audio?What configuration too to modify in order to produce the audio.

The avs scripts is so simple just like:

AVISource("D:\dev\video-process\avs\sample\avi-1.AVI",audio=true)

Thank you every much.

henryho_hk
10th March 2010, 03:15
xvid_encraw does not encode audio.

When u load ur simple AVS script in Virtualdub, is there any audio?

roozhou
11th March 2010, 08:06
I tried to produce an avi with avs2qxvid, there is no audio. I also tested with xvid_encraw, there is still no audio.

Before testing with this tool, I tried with avs2Avi, there is no audio too.

Does anyone know why there is no audio?What configuration too to modify in order to produce the audio.

The avs scripts is so simple just like:

AVISource("D:\dev\video-process\avs\sample\avi-1.AVI",audio=true)

Thank you every much.
Use mencoder.

SilaSurfer
23rd October 2010, 20:29
Hello HenryHo.

You posted these presets on one ofthe previous pages of this thread, so I tried them. WOW

"HVAQMTK-00","1","5","1",".",".","1","162","0","H263",".","2","31","2","31","2","31",".",".",".",".",".",".","Y","-lumimasking"
"HVAQMTK-00","2","6","1",".",".","1","162","0","H263",".","2","31","2","31","2","31",".",".",".",".","Y","Y",".","-lumimasking"
"H263VAQ-00","1","5","1",".",".","2","162","0","H263",".","2","31","2","31","2","31",".",".",".",".",".",".","Y","-lumimasking"
"H263VAQ-00","2","6","4",".","Y","2","162","0","H263",".","2","31","2","31","2","31",".",".",".",".","Y","Y",".","-lumimasking"

I've been experimanting with Xvid VAQ latest Jawors Build 1.2.2 and I must say I'm very glad I did. Tried Mpeg default with VAQ very good results and avi's are all playable on my standalone until I use a custom matrix like 6of9 hehe but thats no problem because default will do.

2 question:
1. Have you tried encoding with some Teegedeck options in his presets like doing a first pass with fixed Q=X, limiting quantizers in second pass with the usage of VAQ?
2. What about the Comp check?

henryho_hk
24th October 2010, 01:00
I suggest

"HVAQMTK-00","2","6","4",".",".","1","162","0","H263",".","2","31","2","31","2","31",".",".",".",".","Y","Y",".","-lumimasking"

It was said that VAQ should be used with H263 or other high bitrate custom matrices. Is your 2-pass bitrate very high or very low?

We can use fixed quant. in Teegedeck's first pass because the preset should have been chosen by means of compressibility test; therefore the average quant. used in second pass should be similar to the fixed one. For the VAQ entry, we do not (cannot) specify any present level, so I use varied quant. in both passes.

Comp. tests use fixed quant. too:

"NRM-CT","S","4","0",".",".","2","162","0","6OF9","3",".",".",".",".",".",".",".",".",".",".",".",".","Y","."
"STL-CT","S","4","0",".",".","1","162","0","6OF9","3",".",".",".",".",".",".",".",".",".",".",".",".","Y","."

SilaSurfer
28th October 2010, 16:00
I suggest

"HVAQMTK-00","2","6","4",".",".","1","162","0","H263",".","2","31","2","31","2","31",".",".",".",".","Y","Y",".","-lumimasking"

My SAP unit supports Qpel, AQ, GMC only in Divx, up to 6000 Kbps, and 5 b-frames that is what I tested. It doesn't like packed bitstream and CQMs:o:

It was said that VAQ should be used with H263 or other high bitrate custom matrices. Is your 2-pass bitrate very high or very low?

So only H263 for me. In range from 1800 to 2400 Kbps

henryho_hk
29th October 2010, 05:09
I learnt some time before that XviD uses max. 2 consecutive B-frames only, even if we specify 3 or more.

1800-2400kbps is quite high. Is it DVD or Bluray?

SilaSurfer
30th October 2010, 18:30
I learnt some time before that XviD uses max. 2 consecutive B-frames only, even if we specify 3 or more.

Well I didn't know about that, that info came from a friend who has LG standalone unit built around the same chipset as mine Philips unit. I never use more then 2 B-frames.

1800-2400kbps is quite high. Is it DVD or Bluray?

Mostly DVDs as source filtered with LSFmod. I did buy a Bluray of The Departed, even if I don't own HD devices yet (soon), but have a Bluray unit in my PC, just because I was interested how it would look like and because slowly it will come to transition to x264 for me, with all the love for Xvid:p I will still use it but for other encodes.


To ask you Mpeg default in Xvid + Vaq, I didn't see any difference from H263, 2-pass encodes (short 5 min clips) came out the same filesize and ones with Mpeg had more details and sharp image compared with H263. I didn't notice any so called unwanted results. So is MPEG ok?

henryho_hk
1st November 2010, 00:57
You must try QTGMC (http://forum.doom9.org/showthread.php?t=156028).

SilaSurfer
1st November 2010, 13:56
Thanks for the link. What about Xvid+Vaq and Mpeg default?

henryho_hk
3rd November 2010, 17:03
MPEG and lower-bitrate custom matrices work by "applying more compression" at the same quantizers.
VAQ works by using higher quantizers (hence more compression) at different areas.

So, when they come together, some picture areas may be compressed too much, causing blockiness, rainbow textures, ringing, etc.

In your case, since you specify quite a high bitrate, I believe the quantizers never go too high, and so there is no problem of over-compression.

SilaSurfer
3rd November 2010, 18:51
Thanks HenryHo for clearing that out.

kachaj
18th November 2010, 21:22
I have a strange problem encoding with avs2qxvid.
Every time I try to encode, the output framerate is jerky. AVS scripts are fine. Virtualdub plays the correctly This happens for every encode I feed to avs2qxvid. Tested on two machines (one winxp home sp3, other win7x64), jerky video happens on both.

henryho_hk
19th November 2010, 13:56
May I know your encoding parameters?

kachaj
19th November 2010, 22:26
avs file:
LoadPlugin("C:\Program Files (x86)\megui\tools\ffms\ffms2.dll")
FFVideoSource("C:\Users\User\Desktop\avs2qxvid_25h_full_\tron-tlr1_h480p.mkv")
Video in this script is actually a Tron Legacy trailer from apple trailers remuxed to mkv. All presets built-in to avs2qxvid give jerky output at their default settings. This also happens with different types of input eg. avisource

henryho_hk
21st November 2010, 03:22
Just tried. No problem here (mov trailer remuxed to mkv). Can u post ur transcoded AVI somewhere?

kachaj
21st November 2010, 23:27
ok. So I have found a problem with playback. Every time I use ffdshow to playback the video is jerky. But if I use WMP12 the file plays perfectly normal. The problem is libavcodec. All software based on it play this file jerky-style. Tried KMplayer, DOTPlayer (I know it's almost the same software but they are libavcodec-based). Here is my file for testing (http://cid-d81d0698cb41c502.office.live.com/self.aspx/.Public/tron-tlr1%5E_h480p.mkv%5E_TGHQ-58%5E_br%5E_1073.avi)

henryho_hk
22nd November 2010, 06:42
are you using the newer "ffdshow tryouts (http://ffdshow-tryout.sourceforge.net/)"?

kachaj
22nd November 2010, 09:24
Ffdshow version I use is rev3629. I thought the jerky problem is CQM-related but converted this trailer with CQM in VirtuaDubMod and the issue does not occur.

henryho_hk
24th December 2010, 10:49
Would it be the "packed bit stream" option?

Livesms
24th December 2010, 23:14
Maybe missed the topic, but...
Is there any avs2qx264.bat [AVS to Quality x264] package ?

kachaj
25th December 2010, 01:50
Would it be the "packed bit stream" option?
Indeed the problem was caused by "packed bit stream" option. Removed it from an avi file with MPEG4Modifier. Is there an option in xvid_presets_25h.csv file to remove packed bistream permanently?

Edit: found this option earlier in this thread so nevermind :P
BTW, IMO perfect batch script for ASP encoding

henryho_hk
26th December 2010, 13:33
Maybe missed the topic, but...
Is there any avs2qx264.bat [AVS to Quality x264] package ?

The major mission of avs2qxvid is to implement compressibility tests and thus Teegedeck's XviD presets. These seems not available/needed by x264.

henryho_hk
28th December 2010, 06:08
Is there an option in xvid_presets_25h.csv file to remove packed bistream permanently?


I wish to include it in xvid_presets_25h.csv but I am hitting the 26-variable limit in DOS batch "for" syntax. :devil:

SilaSurfer
17th May 2011, 19:33
Hi Henryho_hk. I was just wondering is your batch file compatible with Xvid 1.3.1 (2.4.2011) from Jawor. He added Xvid encraw with his release. I was wondering if I should replace one that came with your batch file with one from his package?

Nevermind, it is compatible. Thanks anyway

henryho_hk
18th May 2011, 05:55
Sorry, Jawor's compile cannot replace squid80's mod because the batch requires stats file output which plain xvid_encraw does not support. Also, the plain xvid_encraw does not produce OpenDML AVI (corrupted files for >2GB AVI, not to say >4GB intermediate pass-0 temp. AVI).

Indeed, I have further modified Jawor's XviD 1.3.1 source and hacked in the stats file output (SSIM file output too). OpenDML AVI codes seem too hard and so we have to stay with MPEG4 Elementary Stream (M4V) output. Fortunately, ffms2() supports such file format.... with two drawbacks: (1) indexing M4V file in gigabytes is lengthy and (2) the compressibility-test pass will need a SSD drive for reasonable performance.

If you are not doing compressibility test, it will be okay though.

SilaSurfer
18th May 2011, 20:00
Well I have made some short tests with about 1530 frames short clips and had proper results (compressibility wise). Your batch file with squid80 Xvid_encraw that came along and Jawors 1.3.1 version. Now I don't know about longer video files because I didn't have time to do some more tests.