Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 Encoder GUIs

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th August 2005, 20:00   #321  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
Quote:
first is, when i tests custom matrix, i have to save the matrix path+filename in notepad, and keep copying and pasting when i want to switch between custom and default one. or alternatively, you can just hide the textbox, or disable it. but plz don't clean it, becuz it's useful in future encoding.
I don't get it. copy and paste what?
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 19th August 2005, 03:46   #322  |  Link
leowai
Registered User
 
Join Date: May 2005
Posts: 184
Quote:
Originally Posted by Doom9
@leowai: thanks, but I have a real hard time reading that.. I think for icons it's better to just use graphical stuff and no text, which, even at 32x32 is almost impossible to read unless you turn the background white.
Welcome.
True, because of the transparent background of the texts. However, text based icon is the first (and the only) ideal come into my mind.

Graphical icons... If only if I come across some new ideal for it, I'll make another icon for MeGUI again.
leowai is offline   Reply With Quote
Old 19th August 2005, 04:34   #323  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
Quote:
Originally Posted by Doom9
I don't get it. copy and paste what?
the matrix file path and filename.

i'm just testing the difference between flat and some custom matrix so i need to switch between them. that's why i have to keep c&ping.

winxp saves path for opendialog, and thus i have to jump from the path of video and the path of matrix to load the avs and custom matrix. that made me painful
MeteorRain is offline   Reply With Quote
Old 19th August 2005, 13:23   #324  |  Link
berrinam
Registered User
 
berrinam's Avatar
 
Join Date: Apr 2005
Posts: 1,740
I have made and listed the changes required to signal the AR instead of resizing in AviSynth for it (discussed briefly in the MeGUI thread). They are quite long, listed here:
Firstly, there is a bugfix:
OneClickWindow crashed if using matroska but encoding audio. To fix, change
Code:
				else if (containerFormat.SelectedIndex == 2) // mp4
in OneClickWindow.projectCreationFinished to
Code:
				else if (containerFormat.SelectedIndex == 1 ||
					containerFormat.SelectedIndex == 2) // mkv or mp4
Now the AR signalling:
To enable proper AR signalling in all cases I am aware of, it is done it two ways:
Signal via the codec if not Snow
Signal via the container if matroska

If the container is not matroska and the codec is snow, then signalling is not possible, and there is an error message.


changes:
VideoUtil.suggestResolution method is changed to
Code:
		public static int suggestResolution(double readerHeight, double readerWidth, double customDAR, CropValues cropping, int horizontalResolution,
			bool signalAR, out int SARX, out int SARY)
		{										
			double sourceHorizontalResolution = readerHeight * customDAR - (double)cropping.left -(double)cropping.right;
			double sourceVerticalResolution = readerHeight - (double)cropping.top - (double)cropping.bottom;
			double realAspectRatio = sourceHorizontalResolution / sourceVerticalResolution; // the real aspect ratio of the video
			realAspectRatio = getAspectRatio(realAspectRatio);

			double resizedVerticalResolution = (double)horizontalResolution / realAspectRatio;

			int scriptVerticalResolution = 0;
			int temp = (int)(resizedVerticalResolution / (double)16);
			int upper = (temp+1) * 16;
			int lower = temp * 16;
			if ((double)upper - resizedVerticalResolution > resizedVerticalResolution - (double)lower) // Which one is closer to the resolution we should have
				scriptVerticalResolution = lower;
			else
				scriptVerticalResolution = upper;
			if (signalAR)
			{
				int displayVerticalResolution = (int)Math.Round(resizedVerticalResolution);

				sourceVerticalResolution = readerHeight - cropping.top - cropping.bottom;
				temp = (int)(sourceVerticalResolution / (double)16);
				upper = (temp+1) * 16;
				lower = temp * 16;
				if ((double)upper - resizedVerticalResolution > resizedVerticalResolution - (double)lower) // Which one is closer to the resolution we should have
					scriptVerticalResolution = lower;
				else
					scriptVerticalResolution = upper;
				SARX = horizontalResolution;
				SARY = displayVerticalResolution;
				
				return scriptVerticalResolution;
			}
			else
			{
				SARX = 1;
				SARY = 1;
				return scriptVerticalResolution;
			}
		}
