TASVideos

Tool-assisted console game movies
When human skills are just not enough

Emulator Resources / Making AVI / FCEU / Windows

This page is part of the Emulator resources / Making AVI page collection. Back to:
<< Emulator Resources / Making AVI / FCEU
<< Emulator Resources / Making AVI
<< Emulator Resources

This page explains how to take a FCM file and convert it to a TASvideos.org quality AVI file suitable for publicaton.

This was written by me, adelikat, and explains my method. There are certainly many ways to accomplish the same outcome.

I tried to streamline my process and explain it in a comprehensive way, and include potential mistakes and other problems that I and others have run across.

Table of contents [expand all] [collapse all]

Downloading

You will need to download the following. All downloads can be found at here

Installing and Configuring

With all of this configured, you are now ready to capture!

Capturing

The most important part of the encoding process is getting an initial lossless AVI. Any problems in the original capture will only compound during the compression process, resulting in either a lower fidelity in video/audio, or a higher file size.

That's it! You are done capturing a nice lossless AVI ready for editing and compression.  At this point open the AVI and check it.

Common errors to look for:

Cropping & making subtitles with Virtualdub

Open up the captured AVI with virtualdub.

Making a subtitle file:

This is the best time to do this since you have virtualdub open to easily scroll though and find good frames to begin and end the subtitles.

Here is a sample .sub file. For this encoding tutorial, you want to copy/paste this to notepad and create a file called test0.sub and place it in the mencoder folder.

{60}{360}Super Mario Bros.|played by klmz|Play length: 04:48.53|Rerecord count: 4459
{1501}{1701}This is a tool-assisted recording.|For more information, visit http://tasvideos.org/

Cropping

If you did not stop the initial capture in the right spot, now is the time to crop the ending. Simply scroll to the end of the movie and find the frame you wish it to end. If the movie has a clear end (like a fadeout to a black screen or the opening of the game), then crop it there. If there is a "The end" screen that loops music continuously, make sure that the music completes a cycle. Once you have the movie set to the frame you wish to end it, press the "home" key. Then scroll to the end of the movie on the timeline/bar and press the "end" key. Finally, press "delete" key to remove the selected segment from the movie.

Now that your movie is cropped and a subtitle file is ready, navigate in Virtualdub to Video > Direct Stream Copy, and then File > Save as AVI. Name the file recorded.avi and save it to the Mencoder folder.

Logo

A published AVI file on TASvideos.org needs a good logo. There are strict requirement on the content of a logo, explained on the Logo page. All logos must be approved by Bisqwit before publication.

In addition, your NES logo must meet these specific requirements:

We will use Mencoder to add the logo.

Note: Unfortunately FCEU/NES runs at a framerate of approximately 60.1 fps. As such, adding the logo via Virtualdub and "append AVI segment" doesn't work (for me at least. If you manage to get that to work let me know how).

We will now be making several "Batch" files. These files consist of command line expressions that are run from a file, all at once. The file extension is BAT.

Place your logo in the Mencoder folder and name it logoNES.avi (filenames of course can be changed, just remember to change them in the batch files as well). Copy and paste the following into notepad and name it mix.bat.

start /wait mencoder.exe -priority idle -oac copy -mc 0 -ovc lavc -lavcopts vcodec=ffv1:vstrict=-2 -o mixed.avi logoNES.avi recorded.avi

Then go to the Mencoder folder and double click the batch file to execute the commands within it.

Note: This uses a different lossless codec for the AVI and results it a very large file. Unfortunately, this pass and the next audio pass will be about 1 GB in size, which could be a problem if you are short on hard drive space.

It could be kept at a reasonable size by using h264 with the following command:

start /wait mencoder.exe -priority idle -oac copy -mc 0 -ovc x264 -x264encopts qp=0 -o mixed.avi logoNES.avi recorded.avi

However, this can result in some nasty video artifacts. (If you find a way to use h264 for the mix without video artifacts, please let me know.)

Run the resulting batch file. This process should take a few minutes - it runs at about 180-240 fps on average on my 3.4 ghz processor.

