Skip to content

Commit

Permalink
Fixed lockup issues, color space autodetect and 1080i support
Browse files Browse the repository at this point in the history
Also added udev rules for non-root support and added firmware extraction script. README has been updated.

Signed-off-by: Scott Dossey <seveirein@yahoo.com>
  • Loading branch information
seveirein committed Nov 3, 2016
1 parent 30eb8c0 commit ef630ea
Show file tree
Hide file tree
Showing 12 changed files with 372 additions and 178 deletions.
204 changes: 137 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ Official Groupchat at Gitter: https://gitter.im/tolga9009/elgato-gchd

* Elgato Game Capture HD


### Unsupported devices

* Elgato Game Capture HD (latest revision PID 0x005d) (planned)
* Elgato Game Capture HD60 (work in progress)
* Elgato Game Capture HD60 S
* Elgato Game Capture HD60 Pro
Expand All @@ -26,37 +24,100 @@ Official Groupchat at Gitter: https://gitter.im/tolga9009/elgato-gchd
## Firmware

This software needs Elgato Game Capture HD firmware files to work. Due to
licensing issues, they're not part of this repository. You need to extract them
yourself from the official Mac OS X drivers.
licensing issues, they're not part of this repository.

You need to extract them yourself from the Windows "Game Capture" software,
or the official Mac OS X drivers. Getting it from each is a different process.

**Note**: If you're a Mac OS X user, simply install the official drivers. You
don't need to manually extract the firmware files.

A brief instruction (for Linux only):
## Getting Firmware from Windows "Game Capture" software:

1. Download Game Capture from:

https://www.elgato.com/en/game-capture-hd-support

Game Capture 3.2 is known to work. You will not need the hardware driver,
just the Game Capture software (which is a much bigger download).

2. Make sure p7zip is installed on your Linux box. On Debian based systems
this can be achieved with the following command (as root).

```
apt-get install p7zip-full
```

3. Copy/Move the GameCapture*.msi file to the
firmware_extract directory in this tree.

4. Change directory to firmware_extract and then run:

```
./extract_firmware_windows
```

This will create a "Firmware.tgz" file.

5. Change directory to either /usr/lib/firmware or /usr/local/lib/firmware
You may need to be root.

6. Untar Firmware.tgz from one of those directories. You will probably
need to be root.

```
tar xvf /full/path/to/elgato-gchd/firmware_extract/Firmware.tgz
```

7. The firmware files should end up in `/usr/lib/firmware/gchd` or
`/usr/local/lib/firmware/gchd` directories.

## Getting Firmware from Macintosh Driver:

1. Download Elgato Game Capture HD Mac OS X driver version 2.0.3 from official
website: https://www.elgato.com/en/game-capture-hd-support

2. Install `dmg2img` and `hfsprogs`. Please refer to your specific Linux
distribution for more information.
2. Install the tools to loopback mount the gchd_*.dmg file.
There are two ways to do this:
A) Using `dmg2img` and `hfsprogs`. These tools currently don't work
properly on .dmg files create on later versions of OSX. So you will
want to make sure you get the 2.0.3 version of the driver for this.
B) Install `darling-dmg` from https://github.com/darlinghq/darling-dmg
and use it to do this step. This is a much better method, but
darling-dmg isn't currently available as a package for most
Linux distros.

3. Uncompress Elgato Game Capture HD Mac OS X drivers:
3. Once the tools are installed, mount .dmg file.
For method A:

```
dmg2img gchdm_203_970.dmg -o gchdm_203_970.dmg.img
```
3A.1. Uncompress Elgato Game Capture HD Mac OS X drivers:

```
dmg2img gchdm_203_970.dmg -o gchdm_203_970.dmg.img
```

4. Mount the uncompressed HFS+ image with root permissions:
3A.2 Mount the uncompressed HFS+ image with root permissions:

```
mkdir /tmp/dmg
mount -o loop -t hfsplus gchdm_203_970.dmg.img /tmp/dmg
```
```
mkdir /tmp/dmg
mount -o loop -t hfsplus gchdm_203_970.dmg.img /tmp/dmg
```

5. Copy `mb86h57_h58_idle.bin` and `mb86h57_h58_enc_h.bin` from
`/tmp/dmg/Game\ Capture\ HD.app/Contents/Resources/Firmware/Beddo/`.
For method B:

