<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>sda capture blog</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/" />
<modified>2009-04-06T00:58:31Z</modified>
<tagline>visit sda for all the video game world records!my amazon.com wishlist!--&gt;</tagline>
<id>tag:nate.metroid2002.com,2009:/blog//2</id>
<generator url="http://www.movabletype.org/" version="4.25">Movable Type</generator>
<copyright>Copyright (c) 2009, njahnke</copyright>

<entry>
<title>ds ii</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2009/04/ds_ii.html" />
<modified>2009-04-06T00:58:31Z</modified>
<issued>2009-04-06T00:11:46Z</issued>
<id>tag:nate.metroid2002.com,2009:/blog//2.107</id>
<created>2009-04-06T00:11:46Z</created>
<summary type="text/plain">it&apos;s been almost eighteen months since i last processed a ds run, and i&apos;ve learned a lot in that time. i knew that if dsgamer or anyone else submitted a new run, i&apos;d do things differently from last time. well,...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>it's been almost eighteen months since <a href="http://nate.metroid2002.com/blog/archives/2007/10/diy_ds.html">i last processed a ds run</a>, and i've learned a lot in that time. i knew that if dsgamer or anyone else submitted a new run, i'd do things differently from last time.</p>

<p>well, dsgamer submitted not only an improvement on his any percent run of prime hunters, but a new 100% run, as well. on top of that, greenalink did a run of mario 64 ds. when all three runs were accepted by verifiers, i knew it was "time to get serious" (as mega man would say) about processing ds footage.</p>

<p>perl has become my new best friend, and i knew it had integration with imagemagick, gd, etc. a few google searches later, i had decided on using imagemagick ("perlmagick"), since it came with a well-tested autocrop function.</p>

<p>originally i was going to try to determine the z-distortion (i don't know the proper term) of the ds screen(s) and correct for that (basically if the top of the screen is further away from the camera than the bottom), but the only implementation i found of that functionality i couldn't get working with any of my test footage (it never changed anything), so i decided to put that off until next time. i felt like i had enough on my plate with making sure the autocrop threshold was correct all the time.</p>

<p>basically, i set a default threshold and try to autocrop the current frame. if the autocrop succeeds, then i note how much was cropped and move on to the next frame. if it doesn't succeed, then i gradually turn up the threshold until it does succeed. if it never succeeds, i don't save the crop data. if it succeeds but it's cropped off way too much as determined by a sanity check, then i don't save the crop data.</p>

<p>i do this for a certain number of frames (i ended up using two seconds' worth for dsgamer's runs), then go back and crop all of those frames by the means of the values i saved for each side. this is much improved from how i was doing it before using avisynth, which could only look at a single frame to determine values. i also don't think i could get the values that the avisynth plugin was using very easily due to how simple the avisynth language is, but i could be wrong on that.</p>

<p>in other words, the old method was very high maintence - i had to go five seconds at a time and manually adjust the threshold. a lot of times bloom from the screen (if the screen was very bright and you could see the ds's body glowing in the dark, for example) would throw off the threshold. i got around that this time by starting with a rather high threshold and then throwing out crop data that deviated too much from an arbitrary norm. (by "deviated too much" i am talking about how if the screen was very dark the high starting threshold would sometimes cause it to crop off too much, for example the area outside the hud in human form.)</p>

<p>a new feature for next time might be to determine the norm on the fly. i guess that would be means for the whole segment. actually i thought i was going to have to do that this time, but dsgamer's runs came out perfect on the first try. it was a good thing, too, because it took the better part of a week for one of the computers in the lab where i work to process them (i think most of it was i/o though since i had to read twice and write once a .png file for every single frame in the runs). i'd also like to learn how to read and write yv12 and do everything through mplayer/mencoder pipes next time for a big speedup. normally i wouldn't care so much about the speed, but i think this may make it into anri someday (even though only two people have ever submitted ds runs to the site), and it's totally unworkable for most people's computers the way it is now.</p>

<p>i did the audio on dsgamer's runs the same way i did it last time - by putting the over-the-air audio on the left channel and the audacity-recorded audio on the right channel, wearing headphones, and adjusting the audacity audio's offset until i couldn't distinguish the right and left channels. (i then cut the over-the-air audio.)</p>

<p>greenalink's run i did totally differently because he recorded it totally differently. he was able to keep his ds much more still than dsgamer was probably because of how the game is controlled differently, so autocrop was not really needed. i just figured out a set of rotation and cropping values for each individual segment and applied those. he also recorded both screens all the time. he and i talked about this quite a bit and we decided that since mplayerc lets you zoom in on one screen in the video, leaving in both screens would be the best option since some people might want to see what's going on on the bottom screen even when he's controlling a character. it also goes along with the site's general ethos, not throwing out potentially valuable data that could be used by someone to improve the run.</p>

<p>greenalink's run didn't need anything done to the audio (except maybe normalization) since he recorded both the video and the audio using a dvd recorder, so it was already synced.</p>

<p>all three runs will be going up on the site soon, and i hope you enjoy them.</p>

<p>here are the tools i made or used to process them this time:<br />
<a href="http://www.mplayerhq.hu/">mplayer/mencoder</a> (to dump to pngs/encode video from pngs)<br />
<a href="http://nate.metroid2002.com/blog/ds.txt">ds.pl</a> (to process the pngs)<br />
<a href="http://avisynth.org.ru/rotate/rotate.html">avisynth rotate</a> (to rotate greenalink's segments before cropping)</p>

<p>by the way, getting perlmagick to compile under os x was a total pain in the ass. it took me several hours of googling and experimentation. i ended up manually linking the perlmagick sources against the imagemagick libraries delivered by macports.</p>]]>

</content>
</entry>

<entry>
<title>no more musical chairs</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2009/02/no_more_musical.html" />
<modified>2009-02-02T00:25:51Z</modified>
<issued>2009-02-02T00:13:25Z</issued>
<id>tag:nate.metroid2002.com,2009:/blog//2.92</id>
<created>2009-02-02T00:13:25Z</created>
<summary type="text/plain">i forgot to put the segments of the rosenkreuzstilette run in proper order before making the verification-stage avisynth scripts: segment 8 was actually segment 5, and segments 5-7 all had to move up one. it sounds simple enough, but there...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[i forgot to put the segments of the rosenkreuzstilette run in proper order before making the verification-stage avisynth scripts: segment 8 was actually segment 5, and segments 5-7 all had to move up one. it sounds simple enough, but there is no way to rename everything in situations like this without having at least one file have a temporary name. and if it's me doing the renaming i will often second-guess what i am doing halfway through the operation because i am ocd like that.<p>

so i cooked up a quick perl script to just give every file in the directory a temporary name and then rename everything back based on a transformation rule. the old segment numbers are the keys of %rehash and the values are the new numbers. i use %files to remember what the names used to be after the files are given their temporary names. i made the temporary names random (with a check to make sure they're unused) since i may have more than one copy of the same file in the directory (so renaming them to their md5 hash or something is out).<p>

enjoy.<p>

<p>

<pre>#!/usr/bin/perl -w
#nathan jahnke <njahnke@gmail.com>

my $natename = 'rks';
my $thedir = "/p/${natename}";
my %rehash = ( #old, new
	8=>5,
	5=>6,
	6=>7,
	7=>8,
);
my %files;

opendir(P,$thedir);
my @files = readdir(P);
closedir(P);

for (@files) {
	if (-f "${thedir}/${_}") {
		my $newname = &newname;
		system('mv', '-nv', "${thedir}/${_}", "${thedir}/${newname}");
		$files{$newname} = $_;
	}
}

for (keys %files) {
	my $newname;
	if ($files{$_} =~ m/^${natename}-v-(\d+)\.(.+)$/) {
		my $segnum;
		$segnum = $1;
		$segnum = $rehash{$segnum} if $rehash{$segnum};
		$newname = "${natename}-v-${segnum}.${2}";
	} else {
		$newname = "${files{$_}}";
	}
	system('mv', '-nv', "${thedir}/${_}", "${thedir}/${newname}");
}

exit 0;


sub newname {
	my $retvar = '';
	while (-e "${thedir}/".$retvar) { #try until we get a unused name
		$retvar = &random;
	}
	return $retvar;
}

sub random {
	my $retvar = rand(1);
	$retvar =~ s/^0\.//;
	return $retvar;
}
</pre>]]>

</content>
</entry>

<entry>
<title>audio has frames too ii</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2008/11/audio_has_frame_1.html" />
<modified>2008-11-28T02:28:07Z</modified>
<issued>2008-11-28T01:44:11Z</issued>
<id>tag:nate.metroid2002.com,2008:/blog//2.88</id>
<created>2008-11-28T01:44:11Z</created>
<summary type="text/plain">so it turns out the current release version of perian causes audio desync when playing an ffvhuff/pcm avi. moral of the story: if you&apos;re trying to resync something, for the love of god, make sure the instrument you are using...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>so it turns out the current release version of perian causes audio desync when playing an ffvhuff/pcm avi. moral of the story: if you're trying to resync something, for the love of god, make sure the instrument you are using to check sync is not itself causing desync. it turns out that the "skipping frame!" messages from mencoder were actually correct in that they were also skipping video frames to compensate for the mutilated ac3 input - which means that all along all i had to do was do a simple sync correction (albeit one i have to discover myself) to fix output from tiki's borked dvd recorder - assuming i first make nmf using mencoder e.g.:</p>

<p><tt>mencoder -dvd-device /p/mm6 dvd://1 -fps 59.94 -vf-add tfields=0 -vf-add scale=320:240 -ofps 59.94 -ovc lavc -lavcopts vcodec=ffvhuff -oac pcm -o nmf.avi</tt></p>

<p>dgindex, because it doesn't drop video frames to compensate for the bad ac3 ones, will cause randomly progressive desync. though i need to remember to use it for timing in cases when the in-game timer isn't used, such as this mm6 run (the release versions of such runs will actually be several seconds shorter than their official times indicate).</p>]]>

