Log in

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


Pages : [1] 2 3 4 5 6

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).