Tuesday, February 14, 2017

Encoding SNES movies - Tutorial

This text is a quick and dirty tutorial to encode high quality videos from SNES emulators. Very suitable for unofficial tool-assisted speedruns movies. If you wanna know the completely right way, you must follow this guide. This tutorial presupposes that the user is using the Windows OS and that the game is the NTSC (american or japanese, but not european) version, with a constant native resolution of 256x224 pixels (or 512x448). Some obscure games might vary that.

Software
Emulator(s): BizHawk, lsnes or Snes9x-rr.

Lossless codec: install Camstudio, otherwise the dumped video will be have a huge size. This will place a dll file in your system that programs can use to encode and decode videos.

Scripting video editor: install Avisynth. Like in the previous installation, no executable is added to My Programs.

Encoding package: download and extract this archive. I (Amaraticando) used the original package from TASVideos, removed a bunch of stuff and tweaked it for SMW. If you don't trust the Mega link, download the original one.

Video Dumping

BizHawk
ResolutionSound
256x22444.1KHz stereo
Select Speed/Skip to 0 (never skip)
You can turn off the sound in Config -> Sound if you don't want to hear it while dumping. It won't affect the dump's audio.
Open the ROM.
Pause emulation. (Pause key)
Load the movie.
Select File -> AVI/WAV -> Record AVI.
Choose a file name (such as movie.avi), and choose a lossless RGB codec of your choice (Camstudio recommended). Click OK.
Unpause emulation. At this point, audio and video are now being captured.
When you reach the desired end point, select File -> AVI/WAV -> Stop AVI.

lsnes
ResolutionSound
256x224/512x44844.1 KHz stereo
Open the emulator, load the ROM.
Select load movie/savestate tab, select the movie, check start paused and hit ok.
Set avi-soundrate to 5 (settings, advanced tab, or 'set-setting avi-soundrate 5')
Select AVI capture (Camstudio / PCM) from capture menu.
Set speed to turbo (or other desired speed).
If you want to, you can mute audio by unchecking Config->Sounds enabled. This won't affect dumped audio.
Unpause the emulator
When reaching the end, select end avi dump.
Snes9x-rr
ResolutionSound
256x224 (NTSC)48KHz stereo[1]
Note: This applies to v1.43 v17 and most revisions of v1.51. Earlier versions of v1.43 have a different menu layout.
Select Config -> Speed -> Frame skip -> skip 0.
Select Config -> Sound -> Playback rate -> 48KHz.
Select Config -> Video -> Display Configuration... and make sure that "Bi-Linear Mode 7" is checked.
Load the ROM.
Set speed to about 400% (= key or Config -> Speed -> Set Speed).
Pause emulation (Pause key).
Load the movie file, with Sync Sound checked (it increases sound resolution).
Select File -> Audio/Video Recording -> Start AVI Recording. Choose a file name (such as movie.avi), and choose a lossless RGB codec of your choice (Camstudio recommended). Click OK.
Unpause emulation. You are now capturing audio/video.
When you reach the desired end point, select File -> Audio/Video Recording -> Stop AVI Recording.


Video Encoding
Navigate to the encoding package folder. There's a readme inside. You must place the raw AVI that you just dumped inside the folder (like in the picture below). If there's any SOX audio, put it too (optional). The names must be exactly movie.avi and audio.sox .

Next, double click on global.bat. This will open a prompt and execute the batch.
If the prompt doesn't appear, hold Shift and right click on the folder. The context that appears will have a Open command window here. Inside the prompt, type global.bat and enter.

The prompt will give you some options and maybe some error if something went wrong.
You will have to type the size of the encode and the crf quality (the lower the better, but takes more time and disk space). After everything is done, the encode will be on folder output. For safety, remove the mkv file from this folder when you finish.