</content>
</entry>

<entry>
<title>audio has frames too</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2008/11/audio_has_frame.html" />
<modified>2008-11-24T15:48:11Z</modified>
<issued>2008-11-24T02:59:48Z</issued>
<id>tag:nate.metroid2002.com,2008:/blog//2.87</id>
<created>2008-11-24T02:59:48Z</created>
<summary type="text/plain">tiki sent me his new mm6 run today in dvd format and i was dismayed to notice that it apparently had random audio desync after indexing using dgindex (with the audio leading the video). the vobs played fine in e.g....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>tiki sent me his new mm6 run today in dvd format and i was dismayed to notice that it apparently had random audio desync after indexing using dgindex (with the audio leading the video). the vobs played fine in e.g. mplayer, so i wasn't sure whether his dvd recorder was making a new chapter and chopping up the audio every few minutes or what.</p>

<p>after several hours of playing around, my initial guess turned out nearly correct: the "Skipping frame!" messages i was seeing every few hundred frames from mencoder trying to transcode the file were because the audio was bad, not the video. actually, i should have known this from the start - if it had been the video, then the video would have been leading the audio, not vice versa as i initially observed at points. i had also forgotten that the term "frame" also applies to many audio formats. using mencoder's -noskip option together with the -mc 0 option seemed to restore a semblance of audio sync in an nmf - enough to carefully stretch the audio to correct the progressive desync to an acceptable level.</p>

<p>tiki has been advised of the situation. right now we are guessing it was because he used rf (from his nes). pal nes is known to generate a nonstandard signal (enough to cause massive frame droppage with more sensitive capture devices), so maybe the ntsc nes in combination with rf confused his dvd recorder? i'll post again as i learn more.</p>]]>

</content>
</entry>

<entry>
<title>more decentralisation</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2008/07/more_decentrali.html" />
<modified>2008-07-27T18:43:35Z</modified>
<issued>2008-07-27T18:00:32Z</issued>
<id>tag:nate.metroid2002.com,2008:/blog//2.86</id>
<created>2008-07-27T18:00:32Z</created>
<summary type="text/plain">so i spent about $600 and got two sata-2 samsung 750 gig 7200 rpm disks with 32 megs of cache each as well as a synology ds 207+. i looked at the reviews on newegg and the specs and it...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>so i spent about $600 and got two sata-2 samsung 750 gig 7200 rpm disks with 32 megs of cache each as well as a <a href="http://www.synology.com/enu/products/DS207+/index.php">synology ds 207+</a>. i looked at the reviews on newegg and the specs and it looked like a good enough unit, but what really won me over was the description of the bundled software (yes, really) on the synology website. it seemed to me like someone inside the company really understood what it means to be a network software (e.g. gmail) developer today, and thankfully ($600 later) it turned out i was right - the software is amazing:</p>

