Sunday 2 March 2014

Capturing and encoding video for SDA - Interlaced

Introduction

If you're new to speedrunning or maybe just looking for ways to improve your own setup, this guide is for you. This part of the guide will focus on capturing interlaced video from Composite and S-Video outputs. If you don't know what those connectors look like then see below:

composite s-video cables
Thanks to makify.com
Every console besides the PlayStation 4 and Xbox One will work with interlaced video so it's really important to get right if you are on a limited budget. The red and white cables carry stereo audio and naturally they can be used with S-Video. If your console supports S-Video, I highly recommend tracking down a set of good S-Video cables as they produce a much better image. Be wary of purchasing cables that have both composite and S-Video attached as the S-Video picture is more than likely to have this really bad checkerboard image.

Before we get to the hardware, I want to talk about a big issue that only speedrunners will face when capturing video... lag. No matter what capture card you have, it will always have a certain degree of lag on the preview window. Depending on the game and the player, you might be able to handle the lag no problem. If you can't then we get on to the subject of splitting the signal to your TV and capture card simultaneously. I'll let the SDA Knowledge Base explain this.

Capture cards

Now we can discuss capture hardware. This guide will primarily be aimed at virtually any capture card that has DirectShow drivers (this includes the EzCAP, Dazzle DVC 100 and the AVerMedia C027/H727). If you don't have a capture card then you may want to look at the EzCAP or Dazzle as a good starting point (both USB based).

EzCAP on Amazon.com
Dazzle DVC 100 on Amazon.com

The Dazzle link is technically for the DVC 101 but it has the same purpose. The prices on Amazon for the Dazzle are very expensive for just an SD capture device so you might want to go for the EzCAP or pay a little bit extra and get the AVerMedia card (obviously Desktop only).

Before you insert your capture card you should install the drivers. You can get the EZCAP ones here and the Dazzle here. I guess it's time to mention this will be for Windows only... sorry Mac/Linux.

Software and codec installation

Let's take care of the software now. Download the latest SDA encoding program version from here: https://forum.speeddemosarchive.com/post/yua3.htmlIt's a simple executable file so requires no installation once extracted.

Now let's go grab our video codec (just download the latest build): x264vfw. Just follow the simple installer instructions.

Next we have the capture program. I've moved completely over to AmaRecTV as it's much easier to use than VirtualDub. The latest version is 3.10. You can get it here. I've also mirrored it to my Google Drive here.

Just extract the folder to your desktop and we're done with software installation.

Configuration of AmaRecTV

Open the amarectv folder and run AmaRecTV.exe file. You will be greeted with a popup box on your first startup. Just click OK. First go to the General tab.

Click to enlarge all screenshots
Here you can configure where the file is stored and change the name.

Now go to the Graph 1(Device) tab and configure it as shown below (I'm using the AVerMedia as an example).


If you are in the USA then always choose "*w= 720, h= 480, fps=29.97,  fcc=YUY2, bit=16". This tells AmaRecTV to capture a 720x480 video at 29.97 fps in the YUY2 colorspace. This setting will work for old retro consoles and also newer consoles. If you are in a PAL region with a PAL console then you want to choose "*w= 720, h= 576, fps=25.00,  fcc=YUY2, bit=16".

For audio always choose "*sample= 48000, bit=16, ch= 2". This will record video at 48,000 Hz which is the best you can realistically do. If for some reason you do not have this then choose 44100 but do not go below this.

At the Graph 2(Preview) tab don't forget to choose Not use under Deinterlacing.


Once you get more experienced with capturing video you may want to configure settings in Preview (particularly useful for live streaming) but for offline capture we will not cover it here.

You can skip over to the Recording tab now.


Under Video Compressor, select Other Codec then click the Update Codec List button. Select x264vfw and then click Setting.

Configure x264vfw as shown below then click OK.


I've went with CRF 14 as a great starting point (you can lower it to something like 12 if you want better quality). Bear in mind though that CRF 16 is pretty much lossless quality to the human eye. If you really want lossless, you can configure it in the drop down box under Rate control (the lossless setting is still better than Lagarith). Bear in mind that this configuration favors compression over editing capability. I'd do some test captures and see if you can live with the slow frame seeking. If it's a problem you can add --keyint 10 to the "Extra command line" box. This will improve frame seeking but at the cost of some compression.

Now go to the Advanced tab.


The only area we are concerned about is Record Setting. I always uncheck Use Null frame as it has no use from what I have seen. If you have a one hard drive setup, you might want to look at increasing the Buff Size from 128 to something like 256 or even 512. This should drastically decrease the chance of dropped frames. Now just click Apply and OK.

You should now be greeted with your console on the screen. Don't worry if it has lots of these weird lines going on the picture, this is what interlacing is and we will fix it with Yua. If the video is in black and white then you might want to change the capture filter. Press c to bring up the configuration box and click Graph1(Device). Click the Device Setting button and change the video standard to NTSC_433. You can also set the video standard to one of the many PAL options if needed. I have ordered an official EzCAP many years ago that would not give me a color picture regardless of what I did so be wary of that.

Up at the top left you can press the red play button to record (default shortcut is Ctrl+Z) and your video will be saved to the hard drive at the location and filename you specified in the General tab. You stop the recording the same way (starting and ending the recording will be confirmed with a beep from AmaRecTV). You can change the recording key in the Hotkey tab if you want. As stated earlier, if you need to get back to the configuration page for any reason, just press c.

Encoding with yua

We will now convert our x264vfw AVI source file to MP4 with x264 video and AAC audio to be submittable for SDA. The easiest way is to use yua which was downloaded earlier.

Load up yua and you will see something similar to this:


Click and drag your captured video into the program and yua will begin to examine it. This may take seconds or minutes depending on the length of the video.

You now need to refer here for the game you decided to run: https://kb.speeddemosarchive.com/DF

For an example, if your source video is Super Mario 64, this is D4 F2 and 3D according to the above page. Set this up in yua as shown below. If your game is not listed post a quick sample of the source file here and it will be identified for you: https://forum.speeddemosarchive.com/post/whatre_the_d_f_and_fdp_for_this_game.html


If you do have a D4 game (basically retro consoles like SNES/NES) you will need to choose from 5 boxes.

1-pixel shift
alternate 1-pixel shift
no change
de-deflicker
alternate de-deflicker

Scroll through the video and choose the one that looks more natural and not as "jumpy". If in doubt ask on the forum with a small sample source file for someone to tell you what to use. I can tell you it will most likely be no change.

Below are notes on each section of yua for your understanding.

Input type

This will always be interlaced when using composite or s-video (as we are now).

Field dominance

In 99% of cases this will always be top field first. I've only really seen some DVD recorders use bottom field.

Aspect ratio

If it is an older system this will most likely always be standard. If you are capturing from a newer console such as a PS3 then this might be widescreen.

Dimensions, Framerate, Decimation

This was discussed earlier.

Misc

Self explanatory.

Output

You will need to encode the qualities that yua indicates (LQ, MQ, HQ).

StatID

This is the "logo" at the start of the video which indicates runner name, game and time. Look at other SDA encodes for examples.

Output folder/filename

You can set where yua will save the encoded videos and give it a filename.

Post the quality test

Refer to here when creating a quality test thread: http://forum.speeddemosarchive.com/post/how_to_post_a_video_quality_test..html

It should pass easily under a post from either nate or ballofsnow.

When it passes you can now record the speedrun in full confidence and achieve the SDA quality standards.

No comments:

Post a Comment