Log in

View Full Version : MeGUI development


Pages : 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

Doom9
7th August 2005, 12:58
Although this sometimes means a broken encode, it is also used to signal non-fatal errors. A better error detection method is then needed.Not anymore.. a few versions back I introduced x264.exe exitcode checking. Exitcode 0 means all ok, anything below 0 means an error.. so even if the log doesn't contain anything I deem erroneous, if the exitcode is negative, the job is still marked as having an error and the queue is stopped accordingly.

berrinam
7th August 2005, 13:02
Well, that method of checking didn't pick up on the error I described earlier about there being more frames in second pass than first pass. I suppose this just becomes an x264 issue then, not a MeGUI issue.

Doom9
7th August 2005, 13:41
does x264 report anything wrt to that error, and in stdout or stderr? I really only can check for specific messages in the output and exit codes..

Siku
7th August 2005, 21:50
@Doom9

There might be a bug in the birate calculator. I tried to calculate the bitrate using storage media: DVD-5 and the bitrate is way too low. The movie's lenght is 86 minutes and MeGUI's bitrate calculator gives me bitrate of 619 kbps. See the screenshot here (http://personal.inet.fi/koti/kettunen/megui_bitratecalc.jpg). I'm using the latest version of MeGUI (0.1.8.2a).

Regards,
Siku

Doom9
7th August 2005, 22:14
That bad feeling I had in my stomach pit turned out to be correct: I was scared when I saw the length and target size, and rightfully so: the size of a DVD-5 in bytes doesn't fit a 32 bit integer. And by default, overflows are not thrown as errors but the values are silently truncated. This affects 2 out of 3 operation modes besides the calculator so there won't be an immediate fix. Considering that you should get a bitrate around 7 mbit for your parameters, I'm hoping you're doing 1080p content.. if not, I'd rethink my target size.

And by the way, and that goes for everyone, this thread is really meant for developers, you should use the other one for anything else including error reports.

berrinam
7th August 2005, 22:32
Siku's bug confirmed here. It appears to be due to the filesize in bytes being larger than 2^32 (it should probably be held as a long, not an int).

About the x264 error message mentioned earlier, according to MeGUI's log, it is this message:x264 [error]: More input frames than in the 1st pass While this error is not fatal (it encodes all the frames that the first pass encoded, then stops), it may result in largely undersized files depending on how many more frames there are in the second pass than in the first.

EDIT: Another message it produces is Assertion failed: frame >= 0 && frame < rc->num_entries, file encoder/ratecontrol.c, line 482

berrinam
7th August 2005, 22:34
Didn't see your message until after I posted

And by the way, and that goes for everyone, this thread is really meant for developers, you should use the other one for anything else including error reports.
Does that include bugfixes?

Siku
7th August 2005, 22:45
Considering that you should get a bitrate around 7 mbit for your parameters, I'm hoping you're doing 1080p content.. if not, I'd rethink my target size.

I was just playing around with that bitrate calculator. I wasn't really about to encode the video at that file size or bitrate. Just thought to help you out and report this issue...

Cheers,
Siku

Doom9
7th August 2005, 22:57
I'll add error and failed to the keyword search for errors then. But if those report an exitcode of 0, you probably need to tell aku about this as well.

Does that include bugfixes?buxfixes mean code, don't they? and code is as development as it gets.

berrinam
8th August 2005, 23:19
More cosmetics:
When rerunning and already completed job (eg if it had an error or something), the finishing time and fps columns are not blanked out as they should be, because they no longer apply when the job is being rerun. To fix, go to MeGUI.startEncoding, and find the line item.SubItems[6].Text = DateTime.Now.ToLongTimeString();Follow this by item.SubItems[7].Text = "";
item.SubItems[8].Text = "";

When a zone is set from the VideoPlayer window, it seems natural that the old zone start and zone end values should be cleared. Do you agree? If yes, then change if (zoneEnd > zoneStart)
ZoneSet(this.zoneStart, this.zoneEnd); in VideoPlayer.setZoneButton_Click to if (zoneEnd > zoneStart)
{
ZoneSet(this.zoneStart, this.zoneEnd);
this.zoneStart = -1;
this.zoneEnd = -1;
setTitleText();
}

Doom9
12th August 2005, 23:30
I've updated the sources as well. I think all currently open issues should be taken care off (safe perhaps a feedback dialog if you press abort, although I'm not sure I want to help with that stupid user error at all).. I seem to recall some mkv thing though (language related I think) but I seem unable to locate it. Am I dreaming?