<p><a href="/blog/nas_dstation_settings.png">nas_dstation_settings.png</a><br />
<a href="/blog/nas_dstation_tasks.png">nas_dstation_tasks.png</a><br />
<a href="/blog/nas_network.png">nas_network.png</a><br />
<a href="/blog/nas_status.png">nas_status.png</a><br />
<a href="/blog/nas_terminal.png">nas_terminal.png</a><br />
<a href="/blog/nas_volume.png">nas_volume.png</a><br />
<a href="/blog/nas_winmac.png">nas_winmac.png</a></p>

<p>as you can see, i set up the disks in a raid1. this is the new sda project drive ("p"), replacing an old sata 500 gig in v5 (my hp pc). unfortunately the old 500 started locking up a few months ago and after it did it three times last week i decided i had better not wait any longer. i do daily backups of all the in-progress sda stuff but i didn't want to work off of the backup if i could avoid it, which i did. actually even now i'm not sure whether the lockups were caused by the drive, the cable or the controller (on the hp motherboard) but to be honest i don't have the time to be troubleshooting things like that, especially when the lockups are more or less random. also no matter the outcome i would have had to have spent money anyway so i felt this purchase, subsidized 50% with sda funds (even though i have no reason to buy it except sda), was inevitable.</p>

<p>softwarewise:</p>

<pre>BusyBox v1.1.0 (2008.06.20-16:34+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

<p>p&gt; uname -a<br />
Linux p 2.6.15 #639 Sat Jun 21 00:30:16 CST 2008 armv5tejl unknown<br />
p&gt; </pre></p>

<p>i have to say that the built in torrent client (rtorrent with the web gui) isn't bad. the only thing that seems to be missing is down/up rate caps in the web gui (it may be available in the windoze-only standalone app - i haven't checked) but it's not the end of the world. having the torrent client run on the same machine as the project drive is important and this morning i was able to shut down v5 for the first time in years, which was pretty cool (literally). it's by far the biggest power user out of all the v6 machines (by perhaps an order of magnitude - the other three are two laptops and a mac mini) so having it off when i'm not encoding is a boon.</p>

<p>the nas looks like it has a ~2 gig solid state drive for its software, which comes as an image file which is then flashed to it over the network (it doesn't come with any software preloaded, just a disc with an image on it to get you started). upgrades happen this way as well - of course i updated it to the latest after i got it and it worked great from my mac.</p>

<pre>p&gt; df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/md0                  2.3G    235.0M      2.1G  10% /
/tmp                     62.0M    108.0k     61.9M   0% /tmp
/dev/md2                684.7G     38.8G    645.9G   6% /volume1
p&gt; </pre>

<p>overall i'm quite pleased with it. it works as advertised.</p>]]>

</content>
</entry>

<entry>
<title>the wine whine</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2008/06/the_wine_whine.html" />
<modified>2008-06-28T16:43:31Z</modified>
<issued>2008-06-28T03:37:51Z</issued>
<id>tag:nate.metroid2002.com,2008:/blog//2.85</id>
<created>2008-06-28T03:37:51Z</created>
<summary type="text/plain">so wine 1.0 came out last week (firefox 3 sort of stole its thunder) but i caught it on slashdot and i thought, what the hell. i&apos;d stayed away from wine previously because i was almost certain nothing as complex...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>so wine 1.0 came out last week (firefox 3 sort of stole its thunder) but i caught it on slashdot and i thought, what the hell.</p>

<p>i'd stayed away from wine previously because i was almost certain nothing as complex as my use of avisynth would run 100% satisfactorily. needless to say, i was quite surprised when it compiled on one of my macs and <a href="http://nate.quandra.org/vdub-wine.png">played an unmodified sda avisynth script in vdub correctly</a>.</p>

<p>that was over a week ago, and i'm still not entirely over the weirdness factor of running the whole anrichan family of tools without running any microsoft code. so i guess i'm not as elated as you might imagine - more like dumbfounded. it's been one of those rare moments when technology catches me off guard.</p>

<p>i've read that wine works even better under linux due to apple's lame x implementation, so i'm now considering what to do with the one remaining machine i own that runs windoze as its primary os ("v5").</p>

<p>it's not perfect by any means - as far as i can tell, pipes aren't supported in batch files, which meant i had to reimplement everything in unix shell language. it hasn't been a big deal except in the case of anri.bat, which will need <a href="http://speeddemosarchive.com/forum/index.php/topic,6256.msg234297.html#msg234297">major reworking</a>, and that's a damn shame, because i thought at first that i had "discovered" a universal anrichan.</p>

<p>i'm also having problems with processes, e.g. avs2wav and bepipe, not being able to close files that are on network volumes. the process will complete successfully, but the close call hangs, meaning i have to hit ctrl-c to continue the encode script - unacceptable. i've actually seen this before under windoze (though not working on sda stuff), so i doubt it's wine's fault per se - just something i'll have to dump more time into.</p>

<p>i also can't seem to figure out how to install codecs that include right-click -> install .inf files. i grabbed the dll call out of a real copy of doze and tried that, and it does run, but doesn't seem to produce any result under wine. i'm lucky the anrichan installer installs lagarith, because i probably wouldn't have access to that codec under wine for doing nmf otherwise.</p>

<p>speaking of nmf, here's my unix <a href="/blog/nmf">nmf</a> command, my <a href="/blog/v">v</a> command and my <a href="/blog/mq">mq</a> commmand as references for how i reimplemented snow's batches in unix shell language. <a href="/blog/archives/2007/10/sumichan.html">sumichan</a> is essentially unchanged because i'm still using avisynth - the only difference is the batch file writing for calling nmf.bat on each of the slices, which now obviously just writes calls to nmf instead. syntax is like <pre>nmf "P:\\projname\\runname" 1</pre> (the 1 for setting "delete temporary files" to true, from snow's batches).</p>

<p>look for the first runs produced with the help of wine on sda soon.</p>]]>

</content>
</entry>