Audio compression

We will compress the audio using Lame via Mencoder.

start /wait mencoder.exe -priority idle -oac mp3lame -mc 0 -lameopts preset=40:aq=0:mode=3 -ovc copy -o mixed-a.avi mixed.avi

Important things to know:

Video compression using h264 multi-pass

(Add brief explaination of multi-pass encoding here)

The first pass:

Copy and paste this into a batch file and run it.

start /wait mencoder.exe -priority idle -vf decimate=30:0:0:1 -aspect 4:3 -oac copy -mc 0 -ovc x264 -x264encopts pass=1 -o Video-comp-1stpass.avi mixed-a.avi -sub test0.sub -subfont-text-scale 4 -sub-bg-alpha 15 -font ./mplayer/subfont.ttf

Important things to know:

Video Compression - Selecting Nth pass Settings

This is by far the most time consuming part of the encoding process. We will run the second pass with all the advanced/slow encoding settings, and we will have to do some trial and error to select an appropriate bitrate and other settings.

This is the basic command line for the second, third, and all remaining passes:

start /wait mencoder.exe -aspect 4:3 -vf decimate=30:0:0:1 -priority idle -oac copy -mc 0 -ovc x264 -x264encopts bitrate=250:pass=3:frameref=15:qcomp=1:ratetol=100:me=3:me_range=32:subq=7:8x8dct:mixed_refs:fast_pskip=no -o Video-comp.avi Video-comp-1stpass.avi -sub test0.sub -subfont-text-scale 4 -sub-bg-alpha 15 -font ./mplayer/subfont.ttf

This is probably confusing to someone unfamiliar with Mencoder commands. Here is a brief explanation of settings that need to be considered:

Things that might look odd:

Content dependent variations:

Selecting a bitrate

The bitrate is the most important decision you have to make, and it unfortunately does not have a "one size fits all" type of solution. This is where is good encoder has to use his or her own experience to decide on a good encode. At first, it is mostly trial and error, but after some experience, an encoder can use knowledge of previous encodes to help with the decision. For example - "This movie is very similar to Super Mario Bros. 2 (USA) which used a 170 bitrate, so I will try that first". Also, save the batch file you used for any published movie you encode, as well as the subtitle file. Often, movies get obsoleted, and you will already have all the settings you need for a new AVI when that time comes.

A good bitrate for NES games is generally somewhere between 175 to 275. Simpler games such as A Boy and his Blob can be as low as 120. Games with hardly any motion such as Déjà Vu can be as low as 60!

Here are some published movies and the bitrates I used to encode them:

Making samples

Since trial and error can get time consuming, it is a good idea to crop a short sample of the AVI and then try many bitrates on it.

Make a batch file with these commands:

start /wait mencoder.exe -priority idle -oac copy -ovc copy -ss 59 -endpos 00:01:00 -o Video-samp.avi mixed-a.avi

start /wait mencoder.exe -aspect 4:3 -vf decimate=20:0:0:1 -priority idle -oac copy -mc 0 -ovc x264 -x264encopts bitrate=220:pass=3:frameref=15:qcomp=1:ratetol=100:me=3:me_range=40:subq=7:4x4mv:mixed_refs -o Video-samp220.avi Video-samp.avi -sub test0.sub -subfont-text-scale 4 -sub-bg-alpha 15 -font ./mplayer/subfont.ttf

start /wait mencoder.exe -aspect 4:3 -vf decimate=20:0:0:1 -priority idle -oac copy -mc 0 -ovc x264 -x264encopts bitrate=200:pass=3:frameref=15:qcomp=1:ratetol=100:me=3:me_range=40:subq=7:4x4mv:mixed_refs -o Video-samp200.avi Video-samp.avi -sub test0.sub -subfont-text-scale 4 -sub-bg-alpha 15 -font ./mplayer/subfont.ttf