berrinam
12th August 2005, 23:42
The mkv language problem is here (http://forum.doom9.org/showthread.php?p=695162#post695162)

Doom9
12th August 2005, 23:55
oh well.. no log no support, right? I have found the problem though but if he had posted his log, the fix would've made it into the current release, not the next one.

berrinam
12th August 2005, 23:55
There seems to be a problem with first-pass-filename bugfix in 2.1.9. It doesn't appear fixed in the compiled MeGUI I downloaded, but when I compiled the sources myself, it worked. Is that bugfix missing from the compiled version?

Doom9
12th August 2005, 23:58
hmm.. the attachment has 0 views, so it's kinda hard for you to have downloaded it.. I think you got the old build that I replaced few minutes after first posting.. the build time should be 00:37

berrinam
13th August 2005, 00:03
Weird... I downloaded it again and it still showed as 0 downloads.

Anyway, the problem is fixed in the new download, so I don't know what was going on, because the last download had all of the other bugfixes listed.

leowai
17th August 2005, 14:38
by the way, does anybody feel like creating a 16x16 and 32x32 icon? a "minimize to system tray" functionality would kinda need a 16x16 icon (which is then also used in the upper left corner of the app), and the 32x32 version would be used for shortcuts on your desktop.
I did the icons [32 & 16] for MeGUI. Use it if you found this is better than other ppl's... :sly:

Keep on the nice work. :thanks:

[edit]
I found red colour of "GUI" text is more sexy. Uploaded another ferrari version. :p

MeteorRain
18th August 2005, 17:08
i just change it to satisfy myself using.
if you like these changes, apply it on your src code ;)

x264ConfigurationDialog.cs
private void x264CustomQuantizer_SelectedIndexChanged(object sender, System.EventArgs e)
{
x264QuantizerFileLoadButton.Enabled = false;
// x264QuantizerMatrixFile.Text = "";
if (x264CustomQuantizer.SelectedIndex == 2) // custom
{
x264QuantizerFileLoadButton.Enabled = true;
}
showCommandLine();
} <-- no need to clear the textbox i think. when you want to switch between matrixes, it'd be a pain.


Form1.cs - UpdateGUIStatus
if (pw != null)
{
pw.IsUserAbort = false; // ensures that the window will be closed
pw.Close();
}
this.Text = "Completed - " + su.JobName + " - MeGUI 0.2.1.9";

===========================================================================

catch (Exception e)
{
logBuilder.Append("Exception when trying to update status while a job is running. Text: " + e.Message + " stacktrace: " + e.StackTrace);
this.log.Text = logBuilder.ToString();
}
this.Text = (double)((int)(su.PercentageDoneExact * 100)) / (double)100 + " % - " + su.JobName + " - MeGUI 0.2.1.9";
this.jobProgress.Value = su.PercentageDone;
<-- add status display in the main window. and btw, you should save the 'MeGUI #ver' in a constant, and append it when needed.
and as well, i delete the 'abort' button in the progresswindow LOL just to make it safer because
i can't garantee my mouse always works correctly when i move my mouse at a fast speed. (it'll lose its position, and will go to some strange place sometime orz)
Regards!

Doom9
18th August 2005, 18:03
@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.

@MeteorRain: whats the point of your first change? the index changed event is only fired if the index actually changes, and it's logical to blank out the filename if you select a mode where no custom quantizer matrix will be used. displaying a file even if no custom quantizer matrix is selected misleads people into thinking they are still using a custom quantizer matrix. there's no way you can accidentally change that dropdown, so when you do this willingly, you willingly override a configured matrix.

what is green? new line? modified line? I suppose new. I don't consider that too useful either. When encoding is complete, the progress windows will have disappeared. Plus, I know why you put the percentage first.. but that goes against what people expect from the taskbar (it's icon, program name).. what's that program with the name "54.32% - Job12-3 " ? And MeGUI might move to the tray while encoding in future versions anyway.

MeteorRain
18th August 2005, 19:15
i said i just make it more satisfying for my use.


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.


second is, when i enable the status window, there'll be 2 windows in my taskbar, cost too many space. and i can't hide the main window and only leave the status window there. so i do the opposite, show brief status on the title, and close the status window.