<entry>
<title>sumi-chan</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/10/sumichan.html" />
<modified>2007-10-07T08:36:42Z</modified>
<issued>2007-10-07T07:56:19Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.84</id>
<created>2007-10-07T07:56:19Z</created>
<summary type="text/plain">tonight saw the successful launch of my virtual multithreading solution, sumi-chan....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>tonight saw the successful launch of my virtual multithreading solution, <b>sumi-chan</b>.</p>]]>
<![CDATA[<p>first of all, some background: right now, i own three modern computers, all of which are powered by dual core processors. the brilliant among us will have already concluded that this means i have a total of six (6) processor cores available. all the computers share storage over a gigabit lan.</p>

<p>unfortunately, the high quality deinterlacing filter mvbob() is not multithreaded. this means it can only use one core at a time. in the past i have set up multiple instances of vdub with e.g. one fourth of the total segments in a run to each, then started them all at the same time, but of course not all the segments are identical in length, so there would always be inefficiency as some vdubs would finish their deinterlacing before others.</p>

<p>avisynth is a very useful tool, and it was only a matter of time before i used it to automate a process by which any given input could be split up across a given number of threads, then automatically recombined later. i call this process <a href="/blog/sumichan.sh">sumi-chan</a> for lack of a more creative descriptor (if the name were to describe the software properly, it would be something like "avisynth filter virtual multithreading system" - so long! so boring!).</p>

<p>usage is simple - i just run sumichan.sh with the avisynth scripts' basename and the desired number of cpu cores across which to split up the work, then run the resulting batch files on each real machine (one batch file for each cpu core). thus, entering 6 for sumi-chan's second argument results in six sets of avisynth scripts and six batch files. </p>

<p>due to rounding errors, if the number of frames in the source material is not divisible by the number of cpu cores specified, a few frames will be "squeezed" to the final work unit. this is unlikely to result in any significant inefficiency, as mvbob() usually processes between 1 and 2 frames per second even in extremely complex scenes. changes in said complexity throughout each work unit will result in much more significant inefficiency (compared to a true multithreading solution whereby all cpu cores would be simultaneously busy or not busy).</p>

<p>sumi-chan will appear as an optional feature in anri-chan 3 (we're getting close to the release of 2 right now). it ought to make encoding d1 material much more realistic for most people.</p>

<p>incidentally, i'm using quantizer 1 vfw xvid (via vdub) for the nmf. i've been extremely pleased with both the cpu and disk costs associated with this codec (they are much smaller than those associated with lagarith - and it crashes less to boot!).</p>

<p>of course, i have to include <a href="/blog/sumi-chan-launch.jpg">the obligatory crap quality picture of my new virtual computer, dubbed "v6"</a>. cores 1 and 2 are in the macbook on the left, while cores 3, 4, 5 and 6 are monitored on the mac mini's screen, but are in reality split equally between v5 (my pc) and the mini. (the terminal windows lower down on the mini's screen are left over from working on the prime hunters run as discussed in <a href="http://nate.metroid2002.com/blog/archives/2007/10/diy_ds.html">the previous entry</a>.)</p>]]>
</content>
</entry>

