View Full Version : Why does the AviSynth script have multiple ConvertToYUY2() statements?
FredThompson
3rd June 2003, 21:00
Why does the generated AviSynth script have a ConvertToYUY2() statement followed by a resize then ANOTHER ConvertToYUY2()?
If anything, it's just going to slow the process down, isn't it? At worst, wouldn't any bugs in the conversion be even more apparent because it's being done twice?
Holomatrix
4th June 2003, 00:24
? it is only added once. one of your avisynth scripts your using in dvd2svcd.ini must have ConvertToYUY2() somewhere in it. that's never happened to me
FredThompson
4th June 2003, 00:40
Are you commenting based on what you see in the edit window or the stored version from running a job. The stored version is what I'm referring to. Sorry, should have been more explicit with the first post.
Look inside AviSynth_Script_File.avs after running a job.
Holomatrix
4th June 2003, 00:48
I'm just talking about what I see when viewing/editing the avs in autofit before encode (no ConvertToYUY2()) then what I see in the avs past'd to the encoder.
My script (avs) looks like this;
Import("D:\MOVIEE~1\RESAMP~1.AVS")
LoadPlugin("C:\PROGRA~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
mpeg2source("D:\MOVIEE~1\DVD2AV~1.D2V")
BicubicResize(352,480,0.0,0.6)
LoadPlugin("C:\Program Files\DVD2SVCD\YV12filters\Fluxsmooth.dll")
LoadPlugin("C:\Program Files\DVD2SVCD\YV12filters\Blockbuster.dll")
LoadPlugin("C:\Program Files\DVD2SVCD\YV12filters\asharp.dll")
FluxSmooth(3,3)
Blockbuster(method="noise", variance=.5, seed=1)
asharp(1,3,1,True)
ConvertToYUY2()
ResampleAudio(44100)
One instance of ConvertToYUY2(). is that where you meen "stored" version?
FredThompson
4th June 2003, 01:45
"Stored" meaning written to a file. You're not re-sizing and I am. Maybe that's where the issue is coming from. I'm set for 3-pass VBR CCE, 480x480 resize, 3500 max bitrate, 2845 average bitrate, 192 audio
My AviSynth_Script_file looks like this:
Import("C:\Working\FOXNEW~1\RESAMP~1.AVS")
LoadPlugin("C:\PROGRA~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
AVISource("C:\Working\FOXNEW~1\06.avi",False)
ConvertToYUY2()
BilinearResize(480,480)
ConvertToYUY2()
ResampleAudio(44100)
However, if I choose the frameserver option to edit as part of the encoding, it looks like this:
Import("C:\Working\FOXNEW~1\RESAMP~1.AVS")
LoadPlugin("C:\PROGRA~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
AVISource("C:\Working\FOXNEW~1\06.avi",False)
ConvertToYUY2()
BilinearResize(480,480)
The audio downsample option is NOT selected so it's obviously setting that event hough I've explicitly state the audio should remain at 48
Something is bad wrong. I wonder if DVD2SVCD is trying to "help" me by forcing the audio based on the resolution.
--
This doesn't make any sense. The install must be corrupt. IF this behavior was common it would have been found defective already.
Forseti
4th June 2003, 02:26
the "ResampleAudio(44100)" is added by DVD2SVCD (or avisynth, dont know which) because CCE 2.66 and lower won't open .avs scripts without that added (gives you an error). It doesn't actually downsample the audio, as CCE is simply encoding an .m2v file with no audio. BeSweet handles the audio conversion, and then the .m2v and .mp2 files are muxed together after all the converting is done.
As far as you having two instances of ConvertToYUY2(), I don't know what to tell you. I haven't run into this problem as of yet. So it leads me to believe that it's something in your settings. I resize as well (everyone going from DVD->SVCD has to resize) so it's not that.
FredThompson
4th June 2003, 02:41
oh, yeah, that makes sense. The double conversion is still weird and I'm in the middle of a clean re-install. Hope that takes care of it.
I noticed the problem doesn't happen on the first time a directory is used as the destination but it does on recurring use of the same destination directory.
gerti67
4th June 2003, 09:33
Hi there,
though I can't speak for dvd2svcd - I think I know what is going on here (dvd2svcd correct me if I'm wrong). ;)
The first "ConvertToYUY2()" statement in your AviSynth script gets inserted because you're trying to convert an AVI file. And as we all know that AVI files use RGB24 colorspace you have to insert a "ConvertToYUY2()" statement to your script because some filters (e.g. SimpleResize, ...) only work in YUV colorspace and also this colorspace usually is faster than RGB24 colorspace. So dvd2svcd put it in for a special reason - mainly to avoid troubles when dealing with AVI sources.
The second "ConvertToYUY2()" statement in your script was put in at the very end of your script because you're using AviSynth 2.5 instead of Avisynth 2 - and as AviSynth 2.5 uses YUV12 colorspace this last "ConvertToYUY2()" statement always gets inserted to be able to feed it to encoders that doesn't support YUV12 yet. (e.g. old CCE, TMPG, ...) And as the program logic seems to always add it at the end of your script as well as the "ResampleAudio" statement there's no need for displaying it within the AviSynth script window - just because some users will definately mess it all up then. ;)
The question is: "Is it really that much slower?" - I don't know atm - I never tested it with AVIs so it's up to you to provide us some facts. ;) But I would have thougth that all transformations after the first "ConvertToYUY2()" statement will take place also in YUY2 colorspace and so the last "ConvertToYUY2()" statement should have no or at least very little effect on the speed - though I don't know how clever AviSynth is in this case - (no offense meant sh0dan and you AviSynth Gods - in case you're reading you're doing a fantastic job). ;)
Just my thougths,
Gerti
The duplicate color space conversion will not slow things down, AVISynth will simply skip ConvertToYUY2() if the clip already is YUY2.
Wilbert
4th June 2003, 12:25
the "ResampleAudio(44100)" is added by DVD2SVCD (or avisynth, dont know which) because CCE 2.66 and lower won't open .avs scripts without that added (gives you an error). It doesn't actually downsample the audio, as CCE is simply encoding an .m2v file with no audio.
To be entirely accurate: CCE wants an audio stream. Inserting ResampleAudio(44100) (or whatever samplerate) inserts a silent audiostream to your script.
eugen
4th June 2003, 13:06
ConverToYUY2 twice - it is for sure slower. I have the same situation while trying to use Smoothdeinterlace filter (works in YUY2) as follows:
LoadPlugin("D:\dvd\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
LoadPlugin("D:\dvd\DVD2SVCD\AVISYN~1.5PL\Sdi\Sdi.DLL")
mpeg2source("d:\dvd\DVD2SVCD\Movie\DVD2AV~1.D2V")
# -= AviSynth script by FitCD v1.1.2 =-
BilinearResize(480,376,0,52,720,376)
ConvertToYUY2()
Smoothdeinterlace()
AddBorders(0,52,0,52)
Import("d:\dvd\DVD2SVCD\Movie\ResampleAudio.avs")
ResampleAudio(44100)
Every time DVD2SVCD tries to do it
LoadPlugin("D:\dvd\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
LoadPlugin("D:\dvd\DVD2SVCD\AVISYN~1.5PL\Sdi\Sdi.DLL")
mpeg2source("d:\dvd\DVD2SVCD\Movie\DVD2AV~1.D2V")
# -= AviSynth script by FitCD v1.1.2 =-
BilinearResize(480,376,0,52,720,376)
ConvertToYUY2()
Smoothdeinterlace()
AddBorders(0,52,0,52)
Import("d:\dvd\DVD2SVCD\Movie\ResampleAudio.avs")
ResampleAudio(44100)
ConvertToYUY2()
Import("d:\dvd\DVD2SVCD\Movie\ResampleAudio.avs")
ResampleAudio(44100)
There are no tools inside DVD2SVCD to avoid the second ConvertToYUY2
statement. I have managed to do manually by coping MY version of script file onto the one created by the system in the short period of time CCE267 is beeing launched.
Holomatrix
4th June 2003, 16:04
Originally posted by FredThompson
"Stored" meaning written to a file. You're not re-sizing and I am. Maybe that's where the issue is coming from. I'm set for 3-pass VBR CCE, 480x480 resize, 3500 max bitrate, 2845 average bitrate, 192 audio
I didn't realize you were converting an AVI and I am re-sizing to CVD.
I think gerti67 found you your answer though :)
gerti67
6th June 2003, 19:53
Ok guys,
I did a quick and dirty check and I can tell you that AviSynth is smart enough to internally fix such doubled up statements - there's no speed decrease with my system when adding "ConvertToYUY2()" twice or even three times.
The same applies to the ResampleAudio statement - so I really don't know why you get a speed decrease eugen - this shouldn't happen. Did you do a restart of your system and checked the speed under the exact same conditions - if not this could be a problem of the type "memory leak" resulting in your first run being faster than the second run. You might want to cross-check that perhaps.
HTH,
Gerti
eugen
10th June 2003, 10:39
First was with double statment and SLOWER. When I have found a trick to overcome that doule statement with overwriting .avs file when the system thinks it has done it by itself and CCE is being launched - so I have timegap to change .avs file. It starts to be FASTER (somehow 20%). Tomorrow I will try to repeat the experiment and will tell you, gerti67, the exact digits (in CCE267 speed).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.