start /wait mencoder.exe -aspect 4:3 -vf decimate=20:0:0:1 -priority idle -oac copy -mc 0 -ovc x264 -x264encopts bitrate=180:pass=3:frameref=15:qcomp=1:ratetol=100:me=3:me_range=40:subq=7:4x4mv:mixed_refs -o Video-samp180.avi Video-samp.avi -sub test0.sub -subfont-text-scale 4 -sub-bg-alpha 15 -font ./mplayer/subfont.ttf

start /wait mencoder.exe -aspect 4:3 -vf decimate=20:0:0:1 -priority idle -oac copy -mc 0 -ovc x264 -x264encopts bitrate=160:pass=3:frameref=15:qcomp=1:ratetol=100:me=3:me_range=40:subq=7:4x4mv:mixed_refs -o Video-samp160.avi Video-samp.avi -sub test0.sub -subfont-text-scale 4 -sub-bg-alpha 15 -font ./mplayer/subfont.ttf

This will cut a 1 minute segment out of the 1st pass AVI, and then run passes with various bitrates common for NES encodes. After running this batch file, watch Video-samp.avi. The cropping process often results in some blurring or artifacts in the first few seconds of the sample. You need to be aware of these spots when watching the compressed versions.

Watch each compressed sample and look for the lowest bitrate that is still of acceptable quality. Look for blurriness in the background that suddenly sharpens, or comes "into focus". This is a sign that a higher bitrate is needed. Look for excessive encoding artifacts around the main character. Look for overall blurriness. If there is a published AVI of this game, watch it and compare to your encode.

If the lowest bitrate sample looks lossless, you may want to try using an even lower bitrate. Similarly, if the highest still is too blurry or smeared, select a higher bitrate. If needed, run another set of samples with different values until you find an acceptable rate.

If this 1 minute clip looks good then the full AVI will likely look good as well. Of course, this is not guaranteed since later parts may have significantly different graphics and/or motion than the sample segment that was used for comparison.

Once you have the bitrate selected, plug it into your N-th pass batch file. Make any other needed setting changes as explained above, and then run the batch.

Running a third or fourth pass.

If the AVI created looks really good in some spots and really bad in others, it could benefit from a third pass. Simply run the N-th pass batch file again with the same settings. If you think the bitrate is too high or too low, you can change it slightly and run again.

However, if the resulting AVI is just far too blurry or requires significant setting changes, it's a good idea to restart the first pass AND second passes again, instead of trying a third pass.

A third pass (with identical settings) has much less of an effect on the subjective quality of the AVI than the second pass. A fourth pass is likely not going to give any noticeable effect, but in extreme cases might be helpful.

Double checking your AVI

The file size ratio must be good.

The site does not allow (without special permission) a filesize to length ratio greater than 4mb per minute. For NES games, that won't be an issue. Most NES encodes will be between 1 and 2mb/minute. If you used a bitrate under 300, yet your file is larger than this ratio, you should double check your encoding process.

Video quality must be good.

This is subjective, but you want to look for background "refocusing" - where pieces of the background become blurry over time, and suddenly sharpen back into focus. Make sure there is detail in the backgrounds. Look for "streaking" of moving objects - where a moving object (such as the main character) leaves a trail behind him of blurry or different color background. Due to the use of h264, there will be some small artifacts on moving characters, as well as some slight blurriness of text. This is normal and acceptable in small quantities. However, if it is too blurry, then it needs to be encoded again.

Audio quality must be good.

Common audio problems include:

Subtitles must be correct.

Double check that the subtitles have no errors (spelling or otherwise) and that the information is correct. Double-check that the subtitles are placed in a good spot. If you find an error at this stage, unfortunately, all video passes must be redone.

If all of these things check out well, then congratulations, you are finished! If you are a publisher, the next step is to review the PublisherGuidelines. If you are not, then you want to review the AVI file name section of the Publisher Guidelines, name the file appropriately (as a courtesy), then get the file into a publisher's hands.


RSS
EmulatorResources/MakingAVI/FCEU/Windows last edited by FractalFusion on 2008-09-03 08:11:42
Page info and history | Latest diff | List referrers