<entry>
<title>diy ds</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/10/diy_ds.html" />
<modified>2007-10-05T22:20:40Z</modified>
<issued>2007-10-05T21:12:27Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.83</id>
<created>2007-10-05T21:12:27Z</created>
<summary type="text/plain">it&apos;s been almost eighteen months since i posted the ds recording guidelines, and now the first ds run has been submitted to sda....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>it's been almost eighteen months since i posted the <a href="http://www.metroid2002.com/forum/viewtopic.php?t=4819">ds recording guidelines</a>, and now the first ds run has been submitted to sda.</p>]]>
<![CDATA[<p>DSGamer3002 followed those guidelines to the letter for his prime hunters run, and this was reflected in the quality of the recording.</p>

<p>however, the original recordings needed to be cropped in order to get rid of their useless black borders. the catch was that the cropping parameters needed to be dynamic - that is, where and how much i need to crop changed every few seconds.</p>

<p>as i'm sure you've figured out by now, i came up with a way to accomplish this in a semi-automated fashion, and the rest of this blog entry will be devoted to this methodology.</p>

<p>the first step was to locate a simple autocropping plug-in for avisynth. this came in the form of the aptly-named autocrop, found at <a href="http://avisynth.org/warpenterprises/">warpenterprises</a>. thankfully, autocrop() offers a great deal of customization of the autocropping algorithm. the user can set not only the crop/don't crop threshold, but the number of sample frames the plug-in takes into consideration within the video, as well.</p>

<p>the crop threshold is probably 8-bit luma, while the sample frames are, according to the plug-in's author, taken equidistantly from within the source video. however, no matter how many samples the plug-in uses, there will always be only one set of cropping settings per video. thus, whenever dsgamer's tired hands moved ever so slightly, the screen would no longer be contained entirely within the initially-calculated cropping values.</p>

<p>the obvious solution was to make many more, smaller videos out of dsgamer's run - enter <a href="/blog/acrop.sh">acrop</a>.</p>

<p>this bash script takes two arguments: the basename of the video and audio originals and the number of frames in the original video. the script then creates a number of avisynth scripts, each of them including a number of source declarations and autocrop() invocations for bits of the original video.</p>

<p>i call each section of video on which autocrop() operates a "window". the window size is not arbitrary, but is determined by how long a sequence of absolute black will be on screen in the source video. if any window consists entirely of black, then autocrop() will na&iuml;vely produce 0x0 video, which is a contradiction in terms - avisynth has no ability, from what i have seen, to resize a 0x0 frame. thus, even though it's all black anyway, windows consisting entirely of black must be avoided. the window size, then, should be perhaps one or two seconds longer than the longest stretch of absolute black in the source video.</p>

<p>i found taking the correct number of samples, too, to be crucial: the process will fail (producing 0x0 video) if either too many or too few are taken.</p>

<p>for convenience and efficiency of processing, i included several windows in each new script file. for this speed run i created scripts 1000 frames long, 5 200-frame windows in each. because the source video was exactly 30 fps, a 10-minute segment would correspond to around 20 individual script files.</p>

<p>it was not possible to include every script file in one master script for two reasons. one was the extremely long startup time associated with stacking multiple instances of autocrop() on top of one another. on my core 2 duo 2 ghz, it took between 10 and 20 seconds just to open one script with 5 windows in it. the other was that each window represents one directshowsource() declaration for the source video - in other words, there was one copy of the entire source video in memory for each window in the currently open script(s). avisynth is extremely ram-inefficient in this way, but you can't blame it, actually, because we're talking about windoze here.</p>

<p>of course, my default autocrop() threshold of 100 was not always optimal. in fact, i had to preview every window in vdub to make sure it was not too high or too low. many times i simply replaced every 100 with e.g. 70 because the game environment in that particular segment was darker and autocrop() was getting fooled and cropping off parts of the game screen. it was also occasionally necessary to increase the threshold when e.g. the screen went totally white, resulting in light reflecting off surrounding objects and back onto the area around the ds lite's screens, in turn resulting in autocrop() leaving in the plastic border around said screens.</p>

<p>after i determined the correct autocrop() parameters for each window of a segment, i aligned the audio (recorded separately in audacity by dsgamer via an 1/8" miniplug cable) by placing the over-the-air audio from the original source video on the left channel and the correct, line-in recorded audio on the right channel. i knew that the "new" audio was lined up when i could not distinguish that sound was coming first in either the left or the right channel. i adjusted the correct audio's delay by using delayaudio() in a master avisynth script file which loaded all of the individual pieces of the segment in question (since saved from the original scripts as lagarith-compressed new master files).</p>

<p>i would like to emphasize my success with this relatively novel method of audio realignment. in sharp contrast to the usual method when it comes to audio realignment, i did not even have to look at the video to know the audio was aligned - i literally did the work with my eyes closed.</p>

<p>and so the world's first high quality downloadable nintendo ds speed run was prepared for distribution on sda. i hope that everyone enjoys dsgamer's hard work and my automation-laced lack thereof when his run is posted on sda soon.</p>

<p>i almost forgot - here's the <a href="/blog/croptan.png">obligatory screenshot</a> of my initial autocrop() parameters discovery process.</p>]]>
</content>
</entry>

<entry>
<title>framerate decimation hell (or: deflickering revisited)</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/09/framerate_decim.html" />
<modified>2007-09-26T05:51:41Z</modified>
<issued>2007-09-26T05:28:13Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.82</id>
<created>2007-09-26T05:28:13Z</created>
<summary type="text/plain">i&apos;m encoding the ocarina of time 100% run for the third time right now (second time was due to a bad statid)....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>i'm encoding the ocarina of time 100% run for the third time right now (second time was due to a bad statid).</p>]]>
<![CDATA[<p><font size="14" face="courier"><br />
F1: <font color="Blue">|</font><u>|</u><font color="green">|</font><font color="purple"><u>|</u></font><font color="red">|</font><u>|</u> <br />
<br /><br /><br />F2: <font color="Blue">|</font> <font color="green">|</font> <font color="red">|</font> <br />
<br /><br /><br />F3: <font color="Blue">|</font>  <font color="green">|</font> <br />
<br /><br /><br /></font></p>

<p>in the above picture each | represents one frame. this drawing depicts one complete cycle and only one complete cycle, so the first frame not shown is the first frame of the next cycle. it would be solid blue like the first frame of this cycle.</p>

<p>oot is d4 f3. from the f1 original i was going to f2 first, then to f3 to avoid odd (deflickered) frames (shown above with a bar through them). otherwise i have to use retard bob which does a marginal job of undoing the deflickering and takes exponentially more cpu. more on deflickering in <a href="http://nate.metroid2002.com/blog/archives/2007/01/flickerbat.html">these</a> <a href="http://nate.metroid2002.com/blog/archives/2007/01/flickerbat_ii.html">two</a> blog entries (incidentally this is the same reason i put up <a href="http://speeddemosarchive.com/yabb/YaBB.pl?board=sda_site;action=display;num=1168671803">this topic</a>).</p>

<p>the frame marked with blue is fine. the problem as i understand it is that sometimes instead of the motion happening in the green frame it happens in the purple or red frame (and gets lost as you can see on the f3 line). in these cases the pattern of motion in f1 is:</p>

<p><font face="courier"><font color="blue">K</font> <font color="black">D</font> <font color="green">D</font> <font color="purple">K</font> <font color="red">D</font> <font color="black">D</font></font> or <br />
<font face="courier"><font color="blue">K</font> <font color="black">D</font> <font color="green">D</font> <font color="purple">D</font> <font color="red">K</font> <font color="black">D</font></font> respectively, instead of <br />
<font face="courier"><font color="blue">K</font> <font color="black">D</font> <font color="green">K</font> <font color="purple">D</font> <font color="red">D</font> <font color="black">D</font></font></p>

<p>where <font face="courier">K</font> is a motion frame and <font face="courier">D</font> is a duplicate (no motion). when i was testing this i saw only sequences of the last type which are ok. but there are often sequences of the first or second type. and once this starts it apparently continues for some time, thus the long, painful stretches of f6 people are seeing.</p>

<p>so basically the game isn't dropping frames at regular intervals. sometimes it will be ok to go -> f2 -> f3 but usually not.</p>

<p>the good news is that i think i've worked out a solution with the help of donald graft's decimate():</p>

<p><font face="monaco, courier">changefps(f1/2)<br />
decimate(cycle=3)</font></p>

<p>this seems to be picking the correct frame (either green or red) from the f2 constellation, probably because it's checking to see that each frame is unique. this means i probably won't have to go back to the horrid retard bob.</p>]]>
</content>
</entry>

<entry>
<title>mac mini</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/09/mac_mini.html" />
<modified>2007-09-16T23:25:05Z</modified>
<issued>2007-09-16T21:08:00Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.81</id>
<created>2007-09-16T21:08:00Z</created>
<summary type="text/plain">so i bought a &quot;top of the line&quot; mac mini....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>so i bought a "top of the line" mac mini.</p>]]>
<![CDATA[<p>it's a core 2 duo 2.0 ghz with 2 gigs of ram (it isn't "apple" ram, of course).</p>

<p>total cost was $1,017.28. cost to sda was $339.09. 1/3 of the machine was paid for with sda funds for the following reasons:</p>

<p><b>1)</b> the recent increase in the number of d1 f1 runs i need to encode for the site meant less and less idle time for my macbook. i was concerned that i would run out of cpu power to meet demand, especially after the warm reception of metroid prime 3 coupled with its length: the current estimate for an optimal any percent run is around three and half hours - not counting cutscenes. for reference, it takes about a week to encode 5 hours of d1 f1 video (deinterlacing to nmf and encoding all seven qualities) using four processor cores (assuming full speed from them all). i had been counting on most runs being d4, but this appears to be coming to an end.</p>

<p><b>2)</b> related to <b>1)</b>, i had no quick way to take 10-20 gig of content in to campus to upload while the macbook is locked down encoding.</p>