3B.1 Mount the HFS+ image directly. Root permission not required.
```
mkdir /tmp/dmg
darling-dmg gchdm_203_970.dmg /tmp/dmg
```

4. Copy `mb86h57_h58_idle.bin`, `mb86h57_h58_enc_h.bin`,
`mb86m01_assp_nsec_idle.bin`, and `mb86m01_assp_nsec_enc_h.bin`
from `/tmp/dmg/Game\ Capture\ HD.app/Contents/Resources/Firmware/Beddo/`.

6. Place the firmware files either in `/usr/lib/firmware/gchd` or
`/usr/local/lib/firmware/gchd` folder. You might need root permissions.
`/usr/local/lib/firmware/gchd` folder. You might need root permissions.

**Note**: for testing purposes, you can also place the firmware files in the
same directory, where the compiled executable `gchd` is located.

Expand All @@ -66,38 +127,38 @@ same directory, where the compiled executable `gchd` is located.
1. Install the following dependencies. Please refer to your specific Linux
distribution, as package names might differ.

* libusb >= 1.0.20
* cmake (make)
* make (make)
* qt5 (optional) - for GUI support (not usable, work in progress)
* libusb >= 1.0.20
* cmake (make)
* make (make)
* qt5 (optional) - for GUI support (not usable, work in progress)

2. Compile the driver:

1. Either clone or download the Git repository and extract it.
1. Either clone or download the Git repository and extract it.

2. Open up a terminal inside the project's root directory.
2. Open up a terminal inside the project's root directory.

3. Create a new directory `build` in the project's root directory and
navigate into it:
3. Create a new directory `build` in the project's root directory and
navigate into it:

```
mkdir build
cd build
```
```
mkdir build
cd build
```

4. Run CMake from inside the `build` directory to setup the make
environment and compile the driver:
4. Run CMake from inside the `build` directory to setup the make
environment and compile the driver:

```
cmake ..
make
```
```
cmake ..
make
```

5. The compiled executable `gchd` is located in `build/src`. If you have
Qt5 installed on your system, the GUI `qgchd` will be located at
`build/src/gui`.
**Note**: you can copy the firmware files into these directories and test
the application, without making any system-wide modifications.
5. The compiled executable `gchd` is located in `build/src`. If you have
Qt5 installed on your system, the GUI `qgchd` will be located at
`build/src/gui`.
**Note**: you can copy the firmware files into these directories and test
the application, without making any system-wide modifications.