OneClickWindow has a checkbox added (called signalAR). I put it next to the AR textbox, but that obviously is not important. It has a checkedChanged event as follows:
Code:
		private void signalAR_CheckedChanged(object sender, System.EventArgs e)
		{
			if (signalAR.Checked && videoCodec.SelectedIndex == 2 && containerFormat.SelectedIndex != 1) 
			{
				MessageBox.Show("Can't signal AR with Snow except with Matroska container", "AR signalling not possible", MessageBoxButtons.OK, MessageBoxIcon.Error);
				signalAR.Checked = false;
			}
		}
OneClickWindow has the following new variables:
Code:
		private int outputSARX;
		private int outputSARY;
The suggestResolution call in OneClickWindow.openVideo needs to be changed to:
Code:
			int scriptVerticalResolution = VideoUtil.suggestResolution(reader.Height, reader.Width, Double.Parse(customDAR.Text), AutoCropValues, (int)horizontalResolution.Value, signalAR.Checked, out outputSARX, out outputSARY);
The generateJobSeries call at the end of OneClickWindow.setUpJobs needs to be changed to
Code:
			vUtil.generateJobSeries(videoInput, videoOutput, muxedOutput, videoSettings, 
				aStreams, audio, subtitles, chapters, desiredSize, splitSize, containerOverhead, 
				type, outputSARX, outputSARY, signalAR.Checked);

VideoUtil.generateJobSeries gets three new variables passed to it, so the prototype becomes:
Code:
		public void generateJobSeries(string videoInput, string videoOutput, string muxedOutput, VideoCodecSettings videoSettings, AudioStream[] aStreams,
			SubStream[] audio, SubStream[] subtitles, string chapters, long desiredSize, int splitSize, double containerOverhead, MUXTYPE muxtype,
			int SARX, int SARY, bool signalAR)
This code is added in the function just after the encoding mode (automated 2pass) is set:
Code:
			// Signal the AR
			if (signalAR)
				applyAspectRatio(SARX, SARY, videoSettings);
(The function this references will be given later). The muxjob generation within this function (inside the if (doMux) block) is changed from [code] mjob = jobUtil.generateMuxJob(vjobs[vjobs.Length - 1], audio, subtitles, chapters, muxtype,
muxedOutput);[code] to
Code:
					mjob = jobUtil.generateMuxJob(vjobs[vjobs.Length - 1], audio, subtitles, chapters, muxtype,
						SARX, SARY, muxedOutput);
VideoUtil gets another function (referenced in the above code):
Code:
		/// <summary>
		/// applies the given fractional aspect ratio to the video settings if possible
		/// </summary>
		/// <param name="SARX">the x part of the AR</param>
		/// <param name="SARY">the y part of the AR</param>
		/// <param name="settings">the video settings to be modified</param>
		/// <returns>true if succeeded, false if failed</returns>
		public static void applyAspectRatio(int SARX, int SARY, VideoCodecSettings settings)
		{
			// Snow is ignored, because it does not support AR signalling
			
			if (settings is lavcSettings)
			{
				lavcSettings temp = (lavcSettings) settings;
				temp.SARX = SARX;
				temp.SARY = SARY;
			} 
			else if (settings is x264Settings)
			{
				x264Settings temp = (x264Settings) settings;
				temp.SARX = SARX;
				temp.SARY = SARY;
			} 
			else if (settings is xvidSettings)
			{
				while (SARX > 255 || SARY > 255) // XviD needs SARX <= 255 and SARY <= 255
				{
					SARX = SARX / 2;
					SARY = SARY / 2;
				}
				xvidSettings temp = (xvidSettings) settings;
				temp.SARX = SARX;
				temp.SARY = SARY;
				temp.PAR = 5;
			}
		}