if one is familar with MeGUI, he'll always know what does "54.32% - Job12-3 " mean in his taskbar. i just make it behaviors like VDM.


i post these codes just becuz i (imho) think they bring convenient to ppl. use or not depends on you.

Doom9
18th August 2005, 20:00
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?

leowai
19th August 2005, 03:46
@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. :D
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. :)

MeteorRain
19th August 2005, 04:34
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

berrinam
19th August 2005, 13:23
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 else if (containerFormat.SelectedIndex == 2) // mp4 in OneClickWindow.projectCreationFinished to 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
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:
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:
private int outputSARX;
private int outputSARY;
The suggestResolution call in OneClickWindow.openVideo needs to be changed to:
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 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: 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: // 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 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): /// <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: private int sarX, sarY; and /// <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: sarX = -1;
sarY = -1;JobUtil.generateMuxJob gains two input variables, to get the following prototype: 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: 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: 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 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: 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
19th August 2005, 13:39
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 else
videoOutput += ".mkv"; to else
videoOutput += ".mp4";

Doom9
19th August 2005, 19:27
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.

-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?

-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?

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?

berrinam
19th August 2005, 21:36
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.

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"

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.

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.

Doom9
19th August 2005, 22:20
if you have a choice between mp3 and aac, you would be stupid to go with mp3.Not everybody has nero...
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.

Doom9
19th August 2005, 23:40
I've upped the latest sources.

MeteorRain
21st August 2005, 08:52
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 :o

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 :rolleyes:

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

regards!

Doom9
21st August 2005, 13:25
it gives ".1%" if it's 0.10%who cares? I don't.
and btw, add "-" between the itemsIt 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.

MeteorRain
21st August 2005, 16:01
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

Doom9
21st August 2005, 20:30
@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.

yami
22nd August 2005, 02:34
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

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 .

hellfred
22nd August 2005, 07:45
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

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

Doom9
29th August 2005, 12:54
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.

Sharktooth
29th August 2005, 16:15
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.

Doom9
29th August 2005, 17:23
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.

