Gens Re-Recording

From Sega Retro

Video game console emulator

Gens Re-Recording
System(s): Sega Mega Drive, Mega-CD, 32X
OS: Windows, Linux
Developer: Stéphane Dallongeville (Gens); Jyzero, Nitsuja, Upthorn
Programmed in: Assembly, C++
Last release date: (10 years ago)
Last version: 11c SVN prerelease

Gens Re-Recording, formerly known as Gens Movie Test, is a modified version of the Sega Mega Drive emulator Gens by Stéphane Dallongeville. It was developed by Jyzero, Nitsuja, and Upthorn and is based upon the Gens version 2.12 source code. The modification includes slowdown, recording and playback of controller input logs, dumping of AVI files, and Lua scripting. This emulator is primarily used by the TASVideos community.

Creating DVD-compliant video from emulator output on Windows

It is easily possible to create 100% DVD compliant video from the 320x240 Gens Movie Test raw emulator output. This requires Avisynth, the MPEG-2 encoder of your choice - a recommendation is TMPGEnc (but any MPEG-2 encoder can be used as long as it properly supports interlaced video) and AC3Machine (using BeSweet as it's AC3 encoder). This can also require lots of hard drive space depending on the length of the movie. NTSC video is dealt with primarily in this guide, but can be easily modified to generate PAL instead, although I haven't done so myself.

Generating the raw AVI

First of all, load Gens Movie Test and load a ROM. Next, press ESC to pause the emulator. Go to the following menu items and select them:

  • Graphic -> Sync AVI with movie
  • Graphic -> Add sound to AVI
  • Graphic -> Start AVI Dump
  • Graphic -> Frame Skip -> 0
  • CPU -> Play Movie/Resume record from savestate
  • (optional) Option -> Misc... enable Show frame counter, Show input, and choose a position (lower-right is recommended)

In the dialog that appears, browse to find the GMV file that is desired to be used as the source, and ensure that Play from start is selected. Press OK. Whenever ready to begin dumping the AVI, press ESC once more, and choose a lossless codec (Camstudio Lossless Codec in GZIP compression at level 9 is recommended, but a codec like Huffyuv will work just as well). When the movie is finished playing back, select Graphic -> Stop AVI Dump and exit the emulator.

Conforming the raw AVI to NTSC DVD specs

At this point there will likely have multiple AVIs that are around 1GB apiece. Use the following script (place it in the same folder as your raw AVIs and give it the same name but with an AVS extension):

AVISource("gens.avi")+AVISource("gensA.avi")+AVISource("gensB.avi") # make sure you put all your AVIs here in order
Crop(1,0,0,0) # remove garbage pixel on left
#PointResize(638,240) # this is for 'perfect' video
BilinearResize(638,240) # this is for video that looks closer to a real RGB output
AddBorders(42,0,40,0) # pad to 720x240
Weave() # weave fields into 720x480 frames
AssumeFPS(29.97,true) # adjust framerate from 30fps to 29.97fps for NTSC
ResampleAudio(48000) # fix the audio sample rate from the framerate modification

To visually inspect the output of this script, VirtualDubMod can be used, although video won't have to be rendered with it if TMPGEnc is being used to encode the video. The video should be seen to be in a 720x480 aspect ratio, that exhibits 'mice teeth', and depending on which resize method you used, video that looks slightly soft in the horizontal direction.

Encoding to MPEG-2 with TMPGEnc

This guide assumes that TMPGEnc is being used, which can directly accept AVS files for input. If using a MPEG-2 encoder that does not, then VirtualDubMod will have to be used to render the AVS script to another AVI file, which should also be lossless. The general settings for the MPEG-2 encoding should be applicable to other encoders, however. In TMPGEnc, it is recommended to not use the wizard mode, and instead, finetune the encoding parameters yourself. First of all, in assuming the best quality is desired, use Constant Bit Rate of 8000kbps for the video, unless the video is longer than an hour or so. You'll be using LPCM in TMPGEnc, which will be encoded to AC3 later.

Video tab:

  • File -> New Project
  • Load the AVS with Video source at the bottom of the window
  • Choose ES (Video+Audio)
  • Press Setting
  • Stream type -> MPEG-2 Video
  • Size -> 720x480
  • Aspect Ratio -> 4:3 Display
  • Frame Rate -> 29.97 fps
  • Rate control mode -> Constant bitrate (CBR)
  • Bitrate -> 8000 kbits/sec
  • Encode mode -> Interlace
  • DC component precision -> 10 bits
  • Motion search precision -> Motion estimate search (fast)

Advanced tab:

  • Video source type -> Interlace
  • Field order -> Bottom field first (field B)
  • Source aspect ratio -> 4:3 525 line (NTSC)
  • all other options on this tab disabled

GOP Structure tab:

  • Number of I picture in GOP -> 1
  • Number of P picture in GOP -> 17
  • Number of B picture in GOP -> 0
  • Output interval of sequence header -> 1
  • MAX number of frames in a GOP -> 18
  • Detect Scene Change

Audio tab:

  • Stream type -> LPCM
  • Sampling frequency -> 48000 Hz
  • Channel mode -> Stereo

Press OK. Go to Output file name, press Browse, and choose a filename for the encoded output (it will automatically generate both .m2v and .wav files with that name). Press Start at the top and go out for a meal, because it will take a good while to encode.

Encoding the audio to AC3

All players will support both LPCM and AC3 audio, but LPCM is also much larger. Instead, we will be making a 448kbps AC3 file. Load AC3 machine, select your input .wav file and and output .ac3 file.

  • Channels Mode -> stereo
  • Auto Find Maximum Gain
  • Set delay to 0 msecs
  • Bitrate -> 448

Now press Give me AC3! and wait a little bit (this will take far less than the video encoding did). Once it's done, there should be both an .m2v and .ac3 file.

Authoring the DVD

This is the part where it really doesn't matter so much what DVD authoring tool you use, TMPGEnc DVD Author is recommended but as long as it accepts m2v and ac3 input then it's good to go, and menus can be set up as desired.


Download.svg Download Gens Re-Recording
File: GensRR v11c svn.7z (905 kB) (info)
Current version: 11c SVN prerelease

Old Versions

External links