<p>only 1/3 of the cost was covered by sda because i could have gotten a better machine for the money had it not been a mac (i wanted a desktop mac because using the macbook as one was suboptimal). granted, this will help me do non-encoding work for sda more efficiently, but i feel that is a rather weak reason to take more money from our reserves in this crazy time. also, regarding <b>2)</b>, the other half of the reason i have to have the macbook on campus is school, which has yet to demonstrate decisively that it is beneficial to m2k2sda (though it has been making gains of late: some work on anri-chan was actually done as part of my on-campus job!).</p>

<p>i backed down from saving up for the next beast machine (codenamed V6) because it no longer made sense economically. there are many factors involved, but to summarize:</p>

<p><b>3)</b> i need more power right now (see <b>1)</b> and <b>2)</b>). an eight-core machine costs about $4,000. i wouldn't be able to afford that until may at the earliest.<br />
<b>4)</b> there has been no solution found for multithreaded deinterlacing. therefore i will have to write my own (already discussed as a feature for a future version of anri-chan). once i do this, it will no longer matter how many physical computers are performing the deinterlacing - the load will be divided evenly between the available number of cores.<br />
<b>5)</b> following from <b>4)</b>, continuing to pretend otherwise would mean that the macbook and V5 would be considered useless after the purchase of V6. together they have just under 50% of the theoretical power of V6, so this would be a great waste. by buying a weaker machine now and writing software to tie it together with my existing two, i can have 75% of the power of V6 right now for 1/4 of the price.</p>

<p>therefore, i now think of V5, the macbook and the new mac mini together as V6.</p>

<p>obligatory birth sequence documentation:</p>

<p><a href="/blog/mac mini/SV300002.JPG"><img src="/blog/mac mini tn/SV300002.JPG"/ ></a> <a href="/blog/mac mini/SV300003.JPG"><img src="/blog/mac mini tn/SV300003.JPG"/ ></a> <a href="/blog/mac mini/SV300004.JPG"><img src="/blog/mac mini tn/SV300004.JPG"/ ></a> <a href="/blog/mac mini/SV300005.JPG"><img src="/blog/mac mini tn/SV300005.JPG"/ ></a> <a href="/blog/mac mini/SV300006.JPG"><img src="/blog/mac mini tn/SV300006.JPG"/ ></a> <a href="/blog/mac mini/SV300007.JPG"><img src="/blog/mac mini tn/SV300007.JPG"/ ></a></p>]]>
</content>
</entry>