There need to be some changes made to add AR to the muxing info for matroska. MuxSettings gains two variables and two properties:
Code:
		private int sarX, sarY;
and
Code:
		/// <summary>
		/// SARX (only for Matroska)
		/// </summary>
		public int SARX
		{
			get {return sarX;}
			set {sarX = value;}
		}
		/// <summary>
		/// SARY (only for Matroska)
		/// </summary>
		public int SARY
		{
			get {return sarY;}
			set {sarY = value;}
		}
and inside the constructor:
Code:
			sarX = -1;
			sarY = -1;
JobUtil.generateMuxJob gains two input variables, to get the following prototype:
Code:
		public MuxJob generateMuxJob(VideoJob vjob, SubStream[] audioStreams, SubStream[] subtitleStreams, 
			string chapterFile, MUXTYPE type, int SARX, int SARY, string output)
It gains the following two lines of code:
Code:
			job.Settings.SARX = SARX;
			job.Settings.SARY = SARY;
They can basically go anywhere before the commandline is generated. The first line of CommandLineGenerator.generateMkvmergeCommandline becomes the following four lines:
Code:
			string retval = "\"" + mkvmergePath +  "\" -o \"" + output + "\" ";
			if (settings.SARX > 0 && settings.SARY > 0)
				retval += "--aspect-ratio 0:" + settings.SARX + "/" + settings.SARY + " ";
			retval += "-A -S \"" + input + "\" ";
The call to generateJobSeries at the end of AutoEncodeWindow.queueButton_Click becomes
Code:
				vUtil.generateJobSeries(videoInput, videoOutput, muxedOutput.Text, this.videoSettings.clone(), aStreams, audio, subtitles, chapters, desiredSize, splitSize, 
					(double)containerOverhead.Value, type, -1, -1, false);
AviSynthWindow.suggestResolution_CheckedChanged needs to have the call to suggestResolution replaced by the following three lines:
Code:
				int sarx, sary; // Not needed for AviSynthWindow resizing
				int scriptVerticalResolution = VideoUtil.suggestResolution(reader.Height, reader.Width, Double.Parse(customDAR.Text), 
					cropping, (int)horizontalResolution.Value, false, out sarx, out sary);
When attempting to compile, there should now be four (I think, maybe I miscounted) compile-time errors which are due to the changed JobUtil.generateMuxJob prototype. To fix these, add the parameters -1, -1 just before the muxed output (the last) parameter.

