Streaming Capture Card Input via VLC
I recently bought an Elgato Game Capture HD60 Pro, which provides me with an HDMI input on my PC that I can hook things like game consoles up to in order to stream/record their audio and video. Elgato provides a piece of software also called "Game Capture" that allows you to perform these tasks. It has a control center to mix audio levels between the HDMI input, your microphone, and the rest of your computer audio, as well as ways to manage overlays for webcams or other capture sources, and functionality for almost every livestreaming platform to let you stream straight from their suite instead of having to use something like the more complicated (but excellent) OBS Studio, the primary choice of most Twitch streamers nowadays.
To be honest, though, part of the reason I bought the card is just to be able to play console games in a window on my computer. I'm not sure if or when I'll stream myself doing so, I just don't have a separate TV in the same room as my computer and this seemed like a fun/easy way to get around it. Elgato's software suite isn't ideal for this; it has a bunch of extra controls on the screen to perform the functions I mentioned above and I'd really rather just have a simple resizable window with the game video in it.
Doing a bit of reading, I discovered that in Windows the Elgato cards make their input available as DirectShow sources (one for video and one for audio). Thinking back to how I could make use of that, it occurred to me that VLC actually allows you to read those as input streams!
I had to cobble together a few different tutorials to get what I wanted, which is the ability to have an icon on my desktop that I can double-click and have it stream the game console video and audio in a resizable window with no other chrome and minimal lag. I did manage to accomplish it, though, so here are the steps it required. All of this assumes that you are on Windows 10, have an Elgato HD60 series capture card, have verified that you can see/hear the input via the Game Capture software or something like OBS, and that you have VLC installed. You can probably use this information to adapt for other OSes, capture cards, etc, but I can't help you with any more than what I've written below.
Make a .cmd file #
We need to add a LOT of command line parameters to VLC, and they're going to go far beyond the character limit in a Windows shortcut creation dialog, so we need to make an actual script that runs this command. Open a text editor (Notepad is fine). Start by putting the path to VLC into it (this might be different for you!), along with the parameter that will hide the play/pause/skip controls:
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --qt-minimal-view
Save the file somewhere (I have a "bin" folder in my home directory for miscellaneous files like this) and verify that when you open it, it opens VLC. There'll be a terminal window showing the command, but don't worry about that; we'll deal with it later.
Add all the parameters to VLC #
Here's the fun part! The default parameters in VLC for viewing a DirectShow device assume basically nothing, and we need very specific values for a number of them. I'm going to first show you the full contents of my "elgato in vlc.cmd" file and then I'll break down each of the non-default parameters and tell you which of them might need to be changed for your setup.
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --qt-minimal-view dshow:// :dshow-vdev="Game Capture HD60 Pro (Video) (#01)" :dshow-adev="Game Capture HD60 Pro (Audio) (#01)" :dshow-aspect-ratio=16\:9 :dshow-chroma= :dshow-fps=60 :no-dshow-config :no-dshow-tuner :dshow-tuner-channel=0 :dshow-tuner-frequency=0 :dshow-tuner-country=0 :dshow-tuner-standard=0 :dshow-tuner-input=0 :dshow-video-input=-1 :dshow-video-output=-1 :dshow-audio-input=-1 :dshow-audio-output=-1 :dshow-amtuner-mode=1 :dshow-audio-channels=2 :dshow-audio-samplerate=48000 :dshow-audio-bitspersample=16 :live-caching=1
:dshow-vdev
: This is the name of the DirectShow video input stream. There are a couple ways to find this! The fastest is probably if you have ffmpeg installed on the command line. Just open up a terminal and run this command:ffmpeg -list_devices true -f dshow -i dummy
. The Game Capture (Video) stream should be included. If you don't, you can use VLC to figure this out. Open VLC and go toMedia -> Open Capture Device...
, then find it in the Video Device Name dropdown as shown below.
:dshow-adev
: This is the same thing, but for your audio input. You can use the same methods listed above to find the correct string for this value as well.:dshow-aspect-ratio
: this should be16\:9
for almost any modern device sending a signal over HDMI, but consult its manual and figure out the correct aspect ratio via its native resolution. I don't know if you need to escape the:
symbol with the backslash in front of it, but VLC put it there when I was copying parameters out of it and leaving it in doesn't seem to hurt anything.:dshow-fps
: you can control this, but you probably want to just lock it at 60, from what little I know about these things.:dshow-audio-channels
: I set this to2
to get stereo sound working. I'm not sure if you could make this work with surround sound or not; I don't have a surround setup on my computer.:dshow-audio-samplerate
: 48kHZ is the frequency at which my card streams audio; if you have a different capture card you may want to double-check if it's the same.:dshow-audio-bitspersample
: a tutorial I read said to put this at 16. I don't really know when/why you would change this.:live-caching
: okay, this one is actually important. The default for streaming from a capture card is a 300ms buffer, which is wayyyy too much video lag to be able to play almost any video game. When I first set this up I set it to be0
because obviously I don't want any caching, right? Turns out zero is not a valid value and so it ends up inheriting the default value. If there's a warning somewhere, it's in a log file I haven't looked at. Set this to1
instead to add 1ms of video lag, which I'm sure is fine for all but the most hardcore of hardcore.
The rest of the values in this file are the defaults which I copied from VLC, which generates the list of parameters for you in a box under "Show more options" in the dialog screenshotted above.
Make an "invisible.vbs" #
So we've got everything working, but you've got that ugly terminal window that opens alongside VLC, and closing it kills VLC. That's not what I want! I think there are a few different ways to fix this, but the one I found involves a little bit... of VBScript. Aww yeah.
Open a new file and put this text in it:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
Save the file as invisible.vbs
somewhere.
Make a desktop shortcut #
Go in Windows Explorer to where you saved your invisible.vbs
and right-click on the file. Choose Send To -> Desktop (create shortcut)
, then right-click on that shortcut and choose Properties
. In the tab named "Shortcut", in the box labeled "Target", after the existing path to the VBScript file, add the path to your .cmd file. In my case the full target box looks like this:
C:\Users\casey\bin\invisible.vbs "C:\Users\casey\bin\elgato in vlc.cmd"
For the final touch, set whatever application icon you want via the "Change Icon" button below (I went with the VLC cone icon) and give the shortcut whatever name you want (I named it "Elgato").
That's it! You should now have the ability to invoke your desktop shortcut and see the input. One thing I've noticed is that the connection VLC makes occasionally has a barely noticeable lag to it-- I don't know enough about this stuff to understand why it only happens sometimes, but usually closing VLC and trying again fixes it.
- Previous: Hexologic
- Next: Scrumwave: An Online Generative Art Exhibition