Showing posts with label guide. Show all posts
Showing posts with label guide. Show all posts

Sunday, 22 February 2015

Guide: Live stream and capture simultaneously

So why would you want to do this? Usually people live stream to services such as Twitch but also want to keep a local recorded file to submit to SDA or just to have a higher quality file for YouTube. Without a proper setup it can be tough to properly coordinate. The ultimate goal of this guide is to produce local raw video at SDA standard while being able to live stream to our viewers. I'll only be focusing on DirectShow cards since it's easier to manage. I'll try and cover Elgato and similar hardware encoding devices at a later date.

I assume you have followed one of my previous guides depending on your situation.

Interlaced guide. Mainly for retro consoles and uses composite or S-Video.

Progressive guide. Mainly for newer consoles with Component or HDMI output. Xbox, PS3 or similar.

What makes this process so much easier is AmaRecTV. Basically, AmaRec has a live plugin that outputs your video as another DirectShow source. This is a complete life saver because typically a DirectShow device can only be used by one program at a time. AmaRec takes control of your "real" capture card feed and simultaneously outputs another "capture card" that you can feed into your streaming program (XSplit or OBS). Let's get on to the config!

In your AmaRec folder you should have an exe called live_setup300.exe (might slightly differ based on your version). Please note that the latest 3.10 is bundled with 3.00 of the live setup. Run that exe and you should see this. All pictures can be clicked to enlarge the image.


Just click the forward arrow more times and it should install without problems. Now open up AmaRecTV and go to the Graph3(Live) tab. We should now see something like this.


Click the Live Enable box and then you can configure the resolution and frame rate that you want to send to your streaming program. Resolution should match what you set in the device tab (usually 720x480 for SD). Regardless of whether you are handling interlaced or progressive content, the frame rate should always be 60. Below is an example. I am using a PS3 set to 720p. I input 1280 720 and select 60.

Note: I have noticed that you can get slightly less CPU load if you use a lower resolution (for example down scaling 720p to 480p) but it's probably not worth it.


That's us pretty much set for progressive video but we need to do some more steps for interlaced video. We need to do these steps because we want to supply a nice deinterlaced image to our viewers on stream. Go to the Graph 2(Preview) tab and enable "Top field first" and "for Retro Game" (as shown below).


This is an acceptable configuration for most all retro games. However, there is a table on the AmaRec blog about what mode you should use based on the console and resolution.


I should also note that you might want to consider selecting 4:3 in the Aspect Ratio but this is personal preference based on your source (this is only if you are dealing with SD sources).

Next, go to the Recording tab and just make sure Filter Processing is set to Off. We do not want our source file to be deinterlaced as we will do this in Yua. It also means that even if you chose the wrong deinterlacing method under Preview, your source video will still be fine. Apply these settings then press OK. Your preview window in AmaRec should now be deinterlaced.

Now we want to open our streaming program. I'm sure most of you can figure this out. I'll quickly go over XSplit first.

Go to File > Add Camera > AmaRec Video Capture. You should now see something like this:


Don't worry the writing at the bottom left will go away after 5 seconds or so. It's just to notify you of the resolution and frame rate chosen. XSplit v2.0 added a feature where you can assign an audio source to a DirectShow device. I still use v1.3 for various reasons so no screenshot here unfortunately. Just right click AmaRec Video Capture and I'm sure you can find your way to adding the audio source called "AmaRec Audio Capture" and assign it. You can also elect to play it through the speakers or just to the stream.

Now let's look at OBS.

Add your scene and then right click in the Sources window and go to Add > Video Capture Device and give it a name. Like XSplit, we just add AmaRec Video Capture and AmaRec Audio Capture. I'm also a big fan of making sure you tell OBS the resolution and frame rate via Custom Resolution. A friend of mine once didn't do this and AmaRec kept popping up with "frame rate of the video capture card does not suit a preset value. Neither recording nor a live function functions normally".


Like XSplit, you can elect to play it through speakers or just to the stream.


That's pretty much it. Now just stream at whatever settings you want and use AmaRec as you normally would. Obviously keep in mind that you are now recording and streaming so your computer might not be up to the task. Make sure you do some trial runs before doing serious attempts and you aren't dropping frames etc.

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.