<entry>
<title>anri-chan and total independence</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/06/anrichan_and_to.html" />
<modified>2007-07-01T00:13:39Z</modified>
<issued>2007-07-01T00:12:29Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.80</id>
<created>2007-07-01T00:12:29Z</created>
<summary type="text/plain">it&apos;s been over two years since m2k2sda became monetarily self-sufficient....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>it's been over two years since m2k2sda became monetarily self-sufficient.</p>]]>
<![CDATA[<p>money changes hands at least once every month, as i have to pay the $99 monthly m2k2sda server bill. when the google ads on the site earn us more than $99 a month, then sda requires no outside investment to continue to operate so long as it is continually updated (it's thought that otherwise, site traffic, and therefore ad revenue, would go down, while the server bill would remain the same, thereby reversing the aforementioned positive trend).</p>

<p>unfortunately, the amount of labor grenola, mike, snow, radix and i pour into sda, if paid, would equate to a sum much, much larger than $99 a month. therefore, when i declared sda monetarily self-sufficient two years ago, i was referring only to actual money earned and spent.</p>

<p>now it's time to take care of the rest.</p>

<p>for years, automating my job was a hopeless fantasy. the number of correct decisions required to encode material for the site was simply too high, and i knew of no way to have the computer make them for me. anyone who has seen the knowledge base and the tech support forum knows that asking inexperienced people to do my job as i do it is a losing proposition.</p>

<p>so i tried instead to make sda's revenue grow - to make the site pay us back for our work on it. i learned many things from my adventures trying to sell sda content on dvd, but probably the most significant was that <a href="http://nate.metroid2002.com/blog/archives/2005/11/i_started_this.html">it doesn't work</a>: sda may never generate enough revenue to pay its workers, and sometimes i think it's better that way.</p>

<p>but the fundamental problem remained: sda needs people to add new content, and if i died today, i thought to myself, would someone be there to replace me? i decided that even though i can't control my mortality, i <i>can</i> control how i will be seen after the fact.</p>

<p>little by little i chipped away at the problem, making generic.avs into a highly concentrated, library-driven block of boolean action. generating the scripts for new projects became a matter of enabling or disabling variables. now one script could do it all.</p>

<p>but there still had to be someone there to make decisions based on the content of the source video. i had automated the ntsc/pal distinction, but the rest of them seemed hopeless: how should i tell the computer to check whether every second or every third frame is the same as the previous? and even if this could somehow be done - what about the games with a varying framerate?</p>

<p>therefore, i created the concepts of d (dimensions), f (framerate) and fdp (framerate decimation paradigm) to quantify the differences between games. if a database of every game's d, f and fdp could be created, i reasoned, then surely some sort of script could be written that would take those values and configure generic.avs, reducing my job to reading numbers out of list and typing them in to a window. even if the game in question weren't yet included in the list, it could be added by any tech support staff member after seeing a brief, automatically-generated sample of the game's video. it would be the next best thing to full automation.</p>

<p>as many of you are already aware, i decided to call this script <a href="http://speeddemosarchive.com/yabb/YaBB.pl?board=sda_site;action=display;num=1178344904"><b>anri-chan</b></a> after the anime character who (like mickey and goethe before her) used magic to create numerous inferior copies of herself in a failed attempt to automate her job. thus, i am anri-chan, and anri.bat is an inferior copy of me. (when i began the project, i wasn't even aware that dgindex accepted arguments on the command line, and so i thought that automating the steps involving the user interface might be impossible, thereby dooming it all to failure.)</p>

<p>but these open source tools came through for me in the end, and so i was able to produce a proof-of-concept much more quickly than i had anticipated - and even better - it <i>worked</i>: other people were actually encoding acceptable video using anri-chan!</p>

<p>even vista couldn't stop me. </p>

<p>and as if that weren't enough, the free, open source model impressed me yet again today, as b-man in the sda forum went and wrote the anri-chan encoding settings manager for me. i have always said that it is not only me who can do this (just that i was the first to be chosen), and now i have been proven right. it really is true: if you build it, they will come.</p>

<p>i will finally make sda eternal by taking away the cost of its maintenance (at least as far as my job is concerned).</p>

<p>so now it's just a matter of writing comforting documentation ("when the program says do <i>x</i>, that's when you do <i>x</i>!") and officially releasing the software. with this i will simultaneously increase submissions, decrease my workload and therefore ensure the future of the site.</p>

<p>two years wasn't so long to wait, after all.</p>]]>
</content>
</entry>

<entry>
<title>time for lossy nmf</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/06/time_for_lossy.html" />
<modified>2007-06-24T05:13:18Z</modified>
<issued>2007-06-24T03:11:58Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.79</id>
<created>2007-06-24T03:11:58Z</created>
<summary type="text/plain"><![CDATA[[20:53:11] &lt;nate&gt; i've decided i'm never using lossless nmf again...]]></summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>[20:53:11] &lt;nate&gt; i've decided i'm never using lossless nmf again</p>]]>
<![CDATA[<p>[20:58:18] &lt;Radix&gt; why&gt;<br />
[20:58:32] &lt;DJGrenola&gt; you had to ask didn't you<br />
[20:58:33] &lt;DJGrenola&gt; heheh<br />
[21:00:27] &lt;nate&gt; disk read locks<br />
[21:00:31] &lt;nate&gt; i have too much cpu with 2 cores<br />
[21:00:40] &lt;nate&gt; so what happens when i put a 4 core cpu in there<br />
[21:00:46] &lt;nate&gt; i buy a raid? i don't think so<br />
[21:01:00] &lt;nate&gt; more cpu just means less relative cost to decode x264 original<br />
[21:01:10] &lt;nate&gt; can't use it with interlaced stuff but that's not an issue<br />
[21:01:16] &lt;nate&gt; this is post-mvbob stuff<br />
[21:01:39] &lt;nate&gt; basically what happened is the zoid ss flv was cut off<br />
[21:01:49] &lt;nate&gt; because it was one of those times p: filled up while i was in kansas<br />
[21:01:54] &lt;nate&gt; and i only just caught it today<br />
[21:02:01] &lt;nate&gt; so now it's taking ~12 hours to reencode the flv<br />
[21:02:07] &lt;nate&gt; when it's less than half that cpu wise<br />
[21:02:33] &lt;DJGrenola&gt; I'd definitely consider looking into ffvhuff in ffdshow<br />
[21:02:39] &lt;DJGrenola&gt; I use that for everything<br />
[21:02:47] &lt;nate&gt; if it's lossless then it's too big<br />
[21:02:51] &lt;nate&gt; well<br />
[21:02:59] &lt;nate&gt; if it's anything like huffyuv anyway<br />
[21:03:04] &lt;DJGrenola&gt; it's a little smaller than huffyuv is, ~20% or so<br />
[21:03:09] &lt;nate&gt; 3:1 compression for all #000000 is pathetic<br />
[21:03:38] &lt;Radix&gt; have you tried a compressed partition?<br />
[21:04:04] &lt;DJGrenola&gt; :o<br />
[21:04:10] &lt;nate&gt; nope ... but do you really think blind compression i.e. not knowing it's compressing video will do a whole lot<br />
[21:04:19] &lt;DJGrenola&gt; that's a clever idea<br />
[21:04:27] &lt;nate&gt; certainly can't be more than the 3:1 the shit lossless ones get<br />
[21:04:32] &lt;Radix&gt; i dunno, zip compress a lossless avi and compare to huffyuv<br />
[21:04:51] &lt;Radix&gt; huffyuv was built for speed, not compression ratio<br />
[21:06:33] &lt;nate&gt; ok making a test file<br />
[21:06:39] &lt;Radix&gt; also try zip compressiong a huffyuv avi<br />
[21:06:45] &lt;Radix&gt; preferrably the same one i guess :-p<br />
[21:26:26] &lt;nate&gt; ok this is pal d1 f1<br />
[21:26:44] &lt;nate&gt; samus wearing the varia fusion suit kills the sheegoth and gets the wave beam, then leaves c.i.temple<br />
[21:33:30] &lt;nate&gt; clip is about 34 seconds long</p>

<p>1.9G    test_rgb24.avi<br />
924M    test_rgb24.avi.zip<br />
680M    test_huffyuv.avi<br />
611M    test_huffyuv.avi.zip<br />
467M    test_lagarith.avi<br />
467M    test_lagarith.avi.zip<br />
328M    test_x264.avi<br />
328M    test_x264.avi.zip</p>

<p>[22:02:54] &lt;nate&gt; quantizer 0 x264 avi it is<br />
[22:03:12] &lt;nate&gt; though it seems lagarith would come close<br />
[22:04:32] &lt;nate&gt; xp (10 megabaud) mpeg-2 original from dvd would be just over 42.5 meg<br />
[22:05:10] &lt;DJGrenola&gt; wonder if snow has a lossless mode<br />
[22:19:57] &lt;nate&gt; trying quantizer 1 etc<br />
[22:37:46] &lt;nate&gt; looks like quantizer 1 and quality 1 are similar in size to the quantizer 0<br />
[22:38:01] &lt;nate&gt; so what i'm going to do is no quantizer two pass 10 megabaud and look at the thing closely to see if i can see any artifacts<br />
[...]<br />
[23:13:42] &lt;nate&gt; the difference between the original and 10 megabaud is slight<br />
[23:13:50] &lt;nate&gt; visible ... but not necessarily bad<br />
[23:13:57] &lt;nate&gt; what it did was smooth out some areas<br />
[23:14:03] &lt;nate&gt; typical of h.264 i guess<br />
[23:14:18] &lt;nate&gt; the thing is that a lot of what it smoothed out was actually not supposed to be there in the first place<br />
[23:14:22] &lt;nate&gt; because it was artifacts from mvbob<br />
[23:14:34] &lt;nate&gt; so sometimes the lossy looks better than the lossless <i>(1, 3)</i><br />
[23:16:54] &lt;nate&gt; it's certainly better than mpeg-2!<br />
[23:17:50] &lt;nate&gt; near key frames they're almost identical <i>(2)</i></p>

<p>1: <a href="/blog/1_orig.png">original</a> | <a href="/blog/1_10000.png">10 megabaud 2-pass x264</a><br />
2: <a href="/blog/2_orig.png">original</a> | <a href="/blog/2_10000.png">10 megabaud 2-pass x264</a><br />
3: <a href="/blog/3_orig.png">original</a> | <a href="/blog/3_10000.png">10 megabaud 2-pass x264</a></p>

<p>[23:26:31] &lt;nate&gt; so <a href="/blog/test_x264_10000.avi">10 megabaud 2-pass x264 avi</a> is the new standard nmf<br />
[23:26:35] &lt;nate&gt; hurrah</p>]]>
</content>
</entry>

<entry>
<title>generic.avs grows stronger</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/03/genericavs_grow.html" />
<modified>2007-06-20T23:17:57Z</modified>
<issued>2007-03-23T05:31:36Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.78</id>
<created>2007-03-23T05:31:36Z</created>
<summary type="text/plain">tonight i finally got automatic (well, almost) d working in generic.avs (the script from which all other sda scripts are created). just set &quot;false&quot; to &quot;true&quot; on line 7 to enable d1 (d4 is default). pal autodetection remains in from...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>tonight i finally got automatic (well, almost) d working in <a href="http://nate.metroid2002.com/blog/_generic.avs">generic.avs</a> (the script from which all other sda scripts are created).</p>

<p>just set "false" to "true" on line 7 to enable d1 (d4 is default). pal autodetection remains in from the last version, which i can't remember if i posted here or not. change "false" to "true" on line 23 to enable the statid (after you've finished filling out the trim(), for example).</p>

<p>additionally, you'll need to change all occurrences of "dx" to your project name, which should be the same as your index and ac3 basenames. you also may need to change your drive letter (i use p: for my project drive). finally, watch out for the path to the <a href="http://nate.metroid2002.com/blog/ntsc_d4.PNG">sda</a> <a href="http://nate.metroid2002.com/blog/ntsc_d1.PNG">logo</a> pngs in the statid subroutines (and, obviously, the LoadPlugin()s at the very top!). all the other options from lines 10-19 depend on the input video source and desired output quality.</p>

<p>enjoy!</p>]]>

