Showing posts with label sda. Show all posts
Showing posts with label sda. Show all posts

Friday, 11 July 2014

Capturing and encoding video for SDA - Progressive

Introduction

If you found interlaced capture a pain to deal with, you might want to look at progressive video. With progressive video you don't need to deinterlace and you can also look into capturing HD content. Progressive output also gives us access to the highest quality connections available, Component and HDMI.

If your console has both Component and HDMI output, it is advised to go with HDMI since it is a digital signal. Although Component is very high quality, it is still an analog signal.

You may be wondering what consoles actually output progressive video. The answer is well... pretty much all of them (yes even retro consoles). That's a whole other blog post though. For now I will focus on the current gen (PS4 etc) and last gen consoles as these are far easier to explain and capture from.

What capture card should I buy? What will this guide cover?

This is a tough one to answer when we are talking about progressive video. Since we don't have to deinterlace video, any capture card with Component or HDMI input will work well. Even the hardware encoders that capture video as YV12 are perfectly fine (Elgato, AVermedia LGP). However, I will only focus on DirectShow cards for this guide as the hardware encoders are usually only accessible with certain software. DirectShow cards with progressive inputs are almost always internal. Some examples are the Blackmagic Intensity Pro, AVerMedia C027 and the PEXHDCAP.

Like the interlaced guide, this will cover everything from software installation to final encoding. The only real progressive resolutions you will encounter is 480p and 720p. I will cover configurations of both. 480p is pretty much the Wii and 720p is for the PS3/360 and PS4/Xbox One.

Software and codec installation

Just in case you need links, below is what will be used.

Encoding program: Yua
Codec: x264vfw
Capture: AmaRecTV

If you read my interlaced guide, you will notice I have changed the codec from Lagarith. It's unlikely that people are willing to use Lagarith to capture runs in 720p. The data rate and storage requirements can also be huge (especially in a long run). x264vfw has far superior compression and less CPU load when dealing with higher resolutions.

You are more than welcome to use Lagarith to capture your runs (just make sure your computer can handle it).

AmaRecTV Configuration

To get to the configuration area, you can press c on your keyboard or right click > Config. Look at each setting and configure as shown. You can click each screenshot for a larger look.

The general tab is first. Nothing special. You can configure the path of where the captured file will be stored and the file name. You can also have the folder open once a recording stops to quickly check it. Configure other options at your discretion (basically do what you want this this tab).


Graph 1 (Device) is where you will configure the device and resolution. Select your capture card and the corresponding audio device. I've shown the AVerMedia C027 configuration as an example.


For 480p you want to select "w= 720, h= 480, fps=59.94,  fcc=YUY2, bit=16"

For 720p, select "w=1280, h= 720, fps=59.94,  fcc=YUY2, bit=16"

Please note that the fcc may change depending on what capture card you have. For example, if you have a Blackmagic card it will read UYVY for 480p and HDYC for 720p.

Graph 2(Preview) requires no real configuration. Just ensure deinterlacing is set to "Not use".


You can pretty much skip all the way to the Recording tab now. Set Video File Setting to 999 fps (just do it). AmaRec will record at the frame rate you set in the Device tab. Make sure Audio Compressor is set to "Uncompress". For Video Decompressor, click the Other Codec radio button and then the Update Codec List button. Scroll down till you see x264vfw (see below screenshot) and then click the Setting button.



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.

That's pretty much it. Now just click Apply and if everything went good, your console should show up in the preview window. To record just hit the Play button near the top left and stop the recording with the same button (both indicated by sound and the bottom left corner of the program). I should also mention you can configure these under the Hotkeys tab (default is Ctrl+Z). You can also mute the playback of sound by clicking the music note (don't worry the captured file will still have audio).

Once you do a recording, import it into Yua for encoding.

Yua encoding

I'll explain the settings briefly.

Input type: Progressive. ;)

Aspect ratio: If you were working with a 480p source, this can either be Standard (4:3) or Widescreen (16:9). Some Wii games will utilize 16:9 but if it's a Virtual Console game it's going to be 4:3. 720p is always going to be 16:9.

Dimensions: Pretty much always D1. In some cases like the Virtual Console, you can elect to encode at D4 to keep file sizes lower.

Framerate and Decimation: If you are unsure what to pick, post a quick sample in this thread.

Output: Tick all required for submission. You can also elect to encode XQ but very few sources will need it.

The Change button will encode to a folder of your choosing (I have Desktop selected) and the box is to label the file name.

Once this is done you can edit the video to include only parts you want. You can do this by going to Trim. Once this is all done, just click File > Encode and go grab your favourite beverage.

It is definitely worth doing a test recording and creating sample encodes (like 30 seconds in length) to post on the forum as a quality test before you do the real run. Better to be safe than sorry.

Friday, 20 June 2014

Elgato Game Capture HD Review


Elgato Game Capture HD Review
Elgato Game Capture HD - Image courtesy of Amazon.com

A big thank you to Elgato for supplying me with a review unit.

I've always used DirectShow capture cards, so I was really not sure what to expect from this device. First, let's talk about the contents:

1. The unit itself
2. USB cable
3. PS3 Component cable
4. Component breakout cable (the same one that is bundled with the StarTech PEXHDCAP if you are wondering)
5. HDMI cable

The PS3 Component cable is a nice addition. This stops you having to buy official Sony cables. The breakout cable will allow you to connect any Component system to the Elgato. You can also attach Composite to the red connector but I'd highly recommend moving to S-Video for retro systems. In order to capture from S-Video, you will need to purchase the Analog Video Adapter from the Elgato Store.

One of the best features of this card is the lag less pass through when using Component to HDMI. I am able to input my Wii at 480p Component and output 480p over HDMI without lag. This stops the need of having to buy Component to HDMI converters or messing around with those Wii2HDMI adapters. You can also power the Elgato from any USB port (on a TV for example) so it's also a great option if you just want a Component to HDMI converter. If I did have to make one criticism of this, it would be the lack of a dedicated Component adapter for the Wii like the PS3 has. This is probably superfluous to requirements due to the Wii U but users who don't want to spend money on buying a new console might feel a tad annoyed.

I downloaded the latest drivers from Elgato's website (as of writing 1.42.23) and connected the unit to a USB port. That was pretty much all the setup process entailed. I was really skeptical about how well a YV12 4:2:0 encoder would match up to what I had been using. My previous capture setup involved 4:2:2 Lossless capture via Lagarith or UT Video.

While configuring the device for 720p capture, I noticed something interesting. If you have the "Preserve Source Format" option ticked, you can happily record a maximum 26.3 Mbps at 59.94 fps. However, untick this option and you are left with a maximum 15.0 Mbps at 29.97 fps. I am all for being able to record at 29.97 (let's face it most of the games on PS3 and 360 are all 29.97 anyway). I don't see the reason for substantially lowering the bit rate though. They should keep the 26.3 Mbps option for 29.97 fps content. Let me explain why this would be a good idea.

Here is a raw BMP file with 59.94 fps: Click
Here is one with 29.97 fps: Click

As you can see the 59.94 capture is clearly better. The 29.97 is much more "blocky" (especially the bottom left side of the tree leaves). If they allowed you to allocate 26.3 Mbps for 29.97 content, it would look even better than the 59.94 video since the bit rate isn't being allocated over as many frames.

The 1080p capture option is very nice. A 1080p 59.94 source is recorded at 29.97 with 30.0 Mbps. I forgot how great 1080p video looks on my TV as it's always been at 720p. Since the Elgato can be pushed to 30.0 Mbps, the user should be able to select the maximum 30.0 Mbps for at least 720p. Even 480p is limited to 15.0 Mbps. I would like to see that lifted to 20.0 Mbps so a consistently high quality file can be captured even in very high motion game play. Regardless of capture bit rates, it is nice to see that the Elgato correctly captures HD colours (Rec. 709). The device also properly handles 16-235 and 0-255 video which very few DirectShow capture cards actually do.

In comparing the capture quality to something like the Blackmagic Intensity Pro (HDYC UT Video Lossless), you can see some very slight degradation in quality with the Elgato but it's hardly anything to complain about (since the bit rates are substantially less).

Blackmagic BMP: Click
Elgato 26.3 Mbps BMP: Click

I am more than happy with the capture quality of the encoder but as said above, I'd like to see the bit rates slightly increased.

Now let's talk about interlaced content. I connected up my SNES and was told that the capture would be 720x480i at 59.94. This is completely wrong. It should be 720x480i at 29.97 (weaved capture). If you untick the "Preserve Source Format" option, the software will capture a deinterlaced 640x480 image at 29.97. This is also wrong as then you would be losing half the frames (old systems are actually 60 fps). I can see why they probably did this though. Most people won't care as it's only if you would be submitting a run to SDA would you ever need the full 60 fps. If you want to use this device with interlaced content/retro games for SDA, you should look elsewhere. Don't get me wrong, it still works with 240p material, just other devices handle it better.

If the above issue does get fixed, there is also another problem with Composite and S-Video in the black levels. The capture filter for the Elgato looks to only support the basic "NTSC_M" (USA at 7.5 IRE). This is a problem because many retro consoles such as the US SNES are just basically Super Famicom (NTSC-J) consoles. This is why you can play Super Famicom games in a US SNES. Since these are NTSC-J consoles, they also output the black level at NTSC-J standard (0 IRE). This could be fixed by giving an option to choose between 0 and 7.5 IRE when the user selects Composite or S-Video (put it in place where the user selects between Standard and Expanded for HDMI).

The last thing to talk about is live streaming. Since the Elgato has native XSplit and OBS support. it's easy to set up and get going. Due to the preview delay, I had to delay the microphone to match the game. I got it to sync up with my microphone at a setting of 1400ms. This seems like the standard to use from videos and tutorials I watched.

Everything works well with the live streaming. However, speedrunners have extra issues to contend with. Ideally we want to capture a high quality local recording and live stream at the same time. There is currently no way to do this with the Elgato. The only workaround would be to local record in the Elgato software and then screen capture the preview window inside XSplit or OBS. That's not exactly a good solution, especially if screen real estate is a problem. I would really like a way for the Elgato to work similarly to AmaRec's Live feature where you take a DirectShow source that can then be added to as many applications as you want while still being able to record in the software itself.

Showing timers/splits on stream is also another problem. Not only will you have to sync up a microphone, but you also have to delay the timer in WSplit (or similar program). If you are curious how to do this then right click and go to Configure in WSplit. For start delay input something along the lines of 1.4 (aka 1400ms to make it the same as the microphone delay). A big thanks to SDA user Vid3odrome for the solution to timing splits and the Elgato together.

There is also a slight issue with editing the files. The .ts files can be imported into programs such as Sony Vegas but they have no sound. The included MP4 converter fixes this and won't touch the quality. However, I noticed a peculiar issue with the frame rate detection in Sony Vegas. It is detected as 59.908 fps (this should be 59.940). This isn't a big problem but I would definitely like Elgato to check this one out in case video/audio sync becomes a problem for very long recordings. I also tried other Elgato MP4 recordings and they also seem to slightly deviate from the standard 59.94 detection in Sony Vegas. I should also note that if you are using SDA's encoding program (Yua) then you only want to feed it the MP4 files as even the frame rate of the progressive .ts files are not being properly encoded.

I also discovered what I can only assume is a bug. The HDMI pass through can be toggled between Standard (16-235) and Full (0-255) in the Elgato software. However, it always defaults to Full on power up. This can be fixed by opening the software but the problem is if you close the software, the pass through goes back to 0-255. The only way to keep the pass through in 16-235 mode is to keep the software open. I hope Elgato can fix this to where the software "remembers" the 16-235 choice on exit or even when it is powered up.

That's pretty much everything I have to say on this capture card. Even with the issues I mentioned, it's a really stunning unit. Highly recommended if you want to use progressive content and hopefully the points I raised can be fixed in a future software update.

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.