Log in

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


Pages : 1 2 3 [4] 5 6

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: