Equipment for capturing video
Anyone who captures/streams from old (home) computers or even new computers has a certain setup realized.
My dedicated capture PC:
CPU
|
i7 3930K Sandy Bridge E with 6 cores + HT at 4.3 GHz
|
Mainboard
|
Gigabyte X79-UD5 with 40 GB DDR3 RAM
|
Graphics Card
|
Gainward GTX780 GLH Phantom
|
Video Capture
|
Pinnacle PCTV-SAT - BT878 based analog video card (PCI)
Epiphan VGA2PCIe
Epiphan DVI2PCIe with A/V-Kit
|
Audio Capture
|
Soundblaster Recon3D
Soundblaster X-Fi Surround 5.1 Pro USB
|
Webcam
|
2x Logitech C920 Webcam
|
Capture from VGA (15 kHz+)
The decision to use an independent capture PC has the advantage that the source system is not influenced by the capture process. They key component are the two Epiphan capture cards that allow to capture normal NTSC/PAL video, analog RGB starting from 15 kHz (e.g. Amiga/Atari ST) up to high VGA resolutions of 2048x2048. For newer sources it is also possible to capture from DVI at modes such as 1920x1080 at 60 Hz without analog gap.
Of course the capture PC has to keep up with this data stream. The CPU/board/memory combination had at the time of purchase a good price/performance ratio. CPU power was a critical point as the DVI2PCIe delivers up to 1920x1200 at 60 fps. The goal was to be able to save such a video stream lossless using the lagarith encoder. Thus the capture system had to have a minimum performance level. Analog audio is captured by the USB sound card to reduce electrical noise from the computer itself. The game computer outputs the audio digital that goes to the digital input of the Soundblaster Recon3D.
There are also a few other things to consider: If a capture is running it is inconvenient to watch the output only in the capture preview. Thus analog video, HDMI and audio is multiplied to several outputs. For analog video I use a VGA muliplier with 450 MHz bandwidth and for HDMI a HDMI 1->2 multiplier from Goobay. Analog audio runs through a Behringer 1202FX mixer that is sufficient to mix four stereo sources with up to four microphone sources. The capture software should have a peak meter with maximum volume history included to help find the correct input signal amplitude. For analog audio currently with all devices on the noise level is below -60 dB.
The capture PC runs Windows 10 with Virtualdub as video capture application and
Open Broadcaster Studio (OBS) for live streaming. For video capture with VirtualDub
Lagarith as lossless RGB 8:8:8 optimized codec is used. This choice is related to the fact that the Epiphan cards is able to capture in RGB 8:8:8 color space.
With OBS it is not possible to capture frame exact as there is no locked sync to a single video source. The reason is that OBS allows to mix multiple sources into a single output video stream (such as Webcam + Video Source + Window). Open Broadcaster uses
x264 as encoder with the profile VBR, 'faster', CRF18. Tests show that the quality is better than QuickSync or NVEnc at the same bitrate.
The capture cards deliver frames as they are shown by the source, thus a frame exact capture is possible. This is important in specific situations like 3D graphics presented in alternate frames for shutter glasses like ELSA Revelator. Frame drops would cause a flip of left/right eye.
Frame exact capture is also important to get stutter free animations with source material that runs synced to the refresh rate. This is often the case with demos or older content with e.g. scrollers. When newer PCs are the source there is the possibility to clone the output to two devices. The capture card must be set as the primary display on the game computer since VSync only applies to the primary display.
As analog video signal varies between analog sources a good calibration of the image position, pixel clock/phase and signal gain/offset is necessary to get the best representation. I wrote an alignment tool for the Epiphan cards like the DVI2PCIe which is available
here. It has also an extended functionality where one can measure the 2D signal quality of analog sources.
Capture from Commodore 64
Capturing from a Commodore 64 poses often challenges. The signal is not standard PAL where a lot of capture cards simply do not detect a valid signal at all. The C64 allows to capture from Composite or S-Video. The following general description is for capture from S-Video. At the end some notes for Composite capture follow.
In S-Video the Luminance and Chrominance signal are separate. The amplitude of the chrominance signal of the C64 is higher than standard which results in strongly saturated colors with some capture cards. A very simple way is to add a 300 Ohm resistor in the Chroma line that acts as voltage divider. From an electrical engineers point this is not the perfect solution but it works with a short cable.
Most cards employ Auto Gain on Luminance and Chrominance. Especially with the Chrominance signal this leads in combination with the limited 16 colors of the Commodore 64 to a very saturated and too colorful output. So either the capture card allows to disable Auto Gain or a color desaturation pass in the post processing is required.
Regular video capture cards for PAL signals assume an interlaced source signal. With a progressive source such as the C64 the output frame of the C64 is put into the even lines and the next frame in the odd lines. The capture card shows then e.g. 768x576 at 25 fps, half of the C64 frame rate. To recover the original 50 fps progressive the frames have to be deinterlaced and scandoubled.
I tested quite a few capture cards and my currently preferred setup is like this: I use a BT878 (also known as Conexant Fusion 878) based PCI card as capture card for the C64 (
1
2
3
4
). The chipset of this formerly common card is quite old, however it copes with the C64 signal very well. The last drivers are for WinXP but the application DScaler (Win) supports the BT878 chipset natively even in Windows 10 64 bit (If Win10 does not boot in UEFI mode.). I use currently
DScaler 4.2.3a that also supports recording. I have added a few patches to DScaler, especially the bad image quality when using DirectX9 D3D surface is gone. DScaler is also very well suited just for viewing where I use the following settings:
Bt Card / Video Input -> S-Video
Bt Card / Video Format -> PAL-BDGHI
Bt Card / Pixel Width -> 768
Deinterlace / Old Game2 -> enabled , everything else disabled in the Deinterlace menu
Settings / Advanced Settings / BT8781 Advanced / Even Chroma AGC -> disabled
Settings / Advanced Settings / BT8781 Advanced / Full Luma Range -> enabled
Settings / Advanced Settings / BT8781 Advanced / Odd Chroma AGC -> disabled
optional:
Filters / Noise Reduction (Temporal) -> enabled
Additionally the display mode of the graphics card should be set to 50 Hz for viewing. This works with NVidia cards by opening the NVidia Control Panel:
Display / Change Resolution / Customize / Enable resolutions not exposed by the display -> enabled
Display / Change Resolution / Customize / Create Custom Resolution / Reduce Refresh Rate to 50 Hz then press Test and Acknowledge
Choose the new 50 Hz resolution / Apply and check directly on your monitor if it was actually set
Of course the Direct3D surface DScaler uses is not hard locked to the 50 Hz output of the C64 so some rare frame skipping may still occur. This depends on the difference of the 50 Hz of your graphics card and the 50 Hz of the C64.
For capturing with DScaler I setup the following options additionally:
Actions / Recording / Options / Compression Options / Video Configure / Lagarith - Configure / All boxes enabled + Mode YUY2
Actions / Recording / Options / Wave In: Choose your Audio Input where the C64 Audio is connected
Actions / Recording / Options / Set a Destination where the video files are saved and enable the 'No Limit' box
Actions / Recording / Options / Recording Height -> Full Height
Actions / Recording / Options / Recording Format -> YUY2
It is also necessary to set the graphics cards refresh back to 60 Hz or higher. Since DScaler locks the capture to the display of the Direct3D surface at 50 Hz display refresh rate it might be that the C64 has 50.2 Hz. So sometimes the C64 would deliver two frames where DScaler only shows a single frame resulting in a frame drop. As the capture card combines this to an interlaced frame effectivly two frames of the C64 get dropped. So set the display to something higher than 50 Hz, while the preview will start to stutter, there are not any dropped frames on recording.
Now if you press Shift-R capture starts and a ds000.avi file is written in your destination folder. To stop capture press Shift-S. Subsequent capture starts will create ds001.avi and so on.
When DScaler is closed the selected Wave-In for recording is not saved, so be sure to check set it correctly at least once DScaler is started.
The resulting video is 25 Hz interlaced. There are various ways to do the correct deinterlace. I use
Avisynth which is quite fast with the following small script in an .avs file (save as e.g. c64_deint.avs):
video=AviSource("ds000.avi")
video=SeparateFields(video)
videoE=SelectEven(video)
videoO=SelectOdd(video)
video=Interleave(videoO,videoE)
return video
The .avs file can be opened by VirtualDub like a video file. Then just choose in Video / Compression the Lagarith Encoder and Save as AVI again.
This script splits up the odd and even fields and interleaves them again frame by frame. The resulting video is 768x288 at 50 fps.
The C64 scanline starts on the very left with a small white perpendicular stripe. With some C64 this is visible in the captured scanlines. For such cases it is suitable to crop the video slightly:
video=AviSource("ds000.avi")
video=SeparateFields(video)
videoE=SelectEven(video)
videoO=SelectOdd(video)
video=Interleave(videoO,videoE)
video=Crop(video,16,0,-16,0)
return video
For further encoding I use
StaxRip! with x264 single pass, Super High Quality (CRF 18), Preset 'Very Slow', Tune 'disabled', Device 'disabled'. It is important to set the Display Aspect Ratio (DAR) to 4:3 as well. This keeps the video source resolution small while having a correct display output. I should note here that the scaling to 4:3 is done in this case by the player application (typically bilinear).
For Full-HD targets like Youtube I scale the video myself and generate a 1:1 representation. Subjectivly there are several approaches. I try to keep the pixels visible by an 8x Nearest Neighbour upscale and subsequent downscale to 1440x1080 (4:3) with Lanczos3.
video=AviSource("ds000.avi")
video=SeparateFields(video)
videoE=SelectEven(video)
videoO=SelectOdd(video)
video=Interleave(videoO,videoE)
video=pointresize(video,8*video.width,8*video.height)
video=LanczosResize(video, 1440, 1080)
video=addborders(video,240,0,240,0,0)
return video
The final addborders line letterboxes the video to 1920x1080. Final H.264 encoding is done the same way with StaxRip! as described above.
Some may miss a certain level of color bleeding that smoothes out C64 graphics. The easiest way to accomplish this is to capture using Composite. The post processing workflow stays the same. I also tried with some generic blur of a quarter pixel in x and y but results were mixed.
Finally some notes on artefacts visible on certain capture cards:
The Epiphan DVI2PCIe shows strong desaturation especially on green without the 300 Ohm resistor (i.e. too high Chroma amplitude)
The Epiphan DVI2PCIe shows brightness pumping even intra frame (watch the Revolved-Triad capture and focus on the grey border area that should not change).
The Epiphan DVI2PCIe shows different colors on odd and even scanlines (with correct Chroma amplitude)
The Epiphan DVI2PCIe has no way to disable Auto Gain
Hauppauge WinTV Express (PCIe) shows a good quality image, however starts to jitter a few pixels horizontally after a few minutes.
My source PC
The gaming PC as source for the DVI/HDMI captures is:
CPU
|
i9 7900X Skylake-X at 4.5 GHz with 10 cores + HT
|
Mainboard
|
ASUS TUF 299 Mark I with 32 GB DDR4 3200 RAM
|
Graphics Card
|
NVidia Titan X Pascal
|
Sound Card
|
onboard with digital out
|
The performance goal here is to achieve 60 fps in games at 1920x1080 resolution since otherwise capturing/streaming at 60 fps would not make much sense.
x86 Retro Computer Overview
Lossless RGB Capture of Second Reality Demo / Future Crew
Unreal at 1600x1200 at 75 Hz from Voodoo5
Direct Capture from Amiga 600