berrinam
30th August 2005, 07:22
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 videoSettings.SARX = outputSARX;
videoSettings.SARY = outputSARY; just after the call to openVideo (it's close to the end).

Add to MuxSettings private int sarX, sarY; and sarX = -1;
sarY = -1; in the constructor and the following properties: /// <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 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: 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: 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: 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): 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: 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.

MeteorRain
30th August 2005, 10:30
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

:o:o

berrinam
30th August 2005, 11:22
Same for me -- I built my changes on 2.2.1 sources.

Doom9
30th August 2005, 11:48
it's 0.2.2.3a ;)

berrinam
1st September 2005, 12:46
@Doom9: Just wondering whether you saw my above patch using your suggestion for AR signalling.

Doom9
1st September 2005, 17:15
yup I saw it.. but I'm swamped at work so I haven't really gotten around to reviewing it. Sorry :(

berrinam
1st September 2005, 21:02
No problem... I just thought it might have been lost in the thread.

Marsu42
4th September 2005, 01:36
Your GUI is very promising, it might save much time that otherwise would be spent with click-and-wait procedures. Now, I finally decided to register @Doom9 to put up my wishlist :->. I am btw aware that this is not as helpful as contributing source code...

And while I am at it, maybe you could put a list of known bugs and upcoming features into the distribution archive to prevent redundant reports (the forum posts are already too vast).

Anyway, I'm posting a list of showstoppers that are the reason for me not using MeGUI (0.2.2.3a) yet, things that a manual encode using an oag machine and virtualdub combination is able to do:

audio (like in oag machine):
1.1. 44.1 kHz downsampling via ssrc (besweet -shibatch(--rate 44100) switch)
1.2. ac3 dynamic compression strength selection (azid -c light/normal/heavy switch)

video:
2.1. xvid custom matrices (like in xvid vfw gui)
2.2. import chapters as zones (like in chaptergrabber/kfe)
2.3 set keyframe on chapter start (like chaptergrabber/kfe, statsreader)
2.4. auto-set intro and credits as zones w/o keyframe
2.5. remove closed gop for xvid 1.1 (not really necessary since it's likely to be ignored anyway)

queue:
3.1. unique names for 2/3-pass stats files for later re-encode w/ other bitrate or curve (like in gordian knot)
3.2. unique names for besweet log files
3.3. bug: when manually encoding to mkv w/ xvid 1st pass only, a mux job is created that breaks the queue
3.4. bug: intermediate xvid avi is not deleted after 2nd pass muxing step

muxing:
4.1. import of vobsub subtitles (sub/idx) in addition to srt (like mkvmerge >=1.5.0)
4.2. option to create intermediate avi/mp4 on/in another temp partition/directory for muxing speed

tuning:
5.1. option to delete incomplete output on abort and skip creation if it already exists
5.2. possibility to re-schedule queue tasks on abort (like virtualdub)
5.3. finer grained task priority setting, esp. "lower than normal" (like virtualdub)

clarifications:
6.1. audio->config: "increase volume automatically" seems to mean normalization, might be mixed up w/ compression
6.2. settings->automated encoding: "overwrite" and "keep" seem to be mutually exclusive?
6.3. settings->automated encoding: add "max." word to "passes", since xvid only supports 2

berrinam
4th September 2005, 09:56
@Marsu42: Some useful points there, thank you, and welcome to this forum. However, I suspect (it's Doom9's decision, of course) that comments like these would be wanted on the main MeGUI thread, as opposed to here.

And while I am at it, maybe you could put a list of known bugs and upcoming features into the distribution archive to prevent redundant reports (the forum posts are already too vast).This is probably not useful/feasible/possible, because at the moment, any bugs found are fixed by the next release. What's the point of the upcoming features? If you are that eager, you could just read the last few posts of this thread, or just wait until they arrive.

Anyway, I'm posting a list of showstoppers that are the reason for me not using MeGUI (0.2.2.3a) yet, things that a manual encode using an oag machine and virtualdub combination is able to do:Of course, MeGUI will probably never be able to match the features of every individual program out there, simply because there are too many programs, and the GUI is designed to be easy to use, and not crowd the user with settings.

2.4. auto-set intro and credits as zones w/o keyframeI believe this is already being done, but hidden from the user.

3.4. bug: intermediate xvid avi is not deleted after 2nd pass muxing stepNot a bug. What happens if the user wants to keep it? Perhaps it should be up to the user what the program does, a la GK, perhaps not.

4.2. option to create intermediate avi/mp4 on/in another temp partition/directory for muxing speedIs this actually possible with mp4box, mkvmerge and/or mencoder?

5.2. possibility to re-schedule queue tasks on abort (like virtualdub)I believe this is already done in MeGUI (you can set it back to "waiting" or "postponed" by double-clicking on the job)

6.2. settings->automated encoding: "overwrite" and "keep" seem to be mutually exclusive?Not true; the first option is to overwrite the stats file, whereas the second option is about keeping the video output.

6.3. settings->automated encoding: add "max." word to "passes", since xvid only supports 2That's also ambiguous, because that could imply that the program spuriously decides not to do a third pass.

The rest of the points are good, thanks for the feedback. Of course, this being a free program, it may take a while for them to be implemented, or they may be decided against, but the feedback is welcome never-the-less.

@Doom9: I still can't find the sources.

Doom9
4th September 2005, 12:02
1.1. 44.1 kHz downsampling via ssrc (besweet -shibatch(--rate 44100) switch)over my dead body. No program of mine will ever allow you to do that. This will only change if there's a specific hardware device I'm targeting which cannot handle 48 KHz.

1.2. ac3 dynamic compression strength selection (azid -c light/normal/heavy switch)And what's next? There's a long list of features BeSweet still can offer. Hardwar players use normal DRC so it's the reasonable setting.

I guess I could stop here because you call all these showstoppers (I call them minor issues at best, MeGUI works fine for my purposes and apparently a lot of other people).

2.1. xvid custom matrices (like in xvid vfw gui)It is supported, sorta. It's not my fault that mencoder cannot handle its own syntax on the windows platform (it uses the double dot as option separator, and to specify a custom quantizer matrix path, you just need a double dot for the drive letter). However, that problem will go away once I incorporate encraw as xvid encoder.

2.2. import chapters as zones (like in chaptergrabber/kfe)I'm pretty sure you're completely oblivious to the fact that as it is now, no of the 4 supported codecs in MeGUI can start a zone with an I-frame. So what is the point? Personally, even when it's possibly, I find it a useless thing to do. Both standalone players as well as DirectShow filters can jump to any point in the video without requiring it to be a keyframe, so it's better to let the SCD do its job rather than force keyframes upon it. As chapterpoints tend to be at cut points anyway, chances are good your chapters will start with a keyframe anyway. Only encraw will offer zones that start with an I-frame, at which point the zone feature set of XviD will be revisited.

2.5. remove closed gop for xvid 1.1 (not really necessary since it's likely to be ignored anyway)You can THAT a showstopper? Jesus am I glad you're not my boss, I'd quit in an instant, and not so far in the future the company would go bankrupt - we deal with problems a million times major than this every day, and have to find our ways around them in a way. This is cosmetics, the thing every self-respecting programmer hates (takes time and doesn't change functionality at all), and if it has absolutely no effect on encoding, it really doesn't matter whatsoever.

3.1. unique names for 2/3-pass stats files for later re-encode w/ other bitrate or curve (like in gordian knot)This is already possible. You can configure the stats file for each video job, plus there's the option "overwrite stats file in 3rd pass".. uncheck it and your second and third pass logfile will have different names.

4.1. import of vobsub subtitles (sub/idx) in addition to srt (like mkvmerge >=1.5.0)If you can give me the exact mkvmerge commandline requires for a .sub/.idx set, I will add it.

4.2. option to create intermediate avi/mp4 on/in another temp partition/directory for muxing speed
This is already possible in MeGUI as it is:

In the one click encoder, you can use the working directory to place the encoded output where you want, and use the output to specify yet another drive, so it's all possible. In manual, and auto-mode, the same applies. Let's take auto-mode first:
You set the encoded output path to another place than the default you get when loading the video/audio source. That takes care of saving the encoded video/audio at another place than the source.
Then when you press auto-encode, you can place the muxed output in a different directory, so effectively you can have the input in a directory/drive different from the encoder output and that different from the muxed output.

Then the manual mode: here again we have the same input/output configuration like in the auto-mode, so that only muxing remains. For complexity reasons, and the fact that most people have one harddisk, I don't think adding a direct configuration for the muxed output is a good idea. However, you can still configure it. Just go to the queue tab, click on the mux job you want to modify, then press load. This will bring up the muxing window, and you can now change the destination of the muxed output. And with that, we've taken care of every mode MeGUI offers.

5.3. finer grained task priority setting, esp. "lower than normal" (like virtualdub)Did I say over my dead body yet? Low is basically all you need, anything else is useless. Even normal, just makes your life miserable when you want to use the PC, and if you're not using it and have other programs that eat your CPU time away, you might want to reconsider your setup and not clamor for things in encoding program to fix the shortcomings of your setup.

6.1. audio->config: "increase volume automatically" seems to mean normalization, might be mixed up w/ compressionI don't follow. That switch triggers -ota(-g max), which according to the manual does the following: example : "-g max" will apply the highest gain level that still does not distort the original signalSince not everybody understands normalization, I picked "increase volume" for the checkbox description.

6.3. settings->automated encoding: add "max." word to "passes", since xvid only supports 2cosmetics again.

@Doom9: I still can't find the sources.Wasn't it's 0.2.2.3a :) subtle enough? All you needed to do is add an a to the link and it would work. I've changed it now.

And while I am at it, maybe you could put a list of known bugs and upcoming features into the distribution archive to prevent redundant reportsPlanned features are listed and discussed in this thread (post2 and the end of the thread for the discussion), but as for known bugs, I have no time to keep such a list, plus they are usually fixed within 24h unless it's something cosmetical (by your standards it would still be a showstopper but I have other standards.. if it works, if you can work around a problem, it's no major deal and can wait a few days).

berrinam
4th September 2005, 12:44
Wasn't it's 0.2.2.3a subtle enough? All you needed to do is add an a to the link and it would work. I've changed it now.

I tried that, except you changed the - between src and 0 into a .
Thanks for the new link.

Doom9
4th September 2005, 20:05
I implemented the AR signalling.. just one thing:
else
{
SARX = 1;
SARY = 1;
return scriptVerticalResolution;
}
in suggestResolution... I think that should be 0 instead of 1 as > 0 = AR signalling is used (that's when you apply the AR in the mkvmerge commandline, and that's how I defined it in VideoCodecSettings for each codec). Now I'm off to give it a spin.

@edit: some concerns: should't this functionality only be offered for no resizing? also, have you checked if XviD's custom AR signalling does work in encraw or the VfW?