SenorPez / project-cars-replay-enhancer

Project CARS Replay Enhancer: Combines telemetry data with replay video to improve Project CARS replays.
MIT License
12 stars 1 forks source link

Project CARS Replay Enhancer Build Status codecov

Combines telemetry data with replay video to improve Project CARS replays.

Current release: 0.6
Current edge state: Close to Smooth
Current mood: Excited

The Project CARS Replay Enhancer (I'd call it PCRE, but that's taken) is intended to augment Project CARS replays by combining captured telemetry data with replay video.

The scripts are currently not fast enough for live broadcasting.

Requirements

Installation

Short Version:

The Project CARS Replay Enhancer can be installed with pip: pip install replayenhancer.

Longer Version:

Depending on your environment:

For a complete list of commands to get the Project CARS Replay Enhancer running from a newly-created Amazon EC2 Instance, see Commands From Scratch.

Usage

Telemetry Capture:

Telemetry packet capture is performed by running the command packetcapture on the network. This captures UDP packets broadcast by Project CARS (make sure you've enabled UDP broadcast) and store them to a subdirectory for future processing.

NOTE: As most internet video runs at 30 frames per second, you want to set your UDP broadcast rate to at least 30 packets per second, otherwise there may be noticeable "phasing" between video and data displays.

Telemetry Capture Best Practices:

There are a few things to do to optimize the telemetry data used by the Project CARS Replay Enhancer.

Video Capture:

There is no video capture functionality included in the scripts. How you get the video to your local machine is left as an exercise for the reader. For my PS4, I stream the replay to YouTube which then archives it and then can be downloaded using youtube-dl. Video capture devices such as an Elgato work just fine as well (probably better, actually).

Configuration Files:

Project CARS Replay Enhancer configuration files are JSON files, and can be created by using the Project CARS Replay Enhancer UI or by creating them by hand. See Configuration File Format for details on recognized fields.

Telemetry Synchronization:

For best results, the telemetry data feed must be synchronized to the video feed; there is no way to automatically perform this. To aid with this synchronization, run the Project CARS Replay Enhancer is the -s option and the desired configuration file. For example, replayenhancer -s config.json.

A low-quality video that encompasses only the first lap of the race is created, along with a timer overlay. To determine the telemetry synchronization, compare the time on this overlay with the lap time of a car as it crosses the start-finish line. These two times should be identical; if they are not, the syncronization needs to be adjusted.

For an illustrated tutorial of telemetry synchronization, see Determining Telemetry Synchronization Value.

Creating a Replay

To create the full, enhanced replay, provide the Project Cars Replay Enhancer with a valid configuration file. For example, replayenhancer config.json.

Enhancing the Enhancer?

You're more than welcome to do so! Write new modules, speed up new modules, feel free. If you have any issues or questions please communicate them here! I'm always looking for help.