3. If the application works for you, you can optionally install it system-wide,
running `make install` from within the `build` directory. This will install the
Expand All @@ -112,22 +173,22 @@ executables to `/usr/bin`.
Usage: gchd [options]
Options:
-c <color-space> Color Space settings [default: yuv]
-f <format> Format for <output> [default: fifo]
-h Print this screen
-i <input-source> Input Source [default: hdmi]
-n <ip-address> IP address for UDP streaming [default: 0.0.0.0]
-o <output> Output Path [default: /tmp/gchd.ts]
-p <port> Port for UDP streaming [default: 57384]
-r <resolution> Resolution of Input Source [default: 1080]
-v Print program version
-P <pid-path> PID path [default: /var/run/gchd.pid]
-c <color-space> Color Space settings [default: autodetect]
-f <format> Format for <output> [default: fifo]
-h Print this screen
-i <input-source> Input Source [default: autodetect]
-n <ip-address> IP address for UDP streaming [default: 0.0.0.0]
-o <output> Output Path [default: /tmp/gchd.ts]
-p <port> Port for UDP streaming [default: 57384]
-r <resolution> Output resolution [default: same as input source]
-v Print program version
-P <pid-path> PID path [default: /var/run/gchd.pid]
```

Options for `<color-space>` are `yuv` and `rgb`. Consoles and PCs output in
either format and usually don't support switching Color Spaces. If this option
is set incorrectly, your capture will either have a green or purple tint.
Default is set to `yuv`.
If this is not set the driver will attempt to autodetect.

Options for `<format>` are `disk`, `fifo` and `socket`. Use `disk`, if you want
to directly record to your harddrive. Else, FIFO will cover almost all use cases
Expand All @@ -138,7 +199,8 @@ or SSDs. When set to `socket`, this driver will stream the output via UDP to

Options for `<input-source>` are `composite`, `component` and `hdmi`. Choose,
whichever source you're using. Some Resolutions are not available on all Input
Sources.
Sources. If you do not specify the input source, the driver will attempt
to autodetect.

You can specify `<ip-address>` using `-n` option. The driver will stream to this
IP address, instead of default `0.0.0.0`. Please note, UDP streaming is highly
Expand All @@ -152,8 +214,10 @@ depending on whether `-d` has been set or not.
You can change the default `<port>` using `-p` option. Default is set in private
port range (RFC 6335) to `57384` (EGCHD).

Options for `<resolution>` are `ntsc`, `pal`, `720` and `1080`. Use whichever
resolution your input source has.
Options for `<resolution>` are `ntsc`, `pal`, `720` and `1080`. If unspecified
this defaults to using whatever resolution the input source is at. Note that
currently some users are experiencing video and audio artifacts if the
resolution doesn't match the input size.

`<pid-path>` is unused at the moment. Once implemented, it will provide a
single-instance mechanism, which will prevent this driver from opening multiple
Expand All @@ -165,23 +229,29 @@ non-root user and don't have write access to the default `<pid-path>` location.

This driver must be run as root, as it needs to access your Game Capture HD
device. Under Linux, you can alternatively configure udev to make your device
accessible by non-root users.
accessible by non-root users. See the file udev-rules/55-elgato-game-capture.rules

If no commandline options are set, the device will be configured for a 1080p
HDMI source in YUV colorspace. By default, a FIFO will be created at
`/tmp/gchd.ts`. You can open it up using any media player, which supports
reading from pipes (e.g. VLC or obs-studio). There will be a slight delay, which
is a hardware limitation and can't be worked around.
If no commandline options are set, the device will autodetect what source you
have, HDMI, Component, or Composite. It will also autodetect the streamed
resolution and colorspace. It will not however handle these changing on the fly.

By default, a FIFO will be created at `/tmp/gchd.ts`. You can open it up using
any media player, which supports reading from pipes (e.g. VLC or obs-studio).
There will be a slight delay, which is a hardware limitation and can't be worked
around.

If you're done using this driver, close the file, stop the terminal using
"Ctrl + C" and wait for the program to successfully terminate. The driver is
resetting your device; it may take a while. If you interrupt this step, it will
leave your device in an undefined state and you will need to manually reset your
device by reconnecting it.
"Ctrl + C" and wait for the program to successfully terminate. The driver will
resetting your device. If you interrupt this step, it will leave your device in
an undefined state and you will need to manually reset your device by
reconnecting it.

Currently supported input sources:

* HDMI: 1080p60, 720p60
* HDMI: 1080p60, 1080i60, 720p60

These are not supported by this version of the driver but will be in the
near future:
* Component: 480p60 (NTSC), 576p50 (PAL), 720p60, 1080i60, 1080p60
* Composite: 480i60 (NTSC), 576i50 (PAL)

Expand Down
3 changes: 3 additions & 0 deletions firmware_extract/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Firmware.tgz
tmp.*
GameCapture*.msi
24 changes: 24 additions & 0 deletions firmware_extract/extract_firmware_windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

type 7z >/dev/null 2>&1 || { echo >&2 "This requires p7zip but it is not installed."; exit 1; }

shopt -s nullglob #Critical behaviour change variable.

pattern="GameCaptureSetup*.msi"
fileList=( ${pattern} )
filename=${fileList[0]}
[[ ! -z "${filename// }" ]] || { echo >&2 "Cannot find a GameCaptureSetup*.msi file."; exit 1; }

[[ ! -e Firmware.tgz ]] || { echo >&2 "Firmware.tgz file already exists. Delete to rerun."; exit 1; }


TEMPDIR=`mktemp -d -p .`
mkdir ${TEMPDIR}/gchd

7z e -o${TEMPDIR} ${filename} x86_yPushFile3.dll
7z e -o${TEMPDIR}/gchd -r ${TEMPDIR}/x86_yPushFile3.dll MB86H57_H58_IDLE MB86H57_H58_ENC_H MB86M01_ASSP_NSEC_IDLE MB86M01_ASSP_NSEC_ENC_H

rm -f ${TEMPDIR}/x86_yPushFile3.dll
pushd ${TEMPDIR} && tar cvzf ../Firmware.tgz gchd && popd

rm -r ${TEMPDIR}
Loading

0 comments on commit ef630ea

Please sign in to comment.