</content>
</entry>

<entry>
<title>more memory is always better</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/02/more_memory_is.html" />
<modified>2007-06-20T23:17:57Z</modified>
<issued>2007-02-10T19:25:43Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.77</id>
<created>2007-02-10T19:25:43Z</created>
<summary type="text/plain">big thanks to radix for maxing out v5 with 3 gb (it only had 1 gb before) ram this xmas....</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>big thanks to radix for maxing out v5 with 3 gb (it only had 1 gb before) ram this xmas.</p>]]>
<![CDATA[<p>i had long suspected that the embarrassing "access violation" errors spewed by avisynth were the result of running out of memory, but this was very difficult to test, as they tended to occur randomly, even under low memory conditions. one of the reasons i suspected it was overshooting while allocating was that on my macbook, now with 2 gb of ram, i didn't see the problem on the same scale as i did on v5. the only alternative was bad ram in both of the machines (since it had happened at least once on both).</p>

<p>i finally uncovered the connection last month during a series of tests i was running for OPERATION ZWEI, an sda-related secret project some members of the sda team are working on right now (expect to see its release sometime this summer). these tests involved extremely memory-intensive avisynth scripts, and i later decided not to accomplish the effect in this way, because the avisynth system is simply broken when it comes to memory allocation (thanks, doom9 guys!). however, this situation afforded me repeated chances to see the exact same "access violation" error pop up -- again, pseudo-randomly -- but this time while watching the task manager intently.</p>

<p>i was able to distinguish two different types of access violation errors -- one thrown when the avisynth mother process reached doze's 2 gb allocation limit and another when the process would attempt to allocate memory beyond the total (3 gb) available to doze. it was at this point that i realized that radix had basically saved m2k2sda from these pesky access violations making their way into final encodes, because under normal conditions i don't use more than 1 gb of ram on v5. surely 2 gb free should be enough for any normal encode to allocate freely without the danger of running over the edge.</p>

<p>and indeed, i haven't seen or heard of a new encode afflicted with the problem since installing the new ram.</p>]]>
</content>
</entry>

<entry>
<title>more automation</title>
<link rel="alternate" type="text/html" href="http://nate.metroid2002.com/blog/2007/01/more_automation.html" />
<modified>2007-06-20T23:17:57Z</modified>
<issued>2007-01-18T04:59:26Z</issued>
<id>tag:nate.metroid2002.com,2007:/blog//2.76</id>
<created>2007-01-18T04:59:26Z</created>
<summary type="text/plain">in the spirit of ballofsnow&apos;s megui-like batch files for sda, i&apos;ve created a similar xvid.bat. this batch uses the vdub.exe command line driver to encode xvid videos loading m1.vcf, m2.vcf and l.vcf -- mq first pass, mq second pass and...</summary>
<author>
<name>njahnke</name>

<email>njahnke@gmail.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://nate.metroid2002.com/blog/">
<![CDATA[<p>in the spirit of ballofsnow's megui-like batch files for sda, i've created a similar <a href="http://nate.metroid2002.com/blog/xvid.bat">xvid.bat</a>. this batch uses the vdub.exe command line driver to encode xvid videos loading m1.vcf, m2.vcf and l.vcf -- mq first pass, mq second pass and lq third pass, respectively.</p>

<p>the input syntax for this batch varies slightly from the others due to the need to insert LQ in varying places in the filename depending on whether the run is segmented or not. to help me remember it (and to speed up master batch creation), i've also created a <a href="http://nate.metroid2002.com/blog/generic.bat">generic.bat</a>.</p>]]>

</content>
</entry>

</feed>