After all this work, there should now be working AR signalling. A lot of little changes, huh? Upon testing, this seems to work with each configuration except for:
-Snow not in Matroska (it doesn't have any way to signal AR)
-XviD not in Matroska (the mencoder XviD AR signaling seems to be broken for custom PARs)
berrinam is offline   Reply With Quote
Old 19th August 2005, 13:39   #325  |  Link
berrinam
Registered User
 
berrinam's Avatar
 
Join Date: Apr 2005
Posts: 1,740
Just testing again with all the changes listed above, and x264 in mkv seems to be temporarily broken. I have found the problem, and will have solved it in a moment (it is to do with x264.exe's problems with signalling sar in mkv output. I plan to make mkv output go through x264.exe's mp4, and then muxed into mkv).

EDIT: Here is the fix: In OneClickWindow.setUpJobs, inside the MKV if block, change
Code:
				else
					videoOutput += ".mkv";
to
Code:
				else
					videoOutput += ".mp4";

Last edited by berrinam; 19th August 2005 at 13:45.
berrinam is offline   Reply With Quote
Old 19th August 2005, 19:27   #326  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
about the fix: this effectively enforces AAC audio for MKV output, does it not? The output type should depend on the profile selected (there may or may not be Vorbis support one day). Until recently, the autoencode window would not properly support all types for matroska either but I changed that so any configured mp3 and aac stream should be taken into account.

Quote:
-XviD not in Matroska (the mencoder XviD AR signaling seems to be broken for custom PARs)
Can't we work with the profiles XviD offers?

Quote:
-Snow not in Matroska (it doesn't have any way to signal AR)
I don't quite get that.. you're adding the aspect ratio when muxing, so why can't it be applied ?

And for those codecs that support signalling on stream level: wouldn't it be better to rely on that?

Quote:
VideoUtil.generateJobSeries gets three new variables passed to it, so the prototype becomes:
Why is that necessary if we can signal on a video stream level? you could apply the signalling to the VideoCodecSettings object prior to calling generateJobSeries, could you not?
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 19th August 2005, 21:36   #327  |  Link
berrinam
Registered User
 
berrinam's Avatar
 
Join Date: Apr 2005
Posts: 1,740
Quote:
Originally Posted by Doom9
Can't we work with the profiles XviD offers?
I suppose so. I'm not sure what the differences between PAL 16:9 and NTSC 16:9 are, though.

Quote:
I don't quite get that.. you're adding the aspect ratio when muxing, so why can't it be applied ?
That was a typo; I meant "snow when not in matroska"

Quote:
And for those codecs that support signalling on stream level: wouldn't it be better to rely on that?
I do that as well, however I found that when put into the matroska contaienr, the aspect ratio would be overridden by matroska's default (square pixels) unless it was explicitly specified. I do both just to be more sure that it works.

Quote:
about the fix: this effectively enforces AAC audio for MKV output, does it not?
Yes it does. I was going on the reasoning that, like MP4, if you have a choice between mp3 and aac, you would be stupid to go with mp3.

Last edited by berrinam; 19th August 2005 at 21:43.
berrinam is offline   Reply With Quote
Old 19th August 2005, 22:20   #328  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
Quote:
if you have a choice between mp3 and aac, you would be stupid to go with mp3.
Not everybody has nero...
Quote:
the aspect ratio would be overridden by matroska's default
Is there no way to change that? I'd rather not expand pars (a dying concept by the way.. HD doesn't require the anamorphic trick) all over the place.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 19th August 2005, 23:40   #329  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
I've upped the latest sources.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 21st August 2005, 08:52   #330  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
about the percentage display on the title:
>> string percentage = su.PercentageDoneExact.ToString("##.##");
the result displays ugly i think....
it gives ".1%" if it's 0.10%
and btw, add "-" between the items maybe better, like "MeGUI Version - Jobx - x.xx%" instead of "MeGUI jobxx .xx%"...
yeah, you forgot to add the version here

and i still suggest the title being "x.xx% - Jobx - MeGUI Ver", becuz more ppl have more interests on the progress, instead of the name of the program

i use:
Code:
	      this.Text = (double)((int)(su.PercentageDoneExact * 100)) / (double)100 + " % - " + su.JobName + " - MeGUI " + version;
regards!

Last edited by MeteorRain; 21st August 2005 at 09:03.
MeteorRain is offline   Reply With Quote
Old 21st August 2005, 13:25   #331  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
Quote:
it gives ".1%" if it's 0.10%
who cares? I don't.
Quote:
and btw, add "-" between the items
It eats up more space. The way it is now, unless you have so many items in the taskbar that the items get resized, you can just see MeGUI, job name and completion percentage. I left the version number because you cannot see it and quite frankly it's more than sufficient to see it while you're not encoding. And if the items are resized, then the program name is the last thing to go so you always know which program is running.. this is way more important than how far it is along.. if you want to know that and the item is so small that the percentage is cut off, you can always hover over it with the mouse.

And by the way, a double has a considerable number of digits behind the dot.. so your code ends up in 10.23512453536425356323434 - jobX - MeGUI version.. not pretty.

Either way you can argue all you want here, I think you should be grateful that I did anything at all instead of further complaining and I will not change this, I've gone through two revisions and I like it the way it is now.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 21st August 2005, 16:01   #332  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
OK, you go ahead
but, the code written above will never cause such things like "10.23512453536425356323434". i think you missed the "(int)" in the code XD

thanks!
MeteorRain
MeteorRain is offline   Reply With Quote
Old 21st August 2005, 20:30   #333  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
@berrinam: here's an idea I've been having about the whole custom AR thing: we have sarx/sary in VideoCodecSettings for every codec. 3 out of 4 codecs support stream level signalization, but there's nothing preventing us from using these flags for snow as well. That done, JobUtil.generateMuxJob could have a look at the sar settings of the VideoCodecSettings object it gets as an argument, and if a custom AR is set, set it for the mux job. That way, no new variables have to be added anywhere, and method calls can remain the same. The only place where variables would have to be added is the MuxJob, and those could be reused if the muxer ever gets AR signalling capability.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 22nd August 2005, 02:34   #334  |  Link
yami
Registered User
 
Join Date: Aug 2003
Posts: 17
hi, i'm ready to rip dvd to x264
when i use pass=1 , its ok.

but when i change to pass=2
i got this
Code:
avis [info]: 720x480 @ 29.97 fps (124510 frames)
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
mp4 [info]: initial delay 100 (scale 2997)
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
Assertion failed: frame >= 0 && frame < rc->num_entries, file encoder/ratecontro
l.c, line 482

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

other parameter "--bitrate 1024 --stats "2pass.log" --bframes 3 --analyse p8x8,b8x8,i4x4 --qpstep 1 --progress "

is it movie's problem or x264 bug ?

thx u .
yami is offline   Reply With Quote
Old 22nd August 2005, 07:45   #335  |  Link
hellfred
FFmpeg fan
 
Join Date: Dec 2003
Location: Germany
Posts: 427
Quote:
Originally Posted by yami
hi, i'm ready to rip dvd to x264
when i use pass=1 , its ok.

but when i change to pass=2
i got this
Code:
avis [info]: 720x480 @ 29.97 fps (124510 frames)
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
mp4 [info]: initial delay 100 (scale 2997)
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
x264 [error]: More input frames than in the 1st pass
Assertion failed: frame >= 0 && frame < rc->num_entries, file encoder/ratecontro
l.c, line 482

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

other parameter "--bitrate 1024 --stats "2pass.log" --bframes 3 --analyse p8x8,b8x8,i4x4 --qpstep 1 --progress "

is it movie's problem or x264 bug ?

thx u .
It means, that the source of the second passs contains more frames than frames have been analysed in first pass. Check the stats file from first pass, look for the frame count, compare it to the number of frames, and redo the first pass, untill it has sufficient frames in the stats file.

Hellfred
hellfred is offline   Reply With Quote
Old 29th August 2005, 12:54   #336  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
I think I figured out a way to get commandline compilation working again but I need some time to test it. compilation won't be a one liner anymore but since I'll provide batch files that won't matter.

@berrinam: any comments on my AR suggestions?

P.S. I've upped the latest sources.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 29th August 2005, 16:15   #337  |  Link
Sharktooth
Mr. Sandman
 
Sharktooth's Avatar
 
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
What about setting up a SVN repository for megui source on doom9.org? Is it possible? It would be much easier (at least for me) to help or contribute.
Sharktooth is offline   Reply With Quote
Old 29th August 2005, 17:23   #338  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
I wouldn't even know how.. and considering there's mainly two guys working on this, patches work out just fine and I won't have to bother checking in and out all the time (I often develop offline with no Internet access (Internet via cellphone is both too expensive and too slow), so I'd check out everything anyway and keep it checked out until the next version.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 30th August 2005, 07:22   #339  |  Link
berrinam
Registered User
 
berrinam's Avatar
 
Join Date: Apr 2005
Posts: 1,740
I had done the signalling bit the way you suggested a few days ago, and it is so much easier. I had been stuck on the XviD bit for a while, and I have now written it, thanks to SeeMoreDigital's guide. I kept the XviD rounding bit separate, so that you can apply it without applying the XviD bit, because I'm not convinced it is the best way to handle XviD. However, it seems to work, and with Matroska, there don't seem to be problems with any of the codecs. Enough introduction, here are the changes:

The first four changes I mentioned before stay the same (the ones about suggestResolution and its calls, up to and including the suggestresolution call in OneClickWindow).

in OneClickWindow.setUpJobs, add
Code:
			videoSettings.SARX = outputSARX;
			videoSettings.SARY = outputSARY;
just after the call to openVideo (it's close to the end).

Add to MuxSettings
Code:
		private int sarX, sarY;
and
Code:
			sarX = -1;
			sarY = -1;
in the constructor and the following properties:
Code:
		/// <summary>
		/// The SARX value to be used for muxing (-1 means it isn't used)
		/// </summary>
		public int SARX
		{
			get {return sarX;}
			set {sarX = value;}
		}
		/// <summary>
		/// The SARY value to be used for muxing (-1 means it isn't used)
		/// </summary>
		public int SARY
		{
			get {return sarY;}
			set {sarY = value;}
		}
In jobUtil.generateMuxJob, add
Code:
			job.Settings.SARX = vjob.Settings.SARX;
			job.Settings.SARY = vjob.Settings.SARY;
(obviously before the call to generateCommandline).
CommandlineGenerator.generateMkvmergeCommandline should be changed in an identical way to my previous post, ie changing the first line into the following four:
Code:
			string retval = "\"" + mkvmergePath +  "\" -o \"" + output + "\" ";
			if (settings.SARX > 0 && settings.SARY > 0)
				retval += "--aspect-ratio 0:" + settings.SARX + "/" + settings.SARY + " ";
			retval += "-A -S \"" + input + "\" ";
AViSynthWindow has the suggestResolutionWindow call in suggestResolution_CheckedChanged replaced, in an identical way to last time: replace the old call with these three lines:
Code:
				int sarx, sary; // Not needed for AviSynthWindow resizing
				int scriptVerticalResolution = VideoUtil.suggestResolution(reader.Height, reader.Width, Double.Parse(customDAR.Text), 
					cropping, (int)horizontalResolution.Value, false, out sarx, out sary);
This should work fine except for XviD. As I mentioned earlier, XviD doesn't seem to work on custom PARs, so a rounding function needs to be implemented. This can be done (I'm not sure that this is the best way, but it seems to work) by the following: Add the following method to OneClickWindow:
Code:
		private int roundPAR()
		{
			double par = (double)outputSARX * (double)height / (double)width / (double)outputSARY;
			double[] pars = {1, 1.090909, 1.454545, 0.090909, 1.212121};
			double minDist = 1000;
			int closestIndex = 0;
			for (int i = 0; i < pars.Length; i++)
			{
				double first = Math.Max(par, pars[i]);
				double second = Math.Min(par, pars[i]);
				double dist = first - second;
				if (dist < minDist)
				{
					minDist = dist;
					closestIndex = i;
				}
			}
			return closestIndex;
		}
Add the following two lines to OneClickWindow.setUpJobs after those we added earlier (the ones after the call to openVideo):
Code:
			if (videoSettings is xvidSettings && outputSARX > 0 && outputSARY > 0)
				((xvidSettings)videoSettings).PAR = roundPAR();
Add the private ints width and height to OneClickWindow, and initialize them in the openVideo method after the call to suggestResolution like this:
Code:
			this.width = (int) horizontalResolution.Value;
			this.height = scriptVerticalResolution;
This takes the resolution and rounds it to one of the 4 custom ones for XviD. It may cause some aspect distortions, but everything should be fine when using matroska.
berrinam is offline   Reply With Quote
Old 30th August 2005, 10:30   #340  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
Not Found

The requested URL /MeGUI-src-0.2.2.3.zip was not found on this server.
Apache/2.0.54 (Debian GNU/Linux) mod_fastcgi/2.4.2 PHP/4.3.10-16 Server at forum.doom9.org Port 80

MeteorRain is offline   Reply With Quote
Reply

Tags
development, megui, not a help thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.