PDA

View Full Version : [UDP] Replay Enhancer 0.6/0.2: Better than ever!



SenorPez
06-01-2016, 00:29
Current Version: 0.6 (Script), 0.2 (UI)
Release Post: http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer-0-3-1-Now-easier-and-faster-to-use!&p=1325279&viewfull=1#post1325279

A little side project I was working on... the replays in Project CARS leave something to be desired, so with the introduction of UDP to PS4, I decided to put together a utility to combine replay video with telemetry data to give it a bit more... broadcast... feel.

It's currently a collection of scripts in Python, primarily using moviepy but a few other libraries to aid with drawing, analysis, and compositing, that takes this:

https://www.youtube.com/watch?v=wUew4YKWKu4

along with a recorded telemetry track and outputs this:

https://www.youtube.com/watch?v=JMT7R1nyt6c

There's some caveats:

It's also not fast enough to do real-time broadcasting (for example, if you wanted to capture a stream, add the graphics, and rebroadcast). An actual programmer might be able to get it there.
It can only work with race telemetry; there are some very curious gaps in the replay telemetry that makes it unusable.
I'm pondering future modules to create; first on the "possible" list would be a ticker across the bottom that cycles (either in order or randomly) through various metrics, such as last lap times, gaps, etc.


Thanks for the UDP feed, SMS. It's amazing!

AtomicSphincter
06-01-2016, 13:56
Great job SenorPez!! It's great to see new things come from developers! Good luck on your project. I'm just now starting to learn programming, and started with Python, so it's great to see something written in Python.

Apoc112
06-01-2016, 14:00
Awesome project! Can I assume this will work for we lowly Xbox players, too? There's nothing PS4-specific about the UDP stream, right?

SenorPez
07-01-2016, 15:46
No, there's nothing PS4 specific in the code at all, it's just that Patch 7.0 finally allowed me access to the data that the PC folks have had!

Right now, I'm working on doing a little cleanup on the codebase to get it up on github (or something similar) without TOO much embarassement, so if others want to use it to create their own replays, they're more than welcome!

AtomicSphincter
08-01-2016, 00:27
I'd love to see the code, thanks for sharing!

SenorPez
11-01-2016, 23:19
Sorry for the delay; my paying job has gotten in the way lately. Code is forthcoming!

STEELJOCKEY
12-01-2016, 07:05
Awesome!

Are you using a certain programme to add it to the video, could you edit the video with different camera angles and add it to the edited video, and can I add it to my own video editing programme ie PowerDirector?

SenorPez
12-01-2016, 21:53
Code for the Project CARS Replay Enhancer (PCRE, but that's taken...) is now available on Github:
https://github.com/SenorPez/project-cars-replay-enhancer

Feel free to collaborate.


Awesome!

Are you using a certain programme to add it to the video, could you edit the video with different camera angles and add it to the edited video, and can I add it to my own video editing programme ie PowerDirector?

The compositing is done right now using MoviePy, which actually makes it quite flexible. The usage example I documented and showed in the earlier videos was a simple example: Single video with overlays.

However, there's no reason to limit it to a single video feed. For example, if you wanted to cut together a video using an editor (or MoviePy), and then use that to place telemetry data on top, you could do that. I don't really see any reason you couldn't do a split screen with multiple replay angles composted together, a track map, etc. if you're willing to put in the time to create the video feeds.

There are really two things to understand, which both make this somewhat complex but insanely flexible:
First, there's actually no explicit link between the telemetry data and the video feed. The configuration file (in fact, one of the parameters, "racestart") you pass the script is what synchronizes the video feed with the telemetry feed. So you can not only adjust that, but you can also "roll back" the telemetry feed with a bit of programming... so if you wanted to put together, for example, an "alternate angle" instant replay, you could do that.

Second, MoviePy has a lot of compositing options that can be programmatically implemented... for years I worked splicing videos together in Adobe Premiere, when I could have done it faster, cheaper, and easier in MoviePy. The documentation isn't spectacular, but I've found it's a VERY powerful package.

Feel free to contribute and ask questions, here or on Github. Right now my poor home server is chugging away to create the first few videos of my new career mode, in which I show I'm a terrible driver. ;)

EDIT: The Github repository README.md includes usage instructions. Be warned, a little programmatic and troubleshooting knowledge will be helpful.

STEELJOCKEY
12-01-2016, 23:36
Ok, from a video editing perspective, I think the name list on the left could be a bit smaller to leave more action viewable on-screen, especially if there are 16 drivers. The script could be maybe a little bit smaller, but taking out some of the gaps and bringing the names closer together might do it. The time and lap counter on the right side are a good size, I think that could stay as is.

Once again, awesome work, this could be a very useful tool for adding info to a race edit, and give that 'TV broadcast' feel.

BulletEyeDK
14-01-2016, 12:43
Great work, really... will for sure follow this thread... ;)

dustyjo
17-01-2016, 10:14
Fantastic idea, I love it.

Michel--NL
17-01-2016, 17:36
I cant understand this part of the script:

racestart: This is used to synchronize the telemetry data with the video. The easiest way to find this number is to make a low-quality video, pause on a new lap, and note the differential between 0.00 on the timer and the actual time displayed.
In the globals_template.py you have this as value racestart = 3.5+0.8, what does it mean?
I have a video where the race begins at 40 seconds. The second rounds begins at 1:53. So what do I have to use?

SenorPez
17-01-2016, 19:58
I cant understand this part of the script:

In the globals_template.py you have this as value racestart = 3.5+0.8, what does it mean?
I have a video where the race begins at 40 seconds. The second rounds begins at 1:53. So what do I have to use?

You seems to be correct.
In the replay videos produced by PCARS, there's a few seconds at the start before the green flag drops. racestart then, tells the how many seconds into the video the green flag drops. You might think of it as mapping the video time to the race elapsed time: video time = race elapsed time + racestart.

If you have a video with a longer introduction (which could be if you captured it from a Twitch stream, or did some editing to add titles or whatnot), 40 seconds could be correct. The way to test that is to make sure that the lap timer resets to 0.00 when the car crosses the start/finish line.

For a video with two races (and two sets of telemetry), you're going to want to split the video and telemetry into two separate videos. This is mostly due to the fact that early testing required restarts, so the scripts automatically trim the telemetry to the last valid (start to finish) race in the telemetry. So you'll lose your first race's data.

However, it's easy to concatenate videos end-to-end with moviepy: output = concatenate_video([video1, video2, etc.]) so you can end up with one big final video!

Michel--NL
17-01-2016, 22:02
Ok...I did some testing with the default values.
The result is in the video and clearly I'm doing something wrong because its not working :(
Do you have any clue what goes wrong?


https://www.youtube.com/watch?v=1uuo95ehepE

SenorPez
18-01-2016, 01:44
Ok...I did some testing with the default values.
The result is in the video and clearly I'm doing something wrong because its not working :(
Do you have any clue what goes wrong?


https://www.youtube.com/watch?v=1uuo95ehepE

It looks like racestart isn't set right. Because racestart is too high, it's actually trying to sync end-of-race data throughout the video, which is why it doesn't update.

To put it a different way, racestart is the interval of time between 0:00 on the replay video (not including the title screen, so 0:05 in the YouTube video) and when the green flag drops. Just eyeballing it in your video it looks like it might be 4 seconds (slightly more than the "base" of 3.5). Try that and see if the telemetry advances, and take a look at the difference in time between your car crossing the line and the timer resetting to 0.00 to fine-tune it. (That's actually why it the defaults it's listed as 3.5+0.8. When I built a test video with 3.5, it was off by 0.8 seconds, and I let Python do the math.)

You might also snag the copy from the 0.2-devel branch on git hub. I've made a few changes this weekend that will (at least) make rendering faster, especially if you want to do subclips to test.
https://github.com/SenorPez/project-cars-replay-enhancer/tree/0.2-devel

If all else fails, you can send me the telemetry CSV and I'll take a look at it. If nothing else it'll find more rough edges I can file down as time allows!

SenorPez
18-01-2016, 22:21
My new video capture card arrives tomorrow, so hopefully I'll be able to recut videos with some improvements I've made. No sense in stumbling through the "stream to YouTube, then download, then process" jungle just before the capture card makes that whole process easier.

azidahaka
18-01-2016, 22:45
This is so interesting!

Would it be possible to use it to make Life "race reports" while the race is going on? Like those webpages that show live standings and times.

As far as i know no current software output a lap by lap report or the positions of the cars, fastest lap/sector times and so on... I think your app already does most of it?

(not sure i explained myself properly it's almost 1AM here lol)

STEELJOCKEY
18-01-2016, 23:04
I don't think you'll be able to do a 'live broadcast', but certainly add it to a replay.

SenorPez
19-01-2016, 15:22
This is so interesting!

Would it be possible to use it to make Life "race reports" while the race is going on? Like those webpages that show live standings and times.

As far as i know no current software output a lap by lap report or the positions of the cars, fastest lap/sector times and so on... I think your app already does most of it?

(not sure i explained myself properly it's almost 1AM here lol)

Two halves here, and two answers:

For live video, no. Right now, the script isn't fast enough to process telemetry packets and render video packets to keep up in real time.

However,

If all you want is data, it's fast enough to do that. Silently living in the repository is a "racestandings.py" script. It would require a bit of work to get working again since I've changed a few things since it was created, but it was used as a "proof of concept" to get sector and lap times.

Output looks something like this (ignore the blank sector 2, like I said, it's a bit out of sync with telemetry parsing):
http://i.imgur.com/tm9C3nD.png

This *is* fast enough to render in real time; I tested that. With a bit of effort you could convert it to output a dynamic web page instead of terminal text, which might be exactly what you're looking for.

Michel--NL
19-01-2016, 19:06
Testing with your dev branch results in a error:

root@ubuntu:/home/michel/Desktop/replay_dev# python3 replay.py globals_template.py
Traceback (most recent call last):
File "replay.py", line 12, in <module>
from black_test import black_test
File "/home/michel/Desktop/replay_dev/black_test.py", line 9, in <module>
g = import_module(".".join(sys.argv[1][:-3].split('/')[1:]))
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2249, in _gcd_import
File "<frozen importlib._bootstrap>", line 2201, in _sanity_check
ValueError: Empty module name
root@ubuntu:/home/michel/Desktop/replay_dev#


I have created a fresh Ubuntu installation with the program requirements as you mentioned in the readme.
•Python 3.4 or greater
•MoviePy
•natsort
•NumPy
•Pillow

Do I still miss something?
Sorry but I don't have any knowledge of Linux or Python. Google is my best friend at the moment :p

SenorPez
20-01-2016, 13:10
Testing with your dev branch results in a error:

root@ubuntu:/home/michel/Desktop/replay_dev# python3 replay.py globals_template.py
Traceback (most recent call last):
File "replay.py", line 12, in <module>
from black_test import black_test
File "/home/michel/Desktop/replay_dev/black_test.py", line 9, in <module>
g = import_module(".".join(sys.argv[1][:-3].split('/')[1:]))
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2249, in _gcd_import
File "<frozen importlib._bootstrap>", line 2201, in _sanity_check
ValueError: Empty module name
root@ubuntu:/home/michel/Desktop/replay_dev#


I have created a fresh Ubuntu installation with the program requirements as you mentioned in the readme.
•Python 3.4 or greater
•MoviePy
•natsort
•NumPy
•Pillow

Do I still miss something?
Sorry but I don't have any knowledge of Linux or Python. Google is my best friend at the moment :p

WHOOPS. That's a bug. (Or really, just a missed use case.)

In shuffling things around I broke the parsing of the configuration file. For now, try "python3 replay.py ./globals_template.py" (NOTE the addition of "./" to the lead.)
It should really just accept either of those.

Two things:
First, this really shows me that I should have a "known good" configuration in the repository so that people can use that to make sure everything's configured right.

Second, with my new video capture card making it much easier to get replays out of the PS4 into my computer, enjoy this multi-camera switching replay. It's essentially a "proof of concept," switching every 30 seconds, but while making it, I came to the realization that you could use the telemetry to trigger the switches, too. Want to switch to the helmet cam every time you're overtaking? Want to view every Sector 2 from the external floaty cam? Cycle through feeds every lap? If someone codes it and you suffer through the video overhead, you can do it.


https://www.youtube.com/watch?v=hChAL73TlEw

Michel--NL
20-01-2016, 20:42
./ did the trick.
Now I have a new error with the dev branch

michel@ubuntu:~/replay-dev$ python3 replay.py ./globals_template.py
Traceback (most recent call last):
File "replay.py", line 49, in <module>
result = mpy.ImageClip(make_results()).set_duration(20).set_position(('center', 'center'))
File "/home/michel/replay-dev/make_results.py", line 106, in make_results
material, classification, dataHeight, columnWidths = results_data()
File "/home/michel/replay-dev/make_results.py", line 29, in results_data
raceFinish = [i for i, data in reversed(list(enumerate(g.telemetryData))) if int(data[9]) & int('111', 2) == 2][0] + 1
IndexError: list index out of range


The master branch is going ok with the same race data.

Michel--NL
20-01-2016, 21:28
Hmm i still struggle to get the timing right.
Could you take a look and tell me what i'm doing wrong?

Source video

https://www.youtube.com/watch?v=WT9EZNTjpAU

Output video

https://www.youtube.com/watch?v=2_vjFaaBiDg

Globals_template setting racestart = 3.5+5 (3.5 seconds from black to start)+(5 seconds from start to finish line)
sourcetelemetry files https://onedrive.live.com/redir?resid=8112D280FB82634A!169798&authkey=!ALBFXM5S_cLq9Lw&ithint=file%2czip

SenorPez
21-01-2016, 12:58
./ did the trick.
Now I have a new error with the dev branch

michel@ubuntu:~/replay-dev$ python3 replay.py ./globals_template.py
Traceback (most recent call last):
File "replay.py", line 49, in <module>
result = mpy.ImageClip(make_results()).set_duration(20).set_position(('center', 'center'))
File "/home/michel/replay-dev/make_results.py", line 106, in make_results
material, classification, dataHeight, columnWidths = results_data()
File "/home/michel/replay-dev/make_results.py", line 29, in results_data
raceFinish = [i for i, data in reversed(list(enumerate(g.telemetryData))) if int(data[9]) & int('111', 2) == 2][0] + 1
IndexError: list index out of range


The master branch is going ok with the same race data.

I'm grabbing your data and might have some time today to look into this (and your timing issue), depending on if my real job clients decide to sign their contract or not. I really do love other people breaking my code (no sarcasm) because it makes me find the sharp edges... thanks a TON for testing!

(Related, I found a pretty nasty bug that I've avoided by providence, so there's a fix forthcoming.)

SenorPez
22-01-2016, 03:40
Good news: It looks that nothing was wrong on your end... your telemetry data just exposed more bugs in my processing code!

I'm pushing the changes to the repository tonight or tomorrow, and plan on wrapping up the 0.2 release soon. After that, you'll be able to spin your replays... until you find more bugs!

Michel--NL
22-01-2016, 16:28
Good news: It looks that nothing was wrong on your end... your telemetry data just exposed more bugs in my processing code!

I'm pushing the changes to the repository tonight or tomorrow, and plan on wrapping up the 0.2 release soon. After that, you'll be able to spin your replays... until you find more bugs!

Great :)
https://github.com/SenorPez/project-cars-replay-enhancer was updated...I will give it a try

SenorPez
22-01-2016, 17:34
Project CARS Replay Enhancer 0.2 Released

Version 0.2 of the Project CARS Replay Enhancer has been released. Officially 11 Bugs Squashed and 4 Enhancements Implemented, but there's a few other improvements there.

The Project CARS Replay Enhancer now also comes with 100% more Demo. A demo, which will probably take you more time to download the .tar.gz file than actually run the demo, is available at: https://github.com/SenorPez/project-cars-replay-enhancer/wiki/Demo

Forward development continues as well. The 0.3 release will implement some form of pit stop detection, any bug squashing that might have to happen, and any other enhancements that come along. The rm release will focus on the development of a web-based race monitor that can show live race stats.

And remember, the Project CARS Replay Enhancer is completely customizable! Don't like my standings tree? You can create your own. Want to change the way the title screens look? You can create your own. And if you don't have the time or skills or interest to go that far, you're always welcome to leave bug reports and enhancement requests at: https://github.com/SenorPez/project-cars-replay-enhancer

Let me know if you have any questions, and enjoy!

Michel--NL
22-01-2016, 17:55
Did a quick test and the racedata timers are working...great.
Is it possible to get different cars for players?
carData = ["Scion FR-S" for x in range(12)]

At the end the ranks stops with 9. I think its because below 9 you dont get any points.
225761

SenorPez
22-01-2016, 18:24
Did a quick test and the racedata timers are working...great.
Is it possible to get different cars for players?
carData = ["Scion FR-S" for x in range(12)]

At the end the ranks stops with 9. I think its because below 9 you dont get any points.
225761

Cars
carData, teamData, and points all work in the same way. Unfortunately the PCARS UDP packets don't contain all of this information (the latest update includes a "Yes" or "No" to show if the car is the same as the players, but that's of little use in mixed-car races...), so it's manually defined in the configuration file you use to launch the tool.

It's a little cumbersome right now; I've got an improvement on the way.

The first step is, with just any old data in there (because it won't matter), to run the "show_participants" script with the config file as an argument: "python3 show_participants.py config_file.py"

What this does is dump the "index" of each driver. You use this to set up the carData, teamData, and points arrays, with 0 being the first position, 1 being the second, and so on.

So I might run it and get this:

python3 show_participants.py assets/race1_config.py
0: Kobernulf Monnur
1: Timon Putzker
2: Jesús Carrillo Resino
3: Gunars Salenieks
4: Brian Vang Villadsen
5: Bastian Schubert
6: Jürgen Bell
7: Wesley Daniel
8: Scott Winstead
9: Don Damis
10: Thomas Deuerling
11: Friedhelm Lipps

So, in the car data, I'll type in, surrounded by quotation marks and separated by commas, Monnur's car, Putzker's car, and so on.
In the team data, I'll do the same, but for team names (for single player).
For points (which represents points before the race starts), I'll do the same, except without the quotation marks.

There are some Python tricks you can use here. If all the cars are the same, you can do

["Car Name" for x in range(NUM)]
where NUM is the number of drivers in the race.

If teams don't matter (for a Quick Race Weekend or Online Racing), you can do

[None for x in range(NUM)]
(Note the LACK of quotation marks around None. This is the Python value None, not a string "None".)
This just drops the Team Column where it appears.

If points don't matter, you can set it to zero across the board

[0 for x in range(NUM)]

One of the Pythoniest tricks I do is for teams. So far, in every single player mode race, the drivers appear as teammate pairs, so I add a line of

teamData = [x for xx in zip(teamData, teamData) for x in xx]
which takes teamData = ['a', 'b', 'c', 'd', 'e', 'f'] and turns it into ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e', 'f', 'f'] in as few characters as possible. ;)

Like I said, this is pretty low-level programming stuff... I've got an idea to make it FAR easier to input, but it's not there yet.

--

As for the 9 repeating, that's actually correct. All of those drivers are tied for 9th place with zero points. It would work the same way with any other ties.

--

One added thing that's probably not well-documented (yet):
pointStructure works differently than you'd expect, but is still pretty intuitive. The first position (position zero, since Python starts numbering from zero) is actually for a "fastest lap" bonus. If the race series doesn't have that bonus (like modern F1), set that to zero. The first place finisher points (and down the line from there) follow that bonus entry.

Michel--NL
22-01-2016, 21:49
okay I understand it with the car data...thnxs for the explanations on it.

If the game didn't crash this evening after 45 minutes of racing I could have made a nice demo from our PC League :(

One thing I would like to know.
We start with 30 minutes qualifying, 5 minutes warm-up, ±35 laps race.
Is it possible to start the packetgrab.py in the warm-up session?
Because between the end of the warm-up session and the beginning of the 35 laps race you have only 15 seconds when it starts the race. Have to run to the PC to start the packetgrab and hurry up, buckle up in the seat without falling on the floor :cool:

STEELJOCKEY
23-01-2016, 06:46
Bring the PC keyboard closer maybe?

Michel--NL
23-01-2016, 12:49
I made a comment at GitHub for the file https://github.com/SenorPez/project-cars-replay-enhancer/blob/master/show_participants.py
I dont know if you see that...never worked with GitHub :confused:

SenorPez
24-01-2016, 00:34
Good catch on the error in the participants script. I'm actually surprised that I apparently never forgot to supply a config file to it. I got the pull request and will merge it probably tomorrow (this is exactly how to use Github!). I ran a stress test on a bunch of single player races and found a couple of other slight errors, which I plan on bundling the fixes with your change into a 0.2.1...

Which will include a command line tool to take some of the pain of adding teams, cars, and points to config files.

(Sent from my phone on a train, so blame spelling errors on autocorrect.)

CplHamster
24-01-2016, 05:52
I love this and would really love to use it in my videos but I have no idea of where to start. Would it be possible for someone to help me out with it? maybe a step by step guide for someone that has never used python? as im sure im not the only one thinking this

Many thanks in advance

Michel--NL
24-01-2016, 08:45
I love this and would really love to use it in my videos but I have no idea of where to start. Would it be possible for someone to help me out with it? maybe a step by step guide for someone that has never used python? as im sure im not the only one thinking this

Many thanks in advance
What OS do you use?
For Windows I have to take more time to get it running...if it will run on Windows.
On Ubuntu i have it already running.

I could make a short guide to set it up.

Michel--NL
24-01-2016, 13:14
I made a step by step guide for Windows users.
Download link http://1drv.ms/1Qsvfzk
Feel free to make any comments about the guide :)

CplHamster
24-01-2016, 17:10
I made a step by step guide for Windows users.
Download link http://1drv.ms/1Qsvfzk
Feel free to make any comments about the guide :)

thats awesome, thanks a million, I do use windows, that should help all make sense :)

SenorPez
25-01-2016, 21:33
First: Starting the telemetry capture during the warm up should work just fine. The script should trim it to the race... if it doesn't, file an Issue in GitHub and work around it by just deleting the offending captured packets? :D


I made a step by step guide for Windows users.
Download link http://1drv.ms/1Qsvfzk
Feel free to make any comments about the guide :)

This is amazing and great. Thanks for putting this together! The one change I can think off the top of my head (and I need to change this in the demo wiki page, as well) is to have them download the 0.2 release instead of master. There's the possibility that, over time, master becomes incompatible with the demo files... yes, I plan on updating the demo occasionally but it's still a chance.

--

Now, for the last purpose of this message: Testers wanted! After writing out how to set car, team, and points data, I realized it's too complex. So I wrote a terrible script that makes it less terrible, and while I've managed to keep it from horribly breaking, I'm sure you all can find ways to make it horribly break.

Before I put a wall of text here, let me assure you: It's easier than it seems. Depending on your capture method, Step 3 only very rarely has to be re-run, and Step 5 becomes second nature after a few tries! There's a wall of text here so that someone with little experience in the concepts can understand and learn!

As I introduce the scripts, I need to introduce you to workflow, because it'll explain why there are three different scripts.


Create a new configuration file. This can be done by copying an existing configuration file, or by copying globals_template.py. (Which I'm probably going to rename.)
Set the general configuration parameters for the project. There's a question to be answered here: Do you have a bunch of previous data that you want to use as defaults. (Generally, this is "no" for the first race in a Career Mode series, Quick Race weekends, or Online Events, and "yes" for subsequent Career Mode series races.)

If "No", run python3 create_config.py new_config.py where new_config.py is the newly created file from Step 1.
If "Yes", run python3 create_config.py new_config.py old_config.py where old_config.py is the previous race's configuration file, while new_config.py is the newly created file from Step 1.

Set the video detection parameters for the project. Run python3 create_video.py new_config.py (or python3 create_video.py new_config.py old_config.py).
Render a test video to check on the blackframe detection and the start and stop of the video. I typically do a low-FPS render here to make sure of these things. If they need to be updated, return to Step 3. If they're fine, continue. The reason for this is because racestart is dependent on the start and stop of the video; changing them AFTER changing racestart would require a change of racestart.
Freeze the video as your car crosses the line to begin Lap #2. Using a video player such as VLC can help here, as it has the ability to advance a video frame-by-frame (mapped to the keyboard as "E" by default) to precisely get to the proper frame.

If the time on the clock shows that Lap 2 has already started, your telemetry is starting too soon and needs to be delayed more. Add the time on the clock to your current racestart value. For example, if on this frame, the clock shows 0.4 seconds, I would add 0.4 seconds to whatever racestart was set to for this render.
If the time on the clock shows that Lap 1 is still underway, your telemetry is starting too late and needs to be delayed less. Note the time on the clock. Advance the video until the telemetry shows your lap time (or gap to the leader... if you're not in first, add the gap to the leader's time). Take the difference between those times and subtract it from your current racestart value. For example, if on the start-finish line frame, the clock shows 30.0 seconds, and my lap time was 31.5 seconds, I would subtract 1.5 seconds from whatever racestart was set to for this render.

Modify racestart by running python3 create_racestart.py new_config.py. This script allows for both absolute entry of racestart (3.0) and relative entry of racestart (from our examples above, +0.4 or -1.5).
Render the video and make sure the telemetry is synced. If not, return to Step 5. If so, you're good to go!


The scripts (and a few changes to support them) will be checked into the 0.2.1-devel branch of the project soon. I plan on stress testing them with another 5 career mode races tonight, but initial tests have been good... but I'm hoping you can break them!

NOTE: There are a few parameters that still need to be manually updated in the configuration file, such as the header text on the titles. There's a reason for this, but that's simple text editing, as opposed to trying to populate an array with values based on arbitrary positions. ;)

OBigO
26-01-2016, 02:55
Hi! This looks great but I don't really know how to use it! I followed Michel's guide for windows and the demo video worked fine however I don't know where to go from here...I turned on udp and set it to 3 (is this right?!), I then ran packetgrab and opened a replay from an online league race, the data saved but I have no idea what to do next! I know nothing about code so if a similar guide could be made on how to use it that would be amazing!

Cheers!

azidahaka
26-01-2016, 12:51
Two halves here, and two answers:

For live video, no. Right now, the script isn't fast enough to process telemetry packets and render video packets to keep up in real time.

However,

If all you want is data, it's fast enough to do that. Silently living in the repository is a "racestandings.py" script. It would require a bit of work to get working again since I've changed a few things since it was created, but it was used as a "proof of concept" to get sector and lap times.

Output looks something like this (ignore the blank sector 2, like I said, it's a bit out of sync with telemetry parsing):
http://i.imgur.com/tm9C3nD.png

This *is* fast enough to render in real time; I tested that. With a bit of effort you could convert it to output a dynamic web page instead of terminal text, which might be exactly what you're looking for.

Man i hate this forum lack of replay notifications... I completely forgot about this, but for me it would be great to have something like that, but in a different fashion like,

output a text file each lap with written on it position of all drivers, lap times and gap between them so that at the end of the race you have a lap by lap report from wich you can figure eventual crashes or pits to review post race for creating some highlights or for race stewards to check...

Not sure i managed to explain myself properly :P

Michel--NL
26-01-2016, 17:39
First: Starting the telemetry capture during the warm up should work just fine. The script should trim it to the race... if it doesn't, file an Issue in GitHub and work around it by just deleting the offending captured packets? :D
okay thnxs


This is amazing and great. Thanks for putting this together! The one change I can think off the top of my head (and I need to change this in the demo wiki page, as well) is to have them download the 0.2 release instead of master. There's the possibility that, over time, master becomes incompatible with the demo files... yes, I plan on updating the demo occasionally but it's still a chance.
Don't you think it is better to create a demo branch with the demo files. So people always could test a 'master' demo branch instead of using 'development' .x releases? (It's just me thinking out loud :cool:)


Large text about the new settings
I'm going to try this out.

If have some strange results after doing the replay and show_participants and I don't know if its because people are leaving in the middle of the race. This is tested with the code from a few days ago.
With the show_participants I have two players with the same number and one player with the name 'MxGD22' but it shows as 'MxGD22al'
Did you keep up in the code with players leaving during the race?

I use the vrhive app while i'm racing and I must say that at one moment the standings where corrupt. It showed my own name as second during race. I was first at that moment.
So it could be that the telemetry files are corrupted

Michel--NL
26-01-2016, 20:52
Hmmm this is also strange
Captured online race with 6 players and viewed the participants

michel@ubuntu:~/project-cars-replay-enhancer-0.2.1-devel$ python3 show_participants.py config_online.py
0: Michel--NL
0: gumbalie52
1: ThechobeLX
2: TakTix_86-X
3: A_NUT_MONKEY
3: A_PizzoniaY
3: Michel--NLY
4: Michel--NL_Sa
5: A_Pizzoniaaaaa
6: BoereJackl
7: fonsmeister
8: DeTjuK340G_S
9: CARCOCOONING_Sa
10: bannaramma123
11: cry4468

Some people (#6, 7, 8) are in the list and they didn't race. They where from a race yesterday.
It looks like the UDP stream is not reliable for online races or there is something terrible wrong with my home network :(
Tomorrow I will do some more tests

UDP Packet:

ŠAston Martin V12 Vantage GT3 GT3 Brands Hatch ionale Monza Grand Prix gumbalie52 Thechobe L X TakTix_86 -X A_NUT_MONKEY Michel--NL _S a A_Pizzonia aaaa BoereJack l fonsmeister DeTjuK 340 G_S CARCOCOONING_S a bannaramma123 cry4468

SenorPez
27-01-2016, 12:35
It looks like the UDP stream is not reliable for online races or there is something terrible wrong with my home network :(
Tomorrow I will do some more tests

UDP Packet:

ŠAston Martin V12 Vantage GT3 GT3 Brands Hatch ionale Monza Grand Prix gumbalie52 Thechobe L X TakTix_86 -X A_NUT_MONKEY Michel--NL _S a A_Pizzonia aaaa BoereJack l fonsmeister DeTjuK 340 G_S CARCOCOONING_S a bannaramma123 cry4468

There's a known issue with the packets occasionally "collecting" garbage throughout time. It's not your home network; it's a function of the program dumping data to the packet. There's some error handling in place, but it's clearly not enough!

Can you send me the tele.csv for this race, and the race you mentioned in your previous post where people left and joined. I would guarantee there are gaps... as I've mentioned before, my Internet connection isn't stable enough to do a lot of online racing, so those tele.csv's will help me make the code more robust!

Unrelated, I've found a few bugs in 0.2.1... including in the config_ scripts. Fixes are being pushed as I can. (Thanks SMS, for having Dubai replays--but not others--not use fade-through-black between scenes. It's really helpful.)

SenorPez
27-01-2016, 12:41
Hi! This looks great but I don't really know how to use it! I followed Michel's guide for windows and the demo video worked fine however I don't know where to go from here...I turned on udp and set it to 3 (is this right?!), I then ran packetgrab and opened a replay from an online league race, the data saved but I have no idea what to do next! I know nothing about code so if a similar guide could be made on how to use it that would be amazing!

Cheers!

One note: Telemetry captured during a replay will have less-than optimal results (in fact, I'm not quite sure what it'll do). There is telemetry broadcast when viewing a replay, but there's a lot of things missing. A lot of what's missing wouldn't affect the current modules for the Replay Enhancer, but some of it does. For example, the replay telemetry doesn't actually include car classifications, so to determine who's in first, second, third, etc. you'd need to calculate it against their position in the world... which we currently don't do. You'll get the expected results by capturing the telemetry during the actual race.

It's probably a bit too dense, but you can try following the instructions included in the README.md file; it's probably easiest to just view it at https://github.com/SenorPez/project-cars-replay-enhancer so that the Markdown syntax is parsed! If you have questions, feel free to PM me or ask here!

My next "documentation push" will include a "Your First Video" tutorial to be run after the Demo successfully builds.

Rest assured I'm hard at work--with the caveat that this is a side project instead of my actual Wage Slave job--filing down the rough edges, squashing bugs, and making the Replay Enhancer more friendly to use!

SenorPez
27-01-2016, 12:43
Man i hate this forum lack of replay notifications... I completely forgot about this, but for me it would be great to have something like that, but in a different fashion like,

output a text file each lap with written on it position of all drivers, lap times and gap between them so that at the end of the race you have a lap by lap report from wich you can figure eventual crashes or pits to review post race for creating some highlights or for race stewards to check...

Not sure i managed to explain myself properly :P

That sounds like it can be done. One of the things that drives the Replay Enhancer is its ability to parse the telemetry captured from a race. It would just be a matter of wrangling the data into your expected output. (Note too that there's currently no pitstop detection; that's coming in 0.3 with some thanks to mr_belowski.)

SenorPez
27-01-2016, 12:44
If I missed anyone's comments or questions, please remind me that I miss your comment or question; I'm not purposely ignoring you. I've been down a rabbit hole with real life for a few days. ;)

azidahaka
27-01-2016, 15:19
That sounds like it can be done. One of the things that drives the Replay Enhancer is its ability to parse the telemetry captured from a race. It would just be a matter of wrangling the data into your expected output. (Note too that there's currently no pitstop detection; that's coming in 0.3 with some thanks to mr_belowski.)

That sounds really great!

I guess the best output would be something on the lines of this:

Track: xxxxxx Laps/time:xxxx

Starting Grid

1.
2.
...
16.

End of race result

Position driver gap
1.
2.
...
16.

Fastest Lap: xx:xx:xxx on lap x by driver x car x

Lap by lap break down

Lap 1

Position driver gap
1.
2.
...
16.


Lap 2
Position driver gap
1.
2.
...
16.


and so on.

If data for pits/crashes/damages would available that would be above great!

Michel--NL
27-01-2016, 18:04
There's a known issue with the packets occasionally "collecting" garbage throughout time. It's not your home network; it's a function of the program dumping data to the packet. There's some error handling in place, but it's clearly not enough!

Can you send me the tele.csv for this race, and the race you mentioned in your previous post where people left and joined. I would guarantee there are gaps... as I've mentioned before, my Internet connection isn't stable enough to do a lot of online racing, so those tele.csv's will help me make the code more robust!

Unrelated, I've found a few bugs in 0.2.1... including in the config_ scripts. Fixes are being pushed as I can. (Thanks SMS, for having Dubai replays--but not others--not use fade-through-black between scenes. It's really helpful.)

1. Link for players that should not be there and lot of players quit http://1drv.ms/1RO00jn
2. Link with players quit http://1drv.ms/1RO05Ue YouTube video https://www.youtube.com/watch?v=_xB9bEEbJ1g

Participants from link1
michel@ubuntu:~/project-cars-replay-enhancer-0.2.1-devel$ python3 show_participants.py config_online.py
0: Michel--NL
0: gumbalie52
1: ThechobeLX
2: TakTix_86-X
3: A_NUT_MONKEY
3: A_PizzoniaY
3: Michel--NLY
4: Michel--NL_Sa
5: A_Pizzoniaaaaa
6: BoereJackl
7: fonsmeister
8: DeTjuK340G_S
9: CARCOCOONING_Sa
10: bannaramma123
11: cry4468

Participants from link2. Note the numbers 8
michel@ubuntu:~/project-cars-replay-enhancer-0.2.1-devel$ python3 show_participants.py config_race4.py
0: RobinNova
1: sp0rtl1fe
2: DeTjuK
3: dennisvandenb
4: fonsmeister
5: M1d4s010
6: roflmannetje
7: Ha4anova
8: Michel--NL
8: MrMistral
8: MxGD22al
9: BoereJack
10: Michel--NL
11: MxGD22
12: fonsmeister

SenorPez
28-01-2016, 20:28
Okay, three things:

Final test renders for 0.2.1 are happening right now, to my home server's dismay. (Current load average: 25.0!) If everything comes out the other end okay, 0.2.1 will release with mostly bug fixes.

Second, there are some (big) problems with the participant detection code... the triggers that I had in there to see changing lists apparently never made it into the codebase. While I'd initially planned on using the 0.3 release to add pitstop and long-distance race support (since the next single player career race on my docket is the 3HR McLaren F1 race), I'm pushing that back to 0.4. Instead, I'm christening 0.3 to the Multiplayer Support Release.

Which leads to the third point: If you race online, and are willing to do so, please send me telemetry captures. The more captures I have the more I can test support for changing participant lists, garbage in the name fields, etc. If you want to include replay videos (via YouTube or any other way), you can also do that, but that's not required.

Thanks!

Michel--NL
28-01-2016, 20:48
Great to hear you are going for the multiplayer support :)
Tomorrow evening I have a new online race with about 35 laps. I will post the telemetry files.

SenorPez
29-01-2016, 14:44
0.2.1 has been released. It includes a number of bugfixes from the 0.2 release as well as configuration scripts so that you never have to manually edit a configuration file again.

The release can be downloaded here:
https://github.com/SenorPez/project-cars-replay-enhancer/releases

Michel--NL
29-01-2016, 21:14
New telemetry data http://1drv.ms/1PnUime from 30 laps multiplayer race. The ±15 minutes at the end of the data does not belong to the race.
YouTube video https://www.youtube.com/watch?v=qkS3dh4MmRA

11 players in the session. As you can see the names are not correct from show_participants

michel@ubuntu:~/project-cars-replay-enhancer-release-0.2.1$ python3 show_participants.py config_race5.py
0: M1d4s010
0: RobinNova
1: Bacotje30
1: Michel--NL
2: KrYpt0n-nL
2: Michel--NL
2: MxGD22-NL
3: MxGD22
3: STOMATVD
4: M1d4s010
4: STOMATVD
5: KrYpt0n-nLnb
5: dennisvandenb
6: M1d4s010
7: DeTjuK
8: roflmannetje
9: KrYpt0n-nL
10: BoereJackus
11: BoereJack

Michel--NL
30-01-2016, 18:02
Is it possible to show Best Lap as minutes and not total seconds?

226412

SenorPez
01-02-2016, 02:41
Is it possible to show Best Lap as minutes and not total seconds?

226412

That's odd. It should be running through the formatter that does force it to MM:SS.
*checks source code*
*checks Kart One Championship videos I made* (specifically, Dubai, since it has >60 second laps for backmarkers)
Oops.

Yeah, I'll get that fixed. If you want to file a bug on Github so I don't forget, please do. :)

Couple of good fixes in the pipe; going to try to push them out this week, but I'm not 100% sure of my available time this week. Real-job clients are... troublesome... at times. ;)

stevielow
01-02-2016, 19:15
I recently tried to use this app, however after looking at it, it is clear that unless you have a degree in pc terms, its as clear as mud!

I appreciate that it might be for people that want to enhance video's and these people will probably understand all the jargon, but I have no idea.

Can someone please give me some simple (idiot proof) instructions on how to start it and use it.

I do post video's on you tube and would love to "enhance them"

Thanks

SenorPez
02-02-2016, 01:09
I recently tried to use this app, however after looking at it, it is clear that unless you have a degree in pc terms, its as clear as mud!

I appreciate that it might be for people that want to enhance video's and these people will probably understand all the jargon, but I have no idea.

Can someone please give me some simple (idiot proof) instructions on how to start it and use it.

I do post video's on you tube and would love to "enhance them"

Thanks

Improvements to the replay enhancer in the next release will make it much easier to use, in addition to making it more useful. There are some gaps in the coverage. I apologize for the technical nature of it, but it's coming along nicely to be able to be used by people without advanced degrees. :)

iLiam
02-02-2016, 16:03
Hey SenorPez,

Awesome app, although admittedly haven't actually had a chance to use it yet. I set everything up yesterday after following the thread for a while. I stopped at the point where I realized I needed the replay already exported. So I have 2 questions, one related, one not. Is there a way to run the enhancer and export just it's video that I can then add separately to the replay video in post production. And secondly, are there plans for a more GUI solution? I'm a relatively tech savvy guy, but was very thankful for Michel's guide. Thank you so much and great work.

Michel--NL
02-02-2016, 17:16
Yeah, I'll get that fixed. If you want to file a bug on Github so I don't forget, please do. :)
Create the bug on Guthub ;)

SenorPez
04-02-2016, 03:23
Hey SenorPez,

Awesome app, although admittedly haven't actually had a chance to use it yet. I set everything up yesterday after following the thread for a while. I stopped at the point where I realized I needed the replay already exported. So I have 2 questions, one related, one not. Is there a way to run the enhancer and export just it's video that I can then add separately to the replay video in post production. And secondly, are there plans for a more GUI solution? I'm a relatively tech savvy guy, but was very thankful for Michel's guide. Thank you so much and great work.

First:
You could create a video on a transparent background, with the telemetry overlays playing. The default replay.py doesn't have this (it loads a source video), but with some tweaks and twists in MoviePy, that could certainly be done. In thinking through it, right now it probably breaks if you don't pass a source video, but in the next release (see below), I should eliminate that dependency so that you can do what you want to do.

Second:
While a GUI would be farther down the road than I can predict (not to mention my knowledge of Python), the next release will be more "friendly." I don't want to overpromise, but stay tuned... it should be easier to use without knowing as much about Python. I'm not sure I'm going to be able to turn it out this week, but it won't be for lack of trying!

iLiam
04-02-2016, 15:52
Awesome info Pez. Thanks for the first clarification, and anxiously awaiting the next release with the friendly enhancements, whether thats this week or next. Great work, and I appreciate the info.

SenorPez
04-02-2016, 20:01
I'm just going to leave this here as a teaser for work-in-progress:

http://i.imgur.com/KG0cBDM.jpg?1

azidahaka
05-02-2016, 15:01
Any news on the race-report?

Oh, in case there's no interest in it do not bother going lenghts off your own road, i guess that is one of those things that are not of general interest to the masses

SenorPez
05-02-2016, 23:35
Any news on the race-report?

Oh, in case there's no interest in it do not bother going lenghts off your own road, i guess that is one of those things that are not of general interest to the masses

I'm still planning on working on it, because it does interest me, and will be a useful way to make sure metrics are properly calculating in replays, too!

Right now, I'm making things more robust for multiplayer support, which will directly benefit the race report. It'd be kind of useless if it broke on multiplayer telemetry all the time!

SenorPez
09-02-2016, 20:43
The 0.3 Development branch is ready for open testing. If you're so inclined, please feel free to give it a shot, because while my own testing has been successful to this point, I'm sure there are sharp edges here and there, or telemetry files out there, that will still break things! If you do have trouble, please don't hesitate to post or PM; I'll be more than happy to help out, time allowing. You can get the branch from here: https://github.com/SenorPez/project-cars-replay-enhancer/tree/0.3-devel

I'm hoping to push this release out by this weekend. That'll depend on how horribly I can break it.

Before going any further, note that the main program is no longer replay.py, but rather ReplayEnhancer.py.

If you don't care about what's new, and just want to know how to use it, just down to the red text below.

What's New?
Short answer: Lots.
Long answer: LOOOOOOOOOOOOOOOOOOOOOOOOOOOTS
Actually useful answer: A lot of under-the-hood changes that no one will care about, and a new interface and configuration file standard that everyone will care about.

Under the hood, the codebase has been moved into an object system, so expansion is easier. Things are a bit faster, too, and there's some mostly-hidden support to ease your pain while working on large datasets. Multiplayer environments are better supported, so players coming and going won't cause too much trouble anymore. Like I said, YAWN.

Above the hood, however, there's a lot to enjoy.

First, configuration files are no longer Python files. They're now easily-readable JSON files. If "JSON" means nothing to you, think of it this way: Instead of an arcane string of letters and numbers and symbols for configuration, you now have "key" : "value" pairs that are easily readable in a text editor. And, of course, editable by hand, if you so choose.

But you don't HAVE to choose that anymore. The program is now more mature with regard to it's command line invocation, as well as having a better automatic workflow.

Here's the rundown:

python3 ReplayEnhancer.py or python3 ReplayEnhancer.py -c Running the program with no arguments or the "-c" option with no argument will create a new configuration file from scratch. There are some intelligent defaults provided, but for the most part, you'll have a blank slate.
python3 ReplayEnhancer.py -c race1_config.json Running the program with the "-c" option and a configuration file will edit that configuration file. Existing values are provided as defaults (just hit ENTER to accept a default), modifications are written to the file.
python3 ReplayEnhancer.py -t race1_config.json Running the program with the "-t" option will adjust the video trimming parameters. NEW IN THIS RELEASE you can skip blackframe detection, and just manually tell the Replay Enhancer where to start and stop your video. Want to start 30 seconds in and end 60 seconds in? Doable.
python3 ReplayEnhancer.py -r race1_config.json Running the program with the "-r" option adjust the telemetry synchronization. A bit more on this coming up after this list.
There are "-v" and "-h" options, for "version" and "help" respectively. Check them out.
Ready to finally produce your video? Just run it without any options and provide a configuration file. python3 ReplayEnhancer.py race1_config.json


If you provide the -c (or no configuration file, equivalent to creating a new file), -t, or -r options, the Replay Enhancer will create a subcut, low-quality video automatically, consisting of the first three minutes and last one minute of the expected output. This is so that you can verify the trimming and telemetry synchronization!
(Note: I think I can make this more intelligent, but for now, it's better than the old system.)

THE PROMISED RED TEXT: "Shut up and just tell me how to use the damn thing."
Okay, sorry. Here's usage in a nutshell:

Run python3 ReplayEnhancer.py.
Enter your configuration. When complete, the Replay Enhancer produces a 4:00 long video of low quality for your review.
If the video trimming (either scenes to skip and the start and end if using blackframes, or seconds if using absolute times) needs to be adjusted, run python3 ReplayEnhancer.py -t config.json where config.json is the file you created in Step 2. Again, a low quality video is created to review. Repeat this step until it's correct.
Play that low-quality video until the subject car (typically yours) crosses the Start-Finish line to begin Lap 2. (Note that sometimes this is difficult... I suggest using a video player such as VLC that can advance frame-by-frame.) Look at the Timer. Since it should say "0.00" for the start of Lap 2, the number currently shown is your synchronization offset.
Run python3 ReplayEnhancer.py -r config.json and enter your synchronization offset. Once more, a low quality video is created for review.
Time to make the donuts! Run python3 ReplayEnhancer.py config.json to create a full-quality, full-length, 30fps video of your enhanced replay!


If you've made it this far, you're awesome.

A few notes:

When I look for my synchronization offset, the car is still in Lap 1. You've clipped the video to start after the actual race starts. You can either change the start time, or set a negative synchronization offset. That offset would be equal to your "time at the line" minus your Lap 1 time (as displayed in the Standings tree in the enhanced replay).
It's horribly broken... That's why I'm having an open test. I'm 100% sure you can break this, and I want to know about it. Let me know and I'll:

Get the bugs fixed.
Help you build an enhanced replay at the same time!

Can I do something other than Title > Replay (with Standings and Timer) > Results > Series Standings? Aside from showing an additional card with a Series Champion on it, no. For a certain definition of no. The answer is actually yes: Directly running the Replay Enhancer only allows for the default video sequence to be created. But you can use all the components and create your own video sequence, too... I've just not documented it at all yet.
Your code is awful. Yes, I know. If you'd like to help, please do.
I have an idea for and improvement, bug fix, display module, or $1M idea. Head over to the GitHub page and file bugs and improvements you want to see. You can also code things yourself! Or just tell folks about it and maybe someone will help you out... but if we don't know your idea, we can't help!


Lastly, special thanks to everyone who sent me Multiplayer telemetry, especially Michel--NL. I couldn't have done any of this... which would have made this thing pretty useless, right?... without those datasets!

Done now, I think.

SenorPez
09-02-2016, 20:55
Just realized that I forgot the complete track data. Coming soon. In the meantime, if you get a Track detection error, and are so including, you can add it to the track_data.json. Or just hang on for a few hours.

SORRY.

Raymond de Vries
09-02-2016, 21:12
Sorry to interfere here, but I was wondering if it is possible to export the extracted data into a scrolling bar at the bottom of the screen? Lap1. 1. Ludo bachelli 11.11 2. Rick fencebar 11.12 3. Claudia humpfzach 11.13 enz...

Grtz

SenorPez
09-02-2016, 22:00
Just realized that I forgot the complete track data. Coming soon. In the meantime, if you get a Track detection error, and are so including, you can add it to the track_data.json. Or just hang on for a few hours.

SORRY.

Okay, I pushed a commit to fix this issue in the 0.3 branch, and changed up the error handling in the Track object a bit. Now if you don't have a matching track, instead of killing the program, it'll just disable pitstop detection. Which for many races, might be no change at all!

SenorPez
09-02-2016, 22:09
Sorry to interfere here, but I was wondering if it is possible to export the extracted data into a scrolling bar at the bottom of the screen? Lap1. 1. Ludo bachelli 11.11 2. Rick fencebar 11.12 3. Claudia humpfzach 11.13 enz...

Grtz

That, in fact, is #1 on my list of "Modules to Create." There are some technical challenges surrounding the actual implementation of it. And you're not interfering; suggestions are ALWAYS a good thing!

After 0.3 goes out the door (which made the enhancer useful for multiplayer!), I'm going to start working on other things, first of which will be azidahaka's race report and then probably some fancier modules like these. I'd say the "Wanted Modules" list would look something like this:

Ticker
Trap Speed (pick a place on the track for a speed trap, and pull speeds)
Pit Stop Timer
Live Split Data


I'd, of course, love to improve the actual module GRAPHICS too, but I'm no artist. :D

Joost1991
10-02-2016, 20:34
Hi SenorPez,

awesome thing you're creating here! I would like to contribute a bit, but I'm having some troubles with the 0.3 version. When i'm creating the config I'm receiving this error:


c:\users\ms\documents\projecten\project-cars-replay-enhancer-master\configuration.py(603)new_configuration()
-> while True:
(Pdb)

Just after 'Enter subheading text'. Any ideas?

SenorPez
11-02-2016, 15:07
Hi SenorPez,

awesome thing you're creating here! I would like to contribute a bit, but I'm having some troubles with the 0.3 version. When i'm creating the config I'm receiving this error:


c:\users\ms\documents\projecten\project-cars-replay-enhancer-master\configuration.py(603)new_configuration()
-> while True:
(Pdb)

Just after 'Enter subheading text'. Any ideas?

Oops. I left a debugging statement active in the code (there was an error causing the point structure to not create properly if using an existing configuration file), which is why the debugger is launching without an error information.

I just pushed another checkin to the branch, so you can either update your files, or you can enter "c" followed by enter to tell the program to "Continue".

Michel--NL
12-02-2016, 21:04
Ok tested the new scripts and you made it really easy now :)
I like the short video you create for adjusting things before creating the final video.

I have still a question about the trimming.
This is the situation.
When the video starts the timer is already running before the start. The race begins when the timer is saying ±5 seconds.
If I look at the timer beginning with lap 2 it says 1.40 after 7 seconds the timer resets to zero and starting lap 2.
So I think I need to change the trimming to -7.0 (negative)
After adjusting the trimming and creating the short video, passing the finish for the second lap is ok. But the timer is adding 7 seconds with the race start, so when the race begins it is not ±5 seconds but ±12 seconds.

When I tested an other race where I needed to put a positive trimming +5.0 seconds then it is ok.
Is it possible that there is something wrong with negative times on the trimming option?

SenorPez
15-02-2016, 03:46
Sorry for the delay in responding and releasing. I've spent most of the weekend shoveling snow and getting ready for a big week at work, so I've not made the progress I've wanted to make. (I love you guys, but the paying job comes first, for obvious reasons!)

First: 0.3 is still be tested. It turns out I needed to do a major rework on some of the modules, due to how the telemetry acts if players drop out after a race has finished. If you finish 2nd and then drop out before the race "finishes" (where you get kicked), you... don't show up as 2nd place in the telemetry. There's been a lot of cleaning and consolidation, but that all takes time, and will totally be worth it.


Ok tested the new scripts and you made it really easy now :)
I like the short video you create for adjusting things before creating the final video.

I have still a question about the trimming.
This is the situation.
When the video starts the timer is already running before the start. The race begins when the timer is saying ±5 seconds.
If I look at the timer beginning with lap 2 it says 1.40 after 7 seconds the timer resets to zero and starting lap 2.
So I think I need to change the trimming to -7.0 (negative)
After adjusting the trimming and creating the short video, passing the finish for the second lap is ok. But the timer is adding 7 seconds with the race start, so when the race begins it is not ±5 seconds but ±12 seconds.

When I tested an other race where I needed to put a positive trimming +5.0 seconds then it is ok.
Is it possible that there is something wrong with negative times on the trimming option?

Just to make sure we're talking about the same thing.

The trimming (-t option on the script) is what you use to cut the video for the replay. In 0.3 trimming should never be negative. If using the blackframe detection method, 0 and 0 will just do no trimming. If using manual trimming, it's just seconds into the video, so always a positive number.

The synchronization offset (-r option on the script) is what's used to sync up. In reading your post, I'm not sure what's happening there if you are referencing the synchronization. If the timer says 1.40 when you cross the start-finish line to START lap 2, it shouldn't reset to 0 after 7 seconds...

Two things to note here:

The first time you cross the start finish line (in Lap 1), you can't use that for synchronization. The Lap 1 time INCLUDES the time it takes you to get from your grid position to the start finish line, PLUS the time of the lap. That's as intended, and why Lap 1's are always slower.
The synchronization is reset to 0.0 if you change the trimming. Ideally this should only reset if you change the start trimming, but right now that logic isn't built in. It will be soon.


If you're still having problems, however, I'm always willing to look at data and see what's happening!

Michel--NL
16-02-2016, 19:14
Thanks for the clarification. I was thinking that I only had to use the trimming option :ambivalence:
Will try it again and this time read your post better ;)

SenorPez
17-02-2016, 17:15
Barring any further problems found in the next few days of testing, 0.3 should be released Friday. I know it's late, but stay tuned. What you're getting is faster, easier to use, and easier to extend!

Michel--NL
19-02-2016, 09:06
First video with Replay Enhancer....looks amazing :)


https://www.youtube.com/watch?v=vAu5Zao2zyw

SenorPez
19-02-2016, 21:05
Ladies and gentlemen, boys and girls, I'm proud to admit that the 0.3 Release of the Project CARS Replay Enhancer is now available for download.

It is easier to use.
It is faster to create videos.
It has support for a wider array of race situations in single- and multiplayer.

How do I get it?
The short version: Download from here: https://github.com/SenorPez/project-cars-replay-enhancer/releases/tag/release-0.3
The long version: Michel--NL wrote and excellent guide to getting Python and the required modules up and running on a Windows machine here: http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer&p=1218881&viewfull=1#post1218881. Most of it is still applicable, with the exception that the main script is now ReplayEnhancer.py instead of replay.py and the configuration files end in .json instead of .py.

How do I make sure it's working?
There's a demo routine available. Follow the instructions here: https://github.com/SenorPez/project-cars-replay-enhancer/wiki/Demo
Michel--NL's document also walks through the generation of the demo output.

How do I use it on my own videos?
The README.md file contains basic usage of the Replay Enhancer, and should have everything you need to get started.
Instructions on custom videos will be coming soon.

Is there a GUI?
Not yet... but don't walk away yet.
First, a GUI is on my roadmap. See below.
Second, you no longer need a degree in computer file editing to configure the Replay Enhancer. Running the script will also run the included configuration generator. Answering the prompts will create your configuration for you; no more direct file editing necessary! (Unless you, of course, want to directly edit files, in which case configuration files are now human-readable JSON.)

What does the future hold?
In no particular order, except where noted:

If any major bugs or needs are found, a 0.3.1 release.
Race Marshal report. Requested a few pages back, that's the next thing I'm going to be working on.
New modules, such as a race standings "ticker" or speed trap display.
A GUI interface to the Replay Enhancer. I'm hoping this can just be a GUI interface to the underlying program.
Refactoring to capture speed improvements.
Packaging into an actual executable Python package.


I'm having problems. I have questions. I have suggestions.
Please feel free to reach out if you're struggling in any way with using the Replay Enhancer. It's a lot less rough than it was at 0.1, but that's not to say it's perfect. If you have questions about operation, think you're running into a bug, or have suggestions, you can contact me in whatever way is easiest to you (and doesn't break forum rules, of course). Post here, PM me here, or file issues at the Github page at: https://github.com/SenorPez/project-cars-replay-enhancer/issues

BulletEyeDK
20-02-2016, 10:40
Really nice work

Im setting up a virtual machine using Ubuntu 14.04, have installed all the packages you describe...
I've grabbed UDP traffic from a test run (4 lap race) - secured the video and is now struggeling a bit with "ReplayEnhancer.py" - Im all the way past entering driver data...

But the enhancer stops running and reports this:

Traceback (most recent call last):
File "ReplayEnhancer.py", line 756, in <module>
ReplayEnhancer.new_configuration()
File "ReplayEnhancer.py", line 458, in new_configuration
replay = cls(config.config_file)
File "ReplayEnhancer.py", line 41, in __init__
self.font = ImageFont.truetype(json_data['font'], json_data['font_size'])
File "/usr/local/lib/python3.4/dist-packages/PIL/ImageFont.py", line 239, in truetype
return FreeTypeFont(font, size, index, encoding)
File "/usr/local/lib/python3.4/dist-packages/PIL/ImageFont.py", line 128, in __init__
self.font = core.getfont(font, size, index, encoding)
File "/usr/local/lib/python3.4/dist-packages/PIL/ImageFont.py", line 37, in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed

I've googled this, and it seems to be a broken PIL installation ?

I've tried apt-get install python-imaging which also installs something... but the error will still appear... can someone guide me in the right direction ?

BulletEyeDK
20-02-2016, 11:46
@ SenorPez

I've googled my error message a bit, and still havent found a solution

If i'll go with a clean ubuntu 14.04 installation could you please point out which packages i need to install and in what order, it sems to be something corrupted with my python enviroment, and some of the google results i got, people didn't find a solution to their similar error message...

Thanks in advance...

Michel--NL
20-02-2016, 11:48
Really nice work

Im setting up a virtual machine using Ubuntu 14.04, have installed all the packages you describe...
I've grabbed UDP traffic from a test run (4 lap race) - secured the video and is now struggeling a bit with "ReplayEnhancer.py" - Im all the way past entering driver data...

But the enhancer stops running and reports this:


I've googled this, and it seems to be a broken PIL installation ?

I've tried apt-get install python-imaging which also installs something... but the error will still appear... can someone guide me in the right direction ?

Maybe its a problem with the pip version you installed. You need to have pip3 installed and with pip3 install MoviePy

What does it say when you run pip3 show moviepy


michel@ubuntu:~$ pip3 show moviepy
---
Name: moviepy
Version: 0.2.2.11
Location: /usr/local/lib/python3.4/dist-packages
Requires: numpy, decorator, imageio, tqdm
michel@ubuntu:~$

Michel--NL
20-02-2016, 11:49
Could you use Windows? try this manual I created http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer&p=1218881&viewfull=1#post1218881

BTW the programs are listed here https://github.com/SenorPez/project-cars-replay-enhancer/blob/master/README.md

BulletEyeDK
20-02-2016, 12:16
Could you use Windows? try this manual I created http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer&p=1218881&viewfull=1#post1218881

BTW the programs are listed here https://github.com/SenorPez/project-cars-replay-enhancer/blob/master/README.md

I actually followed the page for installing all the packages :)

regarding moviepy:
Metadata-Version: 2.0
Name: moviepy
Version: 0.2.2.11
Summary: Video editing with Python
Home-page: UNKNOWN
Author: Zulko 2015
Author-email: UNKNOWN
License: see LICENSE.txt
Location: /usr/local/lib/python3.4/dist-packages
Requires: decorator, tqdm, imageio, numpy

BulletEyeDK
20-02-2016, 12:18
I'll try running it through windows... will follow your guide...

Michel--NL
20-02-2016, 12:20
I'll try running it through windows... will follow your guide...

Did you use Ubuntu Desktop or Server version?
Will try to create a new setup and see if there is a problem somewhere

BulletEyeDK
20-02-2016, 12:23
Ubuntu desktop 14.04.4 downloaded yesterday...

Michel--NL
20-02-2016, 13:16
Ubuntu desktop 14.04.4 downloaded yesterday...

Okay same error for me.
It is missing libfreetype6-dev. To resolve it try this:

sudo apt-get install libfreetype6-dev
sudo pip3 uninstall pillow
sudo pip3 install pillow (will compile new version with the libfreetype6-dev)


If you have a clean install of Ubuntu then go this way:
Install PIP3
sudo apt-get install python3-pip

Install moviepy (this will also install NumPy)
sudo pip3 install ez_setup
sudo pip3 install moviepy

Install natsort
sudo pip3 install natsort

Install Pillow
sudo apt-get install libfreetype6-dev
sudo apt-get install libjpeg-dev
sudo apt-get install zlib1g-dev
sudo pip3 install pillow

BulletEyeDK
20-02-2016, 13:21
Damn you are fast ;)

Im still installing Visual Studio Community 2015 edition, as i went with the full package, ha ha...

I'll give it a shot with Windows, but will test your Ubuntu packages, eventhough i have installed all the packages you mention ;)

Michel--NL
20-02-2016, 13:44
Hmmm strange I had the same error and solved it with uninstall pillow, install libfreetype6-dev and install Pillow again.

Browsing through the error report of Pillow I found that it can use multiprocessor. If you have multiprocessor use it, it makes a big different.
If you change you'r virtual machine with more cpu, then you have to uninstall and install pillow again. It needs to compile again to take advantage of the multiprocessors.

1CPU takes about 13 minutes
227933

4CPU takes about 4 minutes
227934

SenorPez
20-02-2016, 14:46
Look, a new error! I'll see if I can create a virtualenv that reproduces it.

The other thing that I thought of, and probably should mention, and add some code to check: As Pillow only supports scaling with TrueType or OpenType fonts, that's what you have to use. It's probably not much of an issue since most fonts fall into those categories, but it could be causing that imaging module error?

BulletEyeDK
20-02-2016, 14:53
I used the 2 fonts in your package

BulletEyeDK
20-02-2016, 15:30
Thanks for helping me out, i really appreciate your approach...

I've tried using python with windows, and follows the guide, but unfortunally it generates an error, see the picture.

I went back to the virtuel Ubuntu, and followed the uninstall-install.... which also resulted in a longer run for me with ReplayEnhancer.py this time, but then after processing some of the telemetry it generates this error:


To synchronize telemetry with video, run the Project CARS Replay Enhancer with the `-r` option.
Set the synchronization offset to the value shown on the Timer when the viewed car crosses the start finish line to begin lap 2.
Please wait. Telemetry being processed and rendered. If this is the first time this data has been used, it make take longer.
Using Track: Brands Hatch Indy
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/moviepy/video/VideoClip.py", line 277, in write_videofile
codec = extensions_dict[ext]['codec'][0]
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ReplayEnhancer.py", line 756, in <module>
ReplayEnhancer.new_configuration()
File "ReplayEnhancer.py", line 476, in new_configuration
output.write_videofile(replay.output_video, fps=10, preset='superfast')
File "<decorator-gen-51>", line 2, in write_videofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "<decorator-gen-50>", line 2, in write_videofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "<decorator-gen-49>", line 2, in write_videofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/usr/local/lib/python3.4/dist-packages/moviepy/video/VideoClip.py", line 279, in write_videofile
raise ValueError("MoviePy couldn't find the codec associated "
ValueError: MoviePy couldn't find the codec associated with the filename. Provide the 'codec' parameter in write_videofile.
morten@ubuntu:~/pCARS/replay0.3$


This was the windows error i got when trying to install moviepy:
227936

Michel--NL
20-02-2016, 16:44
Thanks for helping me out, i really appreciate your approach...

I've tried using python with windows, and follows the guide, but unfortunally it generates an error, see the picture.

I went back to the virtuel Ubuntu, and followed the uninstall-install.... which also resulted in a longer run for me with ReplayEnhancer.py this time, but then after processing some of the telemetry it generates this error:




This was the windows error i got when trying to install moviepy:
227936

For the Windows error I reproduced the error.
I believe you did a default install? If you used the guide then it would be ok :o I will make a note in the guide.
Because of the default installation the Common Tools for Visual C++ are not installed. Go to control panel -> programs and change the installation of Visual Studio. Now you can select the "Common Tools for Visual C++ 2015"


C:\Users\michel>pip install moviepy
Collecting moviepy
Using cached moviepy-0.2.2.11.tar.gz
Collecting numpy (from moviepy)
Using cached numpy-1.10.4.tar.gz
Collecting decorator (from moviepy)
Using cached decorator-4.0.9-py2.py3-none-any.whl
Collecting imageio (from moviepy)
Using cached imageio-1.5.zip
Collecting tqdm (from moviepy)
Using cached tqdm-3.8.0-py2.py3-none-any.whl
Installing collected packages: numpy, decorator, imageio, tqdm, moviepy
Running setup.py install for numpy ... done
Running setup.py install for imageio ... done
Running setup.py install for moviepy ... done
Successfully installed decorator-4.0.9 imageio-1.5 moviepy-0.2.2.11 numpy-1.10.4 tqdm-3.8.0

C:\Users\michel>

BulletEyeDK
20-02-2016, 18:00
Great, I will try that out... ;)

OBigO
20-02-2016, 18:13
Hey SenorPez! Could you give a little more info on the race marshal report? I am really interested in something like this, what are you hoping for it to do/show? Thanks a lot!

BulletEyeDK
20-02-2016, 19:10
I reconfigured the Visual C++ program, and now i could install moviepy without any problems...

I reckon there is an error in your windows guide, it must be because of a newer version of replayenhancer....

python replay.py demo/demo_config.py
Im pretty sure you are refering to "ReplayEnhancer.py" and the file demo_config.json ??

I've done a run that way, but i still get errors.. this time:
227949

Im for now going to try another fresh install of Ubuntu and following you package install "how to" guide step by step... hope this works ;)

BulletEyeDK
20-02-2016, 19:58
I've now tried with a clean install of Ubuntu 14.04.4 in a virtual machine, I followed the install to-do posted by Michel-NL and I actually think that's the correct way to do it, as it appears much more was installed vs. what i've installed myself on the other Ubuntu install i had.

But.... using the ReplayEnhancer.py with a configured json file still generates an error, could there be something bad with my race clip ? It's directly from xbox one using upload studio, and then grapped via xboxclips.com as a MP4 file ?

This is the error i get:
227950

BulletEyeDK
20-02-2016, 21:09
I've now tested my Ubuntu enviroment once again, and i can run the demo file without any problems, my problem must then be in my replay file which i downloaded from xboxclips.com - I'll try another download of my file through xbox.com

Michel--NL
20-02-2016, 21:22
I reconfigured the Visual C++ program, and now i could install moviepy without any problems...

I reckon there is an error in your windows guide, it must be because of a newer version of replayenhancer....

Im pretty sure you are refering to "ReplayEnhancer.py" and the file demo_config.json ??

I've done a run that way, but i still get errors.. this time:
227949

Im for now going to try another fresh install of Ubuntu and following you package install "how to" guide step by step... hope this works ;)
The guide is from the old version of Replay Enhancer. At he moment it is pointing to the wrong version of the demo files. This version is only good for installing Python on Windows. I have to make a new version..sorry for that.
EDIT: Oooo you are right. The demo files are giving an error

C:\ReplayEnhancer\project-cars-replay-enhancer-master>python ReplayEnhancer.py demo/demo_config.json
Creating video.
Traceback (most recent call last):
File "ReplayEnhancer.py", line 759, in <module>
ReplayEnhancer.create_video(arguments.configuration)
File "ReplayEnhancer.py", line 620, in create_video
replay = cls(config_file)
File "ReplayEnhancer.py", line 103, in __init__
self.get_telemetry()
File "ReplayEnhancer.py", line 260, in get_telemetry
participant_groups = [self.update_participants(participant_queue) for x in range(len(self.participant_configurations))]
File "ReplayEnhancer.py", line 260, in <listcomp>
participant_groups = [self.update_participants(participant_queue) for x in range(len(self.participant_configurations))]
File "ReplayEnhancer.py", line 307, in update_participants
participant_data.append((i, name, self.team_data[name], self.car_data[name]))
KeyError: 'Matthias Gr\xc3¼nzel'

C:\ReplayEnhancer\project-cars-replay-enhancer-master>

It has todo with the windows encoding :(


Traceback (most recent call last):
File "ReplayEnhancer.py", line 741, in <module>
ReplayEnhancer.edit_configuration(arguments.configuration)
File "ReplayEnhancer.py", line 486, in edit_configuration
config.new_configuration()
File "C:\ReplayEnhancer\project-cars-replay-enhancer-master\Configuration.py", line 774, in new_configuration
print("Entering data for {}.".format(participant))
File "C:\Python35-32\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xc3' in position 29: character maps to <undefined>



I've now tested my Ubuntu enviroment once again, and i can run the demo file without any problems, my problem must then be in my replay file which i downloaded from xboxclips.com - I'll try another download of my file through xbox.com
I always download the video from YouTube. From YouTube you get an mp4 version, maybe from xboxclips.com you get a video with the wrong codec, because its complaining about the codec?

BulletEyeDK
20-02-2016, 22:33
Now i've tried both xboxclips.com and xbox.com where the video's automaticly will show up when uploaded via the xbox

The Xbox One does not have any youtube.com upload feature, it sure is a .mp4 file, but there must be someting different with the header of the fil i reckon... a bit weird, as the replay file will play fine as a .mp4 file in all the players i've tried.

There is no other option when using upload studio on the xbox, you can't choose any other format or anything else.

I'll update you on the matter

SenorPez
21-02-2016, 02:37
Sorry for the delay; oddly enough, I'm busier on weekend right now. Life and work are strange sometimes. ;)

I think there's two things at play here.

The first is the encoding:


KeyError: 'Matthias Gr\xc3¼nzel'


That's a known issue that I need to solve. It should generally be transparent if the encoding on your XBOX is the same as the encoding on the computer you run the Replay Enhancer, which would be typical, since they're both going to be the same language. Unfortunately, the demo files might (and in this case, probably are) encoded differently. So ol' Mattias's diacritical mark doesn't translate correctly.

For the second error you're seeing (post #95), that's an error with the output. What's your output video filename? It's probably not blatantly obvious that MoviePy chooses the codec based on the file extension. So if you try to output to "outputvideo" it'll bomb. If you try to output to "outputvideo.mp4" it'll pick libmpeg, if you try to output to "outputvideo.webm" it'll pick something else, etc.

Let me know, and I'll do what I can do to find answers to help!

SenorPez
21-02-2016, 02:40
Hey SenorPez! Could you give a little more info on the race marshal report? I am really interested in something like this, what are you hoping for it to do/show? Thanks a lot!

Take a look at post http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer-0-3-Now-easier-and-faster-to-use!&p=1221308&viewfull=1#post1221308

azidahaka does a pretty good job of outlining what he's looking for. It's a bit of a tangent from the actual Replay Enhancer, but would use a lot of the backend already in place, and is something I'd be interested in for my own analysis. And after 2 weeks of stomping bugs for 0.3, it might be a good rotation for a bit. ;)

BulletEyeDK
21-02-2016, 08:21
@SenorPez - as I read your post, I did spot a problem... i had not given my output file an extension, it was just the name, that i had given, im sorry for the trouble this caused.

So i changed that, and the ReplayEnhancer.py went a little further, this time it stops just after "writing audio 100%", and returns this error:


morten@ubuntu:~/pCARS/replay$ python3 ReplayEnhancer.py bulleteyedk.json
Creating video.
Using Track: Brands Hatch Indy
[MoviePy] >>>> Building video bulleteyedk_enhanced.mp4
[MoviePy] Writing audio in bulleteyedk_enhancedTEMP_MPY_wvf_snd.mp3
100%|███████████████████████████████████████████████████████████████████████████████████████████▉| 4798/4800 [00:11<00:00, 449.45it/s]Traceback (most recent call last):
File "ReplayEnhancer.py", line 759, in <module>
ReplayEnhancer.create_video(arguments.configuration)
File "ReplayEnhancer.py", line 625, in create_video
output.write_videofile(replay.output_video, fps=30, write_logfile=True)
File "<decorator-gen-51>", line 2, in write_videofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "<decorator-gen-50>", line 2, in write_videofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "<decorator-gen-49>", line 2, in write_videofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/usr/local/lib/python3.4/dist-packages/moviepy/video/VideoClip.py", line 331, in write_videofile
verbose=verbose)
File "<decorator-gen-73>", line 2, in write_audiofile
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 204, in write_audiofile
verbose=verbose, ffmpeg_params=ffmpeg_params)
File "<decorator-gen-70>", line 2, in ffmpeg_audiowrite
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/io/ffmpeg_audiowriter.py", line 161, in ffmpeg_audiowrite
nbytes= nbytes, fps=fps):
File "/usr/local/lib/python3.4/dist-packages/tqdm/_tqdm.py", line 459, in __iter__
for obj in iterable:
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 81, in generator
buffersize=chunksize)
File "<decorator-gen-72>", line 2, in to_soundarray
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 127, in to_soundarray
snd_array = self.get_frame(tt)
File "<decorator-gen-14>", line 2, in get_frame
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.4/dist-packages/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 292, in make_frame
for c,part in zip(self.clips, played_parts)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 293, in <listcomp>
if (part is not False) ]
File "<decorator-gen-14>", line 2, in get_frame
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.4/dist-packages/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 292, in make_frame
for c,part in zip(self.clips, played_parts)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/AudioClip.py", line 293, in <listcomp>
if (part is not False) ]
File "<decorator-gen-14>", line 2, in get_frame
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.4/dist-packages/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.4/dist-packages/moviepy/Clip.py", line 136, in <lambda>
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File "/usr/local/lib/python3.4/dist-packages/moviepy/Clip.py", line 188, in <lambda>
return self.fl(lambda gf, t: gf(t_func(t)), apply_to,
File "<decorator-gen-14>", line 2, in get_frame
File "/usr/local/lib/python3.4/dist-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.4/dist-packages/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/io/AudioFileClip.py", line 71, in <lambda>
self.make_frame = lambda t: reader.get_frame(t)
File "/usr/local/lib/python3.4/dist-packages/moviepy/audio/io/readers.py", line 173, in get_frame
fr_min, fr_max = frames.min(), frames.max()
File "/usr/local/lib/python3.4/dist-packages/numpy/core/_methods.py", line 29, in _amin
return umr_minimum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation minimum which has no identity


I've compared my .json configuration file vs. the demo file, and can't spot an error

EDIT: i created a new config file - and it's actually parsing "writing video" right now ;) - will post result when finished

BulletEyeDK
21-02-2016, 09:19
I got it running, and it produced the enhanced video with overlay - this is so nice ;)

I really don't know why i did get that last error, as i've only created a new config file... strange
Thanks for helping me out guys, im sorry about the .extension missing - bad mistake by my side, but as it was'nt mentioned in the text on screen i really did not think the filename had to be including extension.

SenorPez
21-02-2016, 14:41
I got it running, and it produced the enhanced video with overlay - this is so nice ;)

I really don't know why i did get that last error, as i've only created a new config file... strange
Thanks for helping me out guys, im sorry about the .extension missing - bad mistake by my side, but as it was'nt mentioned in the text on screen i really did not think the filename had to be including extension.

No worries. It's good to try that out, and I can and probably should catch that error in the configuration. I should be able to test that you have that codec installed.

As for the error in the previous post... that's an error that I thought I stamped out but you've found a way to reproduce it! It's caused by having an "end time" on the vidoe trimming longer than the actual video.

Did you create your configuration file by hand, or by using the Configuration script? Did you change the input video at all? I'm trying to think through how you managed a situation where that happened, so that I can add it to the tests!

Glad to here, though, that you got it running. Sorry about the bumpy start, but it all helps in making it better in the long run!

BulletEyeDK
21-02-2016, 15:14
There was nothing wrong with the video codec, the error was only there as i did not enter the extension for output file

I created my configuration file through the script...

You've done a really fine job with this replay enhancer, and my trial & error will hopefully get nailed in error handling,now that you now how i got there :)
Im a bit into python scriptning my self... if i wan't to make a custom look layout wise, where is this stuff located ?

BulletEyeDK
21-02-2016, 18:42
Im a bit into python scriptning my self... if i wan't to make a custom look layout wise, where is this stuff located ?

Have just started looking at some of the .py files, and think i have what i need... ;)

BulletEyeDK
21-02-2016, 21:55
@SenorPez - You made an awesome tool here, thanks ;)

I've now made some test's with the layout colors and font... I want the standings.py as small as possible and i actually prefer white text on dark background....
This is only a test video, and it only shows about 2 laps


https://www.youtube.com/watch?v=xrDgvlpLxW4

SenorPez
21-02-2016, 23:09
@SenorPez - You made an awesome tool here, thanks ;)

I've now made some test's with the layout colors and font... I want the standings.py as small as possible and i actually prefer white text on dark background....
This is only a test video, and it only shows about 2 laps


https://www.youtube.com/watch?v=xrDgvlpLxW4

I like the white-on-black look actually... looks really sharp!

azidahaka
22-02-2016, 15:26
Take a look at post http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer-0-3-Now-easier-and-faster-to-use!&p=1221308&viewfull=1#post1221308

azidahaka does a pretty good job of outlining what he's looking for. It's a bit of a tangent from the actual Replay Enhancer, but would use a lot of the backend already in place, and is something I'd be interested in for my own analysis. And after 2 weeks of stomping bugs for 0.3, it might be a good rotation for a bit. ;)

Are we there yet? [repeat N times] ( said in little kid's voice :D )

SenorPez
22-02-2016, 20:01
Are we there yet? [repeat N times] ( said in little kid's voice :D )


https://www.youtube.com/watch?v=18AzodTPG5U

Michel--NL
23-02-2016, 11:58
@SenorPez - You made an awesome tool here, thanks ;)

I've now made some test's with the layout colors and font... I want the standings.py as small as possible and i actually prefer white text on dark background....
This is only a test video, and it only shows about 2 laps
Is it possible to share the adjustments you made in the code?

BulletEyeDK
23-02-2016, 12:47
Yes - no problem at all, the changes are pretty small, you will be surprised... will post this when im home from job, later today

BulletEyeDK
23-02-2016, 15:05
Is it possible to share the adjustments you made in the code?

You need to make thees changes:

Standings.py
Replace original lines of code with this:
Line 185: materialColor = (28, 28, 28, 192)
Line 187: materialColor = (46, 46, 46, 192)

Replace all "fill='black'" with -> "fill='white'"

save file...

Timer.py
Edit existing lines of code for the following lines:

Line 59, col122: (28, 28, 28, 192))
Line 62, col125: (46, 46, 46, 192))

And once again replace "fill='black'" with -> "fill='white'"

save file...

the first lines of code in config.json file looks like this:


"backdrop": "",
"column_margin": 6,
"font": "PT-sans.ttf",
"font_size": 11,
"heading_color": [
4,
127,
0
],
"heading_font": "PT-sans.ttf",
"heading_font_size": 20,

And the font used is downloaded free from this -> http://www.fontsquirrel.com/fonts/PT-Sans

That should get you going with the layout i've recently used... ;)

SenorPez
25-02-2016, 18:28
I'm still working on things, but things have been busy this week. I also carved out some time to finally finish the McLaren F1 3 Hour event.

In case you were wondering, here's some stats:

Number of packets captured (at UDP-5): ~250,000 (yes, a quarter-million)
Size of packets captured: ~900 MB
Size of CSV file created by Project CARS Replay Enhancer: ~725 MB
Time it took me, with breaks to play with my puppy (not a euphemism) to complete this ****ed race: Almost 4 hours. This doesn't include the previous attempt, wherein an AI punt DQed me 2.5 hours in. :rage:
Size of source video for replay: ~8.0 GB
Most importantly... does it work with the Project CARS Replay Enhancer? So far, so good. I'm rendering a trimmed video right now. It's, as you might expect, somewhat slower due to the quantity of data being crunched. I'll let you know... it'll be the most boring 3 hours of footage ever uploaded to YouTube when it's done.


Unrelated to that endeavour, if you're enhancing replays and posting them to YouTube and wouldn't mind me showing them off, let me know. I'm creating a YouTube playlist of enhanced replays so that people can see your handiwork and fancy driving!

Michel--NL
25-02-2016, 20:08
that should be a nice video...8GB :p
What capture device do you use. I was looking to buy one, but the reviews are not so good.
Uploading from PS4 to YouTube is not the best quality.


You could use my video's https://www.youtube.com/playlist?list=PLOdUOKn-ZiZ0ScVdK9z8B1vXWa-c8Cumv
Last video

https://www.youtube.com/watch?v=lfcvSCbPBJY

SenorPez
26-02-2016, 02:15
that should be a nice video...8GB :p
What capture device do you use. I was looking to buy one, but the reviews are not so good.


I've recently switched to using an Elgato Game Capture HD (https://www.elgato.com/en/gaming/gamecapture-hd). I've been pretty happy with it so far, but I've mostly used it for capturing replays and not for streaming, yet.

Michel--NL
27-02-2016, 08:40
Don't know if its the replay enhancer or the latest patch from PC did it, but all the drivernames (multiplayer) from the UDP stream are correct. Did not have to change a single drivername :)

Michel--NL
27-02-2016, 17:18
Last race edited with Replay Enhancer (very bad race from me :()....BulletEyeDK thnxs for the colors :)

https://www.youtube.com/watch?v=0R5G0YpWbeA

And then this https://youtu.be/0R5G0YpWbeA?t=521 I crashed in the barrier. Porject CARS thought I wanted to pit and took over the steering for the next round and pitted :rolleyes:

SenorPez
28-02-2016, 04:35
A few updates:


Bullet, and Michel, I LOVE the dark color scheme. It looks so much better than the default I put together! Way to go!

My furious pace of coding and changes has dropped off a bit due to a few things in the real world, and for that I apologize. But my real-life work has to take priority, I'm sure you understand. That being said, I'm still plowing forward on bug fixes, the Marshal Report, and other projects. If you want to watch progress, Github's a pretty good window.

My work on getting a 3-hour replay enhancer video also chugs along in the background. There were two problems that I encountered...

The first is that my home server didn't actually have enough memory to hold the data structures. It seems that once this happens, speed drops off a cliff. And in one case, brought the server down. I do need to solve this, and I've a few ideas, but anyone who wants to help is more than welcome.
I also discovered, while trying to get the thing to run on my Windows machine (which has a lot more memory and a better processor, being my main gaming box), a lot of sharp edges. Most notably the unpleasant surprise that the CSV file that's written during processing isn't properly encoded. I'm hoping to roll that into 0.3.1 as a bugfix; it should fix the problem Bullet saw while trying to run the demo files.



All in all, I hope you're enjoying it; I'm enjoying working on it, even if this week was a hellscape of "real life" work instead. And I'd love to see more people enhancing replays, finding bugs, and generally joining the conversation!

Michel--NL
28-02-2016, 05:53
1. Think I stick to the dark color with day races and the white color with night races
2. No problem, real life work is paying the bills ;-)
3. I have a server with 32GB memory. If you send me you'r data and video I could try it.

I think people are holding off because there is no GUI. At first look it looks difficult. For me thats not a problem any more....if you understand the proces with the trimming and the sync settings then its flying :)

BulletEyeDK
28-02-2016, 07:42
1. Think I stick to the dark color with day races and the white color with night races


Good idea - could actually be nice if this was left to be an option for the user... to choose dark or light skin ? ;)

The series im running ran a race yesterday, I gathered packets for that race (approx 45min) going to give this a try with the replay enhancer...

BulletEyeDK
28-02-2016, 07:45
All in all, I hope you're enjoying it; I'm enjoying working on it, even if this week was a hellscape of "real life" work instead. And I'd love to see more people enhancing replays, finding bugs, and generally joining the conversation!

I have the same challenge... it's a shame that real life work takes up so much of your spare time, ha ha ;)

Keep up the good work with the replay enhancer... i'll for sure keep on using it, and report back with any issues encountered...

BulletEyeDK
29-02-2016, 06:59
As written I gathered UDP data for the last race we ran in our series, approx 45 min of race, 12 drivers...

I began enhancing the replay last night, but had some trouble, as the parsing of telemetry data took too long i suppose, it ended with "killed" a couple of times.
I then put some more ressources into my virtuel enviroment, both ram and cpu cores, which was the way to go... so the enhancer have been working all night, and as i went to job it was still working ;)

The telemetry is stored in approx. 160.000 files - the virtual enviroment is set up with 4GB of ram, 1 CPU (i5) with 4 cores - I didn't work out with less "power".

BulletEyeDK
29-02-2016, 19:47
Took some time to enhance my 50 min replay video, but it suceeded... it's not 100% syncronized, it missed by nearly a second, but i can live with it.

There seems to be some kind of hickup at the end, approx 2 min... where the leaders and 3 others end the race, drivers who are lapped suddenly switches positions, but at the endscreen it's all good.. I reckon the game also have problems handling this situation, so it's probably hard to error out ?


https://www.youtube.com/watch?v=nOix3K4Tv6E

SenorPez
29-02-2016, 20:56
First, if anyone notices their finish orders not correctly displaying, let me know. I've a bugfix in the pipe for 0.3.1 that fixes an issue that cropped up, but for the life of me, I can't figure out why it wasn't happening MORE. The video here looks like it's okay.


Took some time to enhance my 50 min replay video, but it suceeded... it's not 100% syncronized, it missed by nearly a second, but i can live with it.

There seems to be some kind of hickup at the end, approx 2 min... where the leaders and 3 others end the race, drivers who are lapped suddenly switches positions, but at the endscreen it's all good.. I reckon the game also have problems handling this situation, so it's probably hard to error out ?

Very nice video! Bathurst has some of my favorite replay angles. And great idea adding a column for "Car Number."

The issue you're seeing is in fact an error in the telemetry feed. As near as I can tell, for whatever reason, the "race position" in the telemetry gets updated in an inconsistent manner once the "race finish" flag is raised. It assigns positions based on what order you cross the line after the leader ends the race, regardless of laps completed. So because you're the 4th person to cross the line after the leader, your position jumps to 5th, despite Niki and Tiger having completed more laps than you. If the telemetry continued to run (more on that in a second), Tiger might have actually dropped to 12th if everyone crossed the line before him!

I do think there's an opportunity for three enhancements here; I'll add them to the Github issue tracker so that I don't forget, though I can't promise when they'll be ready! (Of course, if you want to continue getting your hands dirty in Python, feel free to Fork the github project and implement away. :P)

Blatantly steal Bullet's idea and add configuration routines for car number. Should use same logic as "Team," in that it's completely optional.
Add some of the same intelligence present in the Results screens to the Standings tree. There (like the game itself), you're properly classified based on distance covered, then by finish order.
Right now, as you can see, the telemetry "freezes" once your car crosses the line. In many cases, this is fine, but for "controlled" replays, where you're switching between cars, you might want that feed to continue until everyone's finished. Add an option for that. (See spoiler below for some caveats, and a 0.3.1 bugfix.)



My rendering of the 3 Hour McLaren race--though to be fair, the errors have nothing to do with the length of the race; the conditions could be replicated without capturing a quarter-million telemetry packets--brought to light two nasty classification bugs that I'd not seen before. The first and most severe was a completely wrong listing of classification, with laps and times assigned to the incorrect drivers. I'm honestly surprised it'd not a bigger issue (and not sure why it hadn't happened before). The second was people randomly getting DNF'ed in the middle of the classification.

For the second issue, it turns out there were two issues at play. First of all was an error in determining the finish of a timed race. Once the time expires, the next time you cross the start-finish line is the end of your race. It doesn't matter if that means the guy you're trying to pass is over the line and you're on the other side and can't chase him anymore.

Second, however, was that the standings telemetry goes CRAZY after the observed car (again, typically you) finishes. Lap position stops getting reported accurately, and the standings will jumble around. This may pose a problem to having the telemetry continue to "run." I'd suspect this is in part due to the fact that the physics simulation also ends... stuff is getting dumped out of memory.

SenorPez
01-03-2016, 16:37
It took 36 hours (!!!) to render, but here it is: 3 hours of me (poorly) tossing a McLaren F1 around Zolder.


https://www.youtube.com/watch?v=nT_ot42W50M&index=17&list=PLy-S2xlLES80Wy18ydpmO1D9jU200jcWJ

SenorPez
08-03-2016, 14:12
Quick update:

Bad news is that I haven't put in much work in any of my projects lately. In the real world, a client decided to end their project with our firm (which they're totally allowed to do, it was just kind of surprising), so I've been winding that down before their termination date. The bad news/good news out of that is that I'll be on "the bench" for a while, until a new client requires my services, so while I'll be psuedo-unemployed (again, not a new thing), it'll give me time to get back into working on this. I apologize for the disruption; you know how it goes!

I've got a few bug fixes (encoding and whatnot) to push for 0.3.1, and the Marshal's Report is coming along nicely. I just need time to polish.

BulletEyeDK
09-03-2016, 22:58
The Marshal's Report is coming along nicely. I just need time to polish.

Could you pin out what this will include ??

If by any means UDP data contains info about cars going off track, and collisions and so on, this would be very nice to have in that report, as it could be used to calculate driving ratings like iRacing does... im administrating a league with lots of statistics/driver calculations, but this is done alone on each classification in the races... please update me on the matter ;)

Thanks for your effort with the replay enhancer.... It sucks with your job, sorry to hear that

keppo
12-03-2016, 18:26
This looks great for what I have seen on the youtube clips. Im gonna try it now'. it will look great posting this on our league forum. Thnx

keppo
13-03-2016, 06:49
I ran into a problem. I used the doc provided bij Michel--NL which is still very helpfull. I am not sure why I needed to install Visual Studio.

I first tried to create a video with the demo but I ran into the " KeyError: 'Matthias Grünzel' " problem. On Page10 is says it's a codec problem and it's an known issue. But i can't seem to find a solution for the problem in the thread.

What can I do?

keppo
13-03-2016, 07:59
I seem to have fixed it by doing "python ReplayEnhancer.py -c demo\demo_config.json" and just accepting the default settings. It changed the entry for Matthias in:

"Matthias Gr\u00c3\u00bcnzel": {
"car": "0",
"display": "Matthias Gr\u00c3\u00bcnzel",
"points": 0,
"short_display": "M. Gr\u00c3\u00bcnzel",
"team": "0"
},

and some other driver named "Ren\u00c3\u00a9 Castel" was changed also

after that I could create the demo-output.mp4. When I ran the mp4 I saw that Mathias in de video was still named "M. Gra~1/4nzel" http://i.imgur.com/bafWJjl.png

BulletEyeDK
13-03-2016, 10:55
If you manually could edit that driver name in then demo.config.json file, then do it, it seems to be an error with the charset, i think.

keppo
13-03-2016, 15:54
I found an issue. packetgrab.py doesn't play nice with other apps. I have some other excellent apps running and packetgrab.py won't share the udp stream. I use Crewchief and VrHive and they work together quit well.

Starting listener on port 5606
Traceback (most recent call last):
File "packetgrab.py", line 21, in <module>
SOCKET.bind(SERVER_ADDRESS)
OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted


Would it be possible to use the data from another source? because vrhive for example also has al the data.

Michel--NL
13-03-2016, 16:32
I think thats because you ended packetgrab not with the key combination CTRL-C. If you use anything else then CTRL-C the process will keep running in the background.

BulletEyeDK
13-03-2016, 19:46
i have no problem running crewchief, packetgrab.py on the PC and also usin pCARS Dash all at the same time

keppo
14-03-2016, 18:08
CTRL-C ends the application and I'm using a PS4 perhaps which uses a different way by using UDP and not shared memory.

If packetgrab.py is the only application it will grab packets but not when an other app is running

BulletEyeDK
14-03-2016, 23:39
CTRL-C ends the application and I'm using a PS4 perhaps which uses a different way by using UDP and not shared memory.

If packetgrab.py is the only application it will grab packets but not when an other app is running

I think you misunderstood my post, im actually on xbox but using the apps as described

azidahaka
15-03-2016, 09:22
Are we there yet? ;)

keppo
15-03-2016, 12:29
I think you misunderstood my post, im actually on xbox but using the apps as described

what's your OS? Are you using Windows?

BulletEyeDK
15-03-2016, 14:33
Im running a laptop with windows 7 x64 - this runs the Crew Chief and also runs a virtuel machine (VMware) with ubuntu 14.04.4, that runs the packetgrab.py in terminal window, and a iPad runs pCARS Dash aswell...

keppo
15-03-2016, 15:51
Im running a laptop with windows 7 x64 - this runs the Crew Chief and also runs a virtuel machine (VMware) with ubuntu 14.04.4, that runs the packetgrab.py in terminal window, and a iPad runs pCARS Dash aswell...

ok, that will explained it. I'm running everything (crewchief & vrhive/vHud & packegrab.py) on a single Win10x64 laptop. So the app needs to share the incoming udp stream. You have 3 networked apparatuses which all can bind to the port.

but there is a fix in the development branch. Where u can run them all together. No need for VM's etc. Your welcome to try/test..

BulletEyeDK
18-03-2016, 12:04
I've somehow encountered an error with my last packetgrab, a race with 11 drivers, 30 laps on Brands Hatch, 2 drivers appear twice in the packetdata, one is missing the first char in his second name, and the other having an extra char "l" truncated in the middle of his gamertag.

Is there an easy way to rename their name ? im having approx. 170.000 udp files ;)

Michel--NL
18-03-2016, 16:02
I've somehow encountered an error with my last packetgrab, a race with 11 drivers, 30 laps on Brands Hatch, 2 drivers appear twice in the packetdata, one is missing the first char in his second name, and the other having an extra char "l" truncated in the middle of his gamertag.

Is there an easy way to rename their name ? im having approx. 170.000 udp files ;)
If you really want to change the names in the files then you could use notepad++. There is an option for "find in files" and there you could change it.

If you run Replayenhancer then you could also change the drivernames...isn't it better to use that?

BulletEyeDK
18-03-2016, 21:27
I know of notepad++ which is a great tool... it's just a massive file amount to go through...

I know how you change driver names with replay enhancer, which i've also done... but this time i've got the right driver names, and then 2 in the middle of this 2 of the driver names misses a char and the last one have extra chars in between... but still appear correct also, so it's some mess...

But can notepad++ go through all the files looking for a specific word to replace ?

Michel--NL
19-03-2016, 06:34
230075

keppo
19-03-2016, 06:57
why not change it in the resulting CSV file?

Actually you should be carefull with changing the packets. The packets send from Pcars are not created equally. I mean that literally. If the byte size of the packet changes then replayenhancer would not know what to do with the packets.

does it contain tyre temp or gap data or names of participants. Look at the actual bytesize of packets. Make sure your changes doesn't change the size of the packet. Dont use windows explorer because it says its all 2k but in real size its for example 1367 bytes.

Don't know if the data is padded but you could run in to problems is you would change Michel to Michel--NL

keppo
20-03-2016, 19:33
having issues with the syncronisation effect. Its working but the explaination isn't really clear to me.

I made several short videos and eventually settled on just trying and trying until I found a number withs more or less works. But i like to understand the math here. Which problaly will be faster then trial-and-error

The Readme.md says "To determine the telemetry synchronization value, view the time on the timer when the subject car crosses the start-finish line to begin Lap #2." so in my case the timer which is problaly on the right hand corner an says 1.34.32.

Its unclear to me which timer should say Lap2 or Lap1? The timer of Pcar will always say L2 because I just crossed the line.

If i start python3 ReplayEnhancer.py -r config_file.json i can only fill in something like (0.0) so do I convert my 1.34.32 into seconds here?

In my trial and error strategy it should be a negative number but how to determine this?

SenorPez
21-03-2016, 15:55
Are we there yet? ;)

Getting there. Between client wrap-up (I'm fine) and my puppy having surgery (she's fine), I was able to get in some quality coding time. I wasn't able to check this thread as much as I'd have liked though!

First:
Thanks to keppo for finding and fixing the blocking bug. I missed a socket option that allows other apps to consume the stream, and since my dashboard app runs on a tablet, while I've been running the replay enhancer on my home server, I never noticed it. His fix was pushed last week to the 0.3.1-devel branch.

Second:
The 0.3.1-devel branch also now includes support for "additional participants," as requested by Michel. These are participants not in the current race but who might still have series points. They will filter in, if they make it to the top 16, for the Series Standing and Champion screens.

Third:


I've somehow encountered an error with my last packetgrab, a race with 11 drivers, 30 laps on Brands Hatch, 2 drivers appear twice in the packetdata, one is missing the first char in his second name, and the other having an extra char "l" truncated in the middle of his gamertag.

Is there an easy way to rename their name ? im having approx. 170.000 udp files


A few things on this:

I'd second the caution of changing it manually. Packet size is one of the ways I check for a corrupted packet, and the data itself in the packet is packed binary data. You could change it (safely) in the CSV file, as far as I can tell.
Try this with the 0.3.1-development branch. There are two issues I've fixed there:

I found a little issue that can occur with the "detection" of race starts, which might be part of the issue here?
I fixed an issue with participant list building not always happening, if packets arrive in a non-standard order (We're supposed to get Type 1 before a Type 2, but UDP doesn't guarantee transport order, so I need to be a bit more crisp against that.)

If it still gives you problems, can you ZIP/TAR the packets and send them to me; I can take a look at them. The scripts *should* properly behave, and if all else fails, the name override in the configuration is a last line of defence.


What it sounds like is happening is someone is dropping out and the detection isn't quite working in this case. When that happens, the last participant is moved into the spot vacated by the person leaving. However, PCARS doesn't "clean" either the destination or source, so you end up with garbage (which is why the name override has to exist). Example: If you have "Albert", "Bertha", "Callie", and "Dave" in a 4 person race, and "Berta" leaves, the new list will look like "Albert", "Daveha", "Callie", and "Dave". Note that "Dave" is still there (but should be ignored because the number of participants is only 3, so we only read the first 3), and that getting moved into "Bertha"'s spot leaves garbage at the end.

It's annoying.

Fourth:


having issues with the syncronisation effect. Its working but the explaination isn't really clear to me.

I made several short videos and eventually settled on just trying and trying until I found a number withs more or less works. But i like to understand the math here. Which problaly will be faster then trial-and-error

The Readme.md says "To determine the telemetry synchronization value, view the time on the timer when the subject car crosses the start-finish line to begin Lap #2." so in my case the timer which is problaly on the right hand corner an says 1.34.32.

Its unclear to me which timer should say Lap2 or Lap1? The timer of Pcar will always say L2 because I just crossed the line.

If i start python3 ReplayEnhancer.py -r config_file.json i can only fill in something like (0.0) so do I convert my 1.34.32 into seconds here?

In my trial and error strategy it should be a negative number but how to determine this?


It's somewhat funny, that, as someone who writes plans, procedures, and process documentation for a living, I've continuously struggled to write this concept down. So if anyone can improve it, peer review is always welcome.

There are actually two separate playbacks happening when you create an enhanced replay: A video playback, and a telemetry playback. Due to the nature of the data feeds, they don't have a way to speak to each other. The synchronization value ensures that these two playbacks are matched.

Since a picture is worth a 1,000 words, I'll illustrate from my first Kart race:
http://i.imgur.com/weIJa2L.jpg

At this moment in the replay, the timer created by the Replay Enhancer should say "0.00" and "Lap 2 / 10". You'll notice it instead shows a time of 4.25. This is because the telemetry playback starts early. With an offset of 0.0, this is the normal case*. In this instance, then, to synchronize the telemetry playback with the video playback, we set the sync value to 4.25, the same value shown on the timer. The script takes care of the rest.

Is that clear? If it's not, feel free to continue asking questions... this is probably the most arcane thing right now, but somewhat important to have accurate data.

Note that this can get really fuzzy on tracks without a clear start/finish line, like Laguna Seca. To do this, you can try to see when cars move at the start of the race (fuzzy because of reaction time), when the video fades to black (useful for single player replays only), or just keep fiddling with the number (annoying). I get it "close enough" and call it a day. ;)

* There is a potential case where the car cross the line before the timer shows L2 starting. This typically happens if the video is cropped to a time before the race start, but the script will handle a negative synchronization value just fine... set it equal to the difference shown on the Timer at that moment and the time for L1.

keppo
21-03-2016, 20:36
but what should be filled in when the laptime is over 1 min? The script won't allow me to enter 1.34.32. Do I convert to 94.32 sec eventually I used -39 to get i synced "close enough".

To produce the low quality my rusty computer is working for 3,5min so i like to get it a close as I can. I really should invest in something faster.

We use timed races in the league so I didn't spot the L2 in the timer.


http://s27.postimg.org/4p7tr44vz/screenshot_1.jpg (http://postimg.org/image/4p7tr44vz/)

BulletEyeDK
21-03-2016, 21:00
A few things on this:

I'd second the caution of changing it manually. Packet size is one of the ways I check for a corrupted packet, and the data itself in the packet is packed binary data. You could change it (safely) in the CSV file, as far as I can tell.
Try this with the 0.3.1-development branch. There are two issues I've fixed there:

I found a little issue that can occur with the "detection" of race starts, which might be part of the issue here?
I fixed an issue with participant list building not always happening, if packets arrive in a non-standard order (We're supposed to get Type 1 before a Type 2, but UDP doesn't guarantee transport order, so I need to be a bit more crisp against that.)

If it still gives you problems, can you ZIP/TAR the packets and send them to me; I can take a look at them. The scripts *should* properly behave, and if all else fails, the name override in the configuration is a last line of defence.


What it sounds like is happening is someone is dropping out and the detection isn't quite working in this case. When that happens, the last participant is moved into the spot vacated by the person leaving. However, PCARS doesn't "clean" either the destination or source, so you end up with garbage (which is why the name override has to exist). Example: If you have "Albert", "Bertha", "Callie", and "Dave" in a 4 person race, and "Berta" leaves, the new list will look like "Albert", "Daveha", "Callie", and "Dave". Note that "Dave" is still there (but should be ignored because the number of participants is only 3, so we only read the first 3), and that getting moved into "Bertha"'s spot leaves garbage at the end.

It's annoying.

Thanks for your update, I suppose the problem is down to the fact that 2 drivers left the race 30 seconds before the race end timer really ended... I did actually mention it for those guys, that this would possible mean trouble ;)

I went through the .csv file and did actually find one of the errors but was unable to spot the last, so tried running the enhancer one last time, but that did'nt work out well, so that race just ended without any enhanced layout, but only a replay.

SenorPez
22-03-2016, 01:25
Thanks for your update, I suppose the problem is down to the fact that 2 drivers left the race 30 seconds before the race end timer really ended... I did actually mention it for those guys, that this would possible mean trouble ;)

I went through the .csv file and did actually find one of the errors but was unable to spot the last, so tried running the enhancer one last time, but that did'nt work out well, so that race just ended without any enhanced layout, but only a replay.

Actually, yeah, if you can ZIP or TAR your packet directory and send me that, I'd like to use that data for testing. Them leaving 30 seconds before the end of the race timer expiring shouldn't have actually broken anything; one of the test data sets that I used while adding better support for multiplayer had that instance and it should be handled. But something is obviously broken, and I'd LOVE to fix it!

SenorPez
22-03-2016, 01:42
but what should be filled in when the laptime is over 1 min? The script won't allow me to enter 1.34.32. Do I convert to 94.32 sec eventually I used -39 to get i synced "close enough".

To produce the low quality my rusty computer is working for 3,5min so i like to get it a close as I can. I really should invest in something faster.

We use timed races in the league so I didn't spot the L2 in the timer.


http://s27.postimg.org/4p7tr44vz/screenshot_1.jpg (http://postimg.org/image/4p7tr44vz/)

Ah, the screenshot makes it clear. And sorry, yes, if you're using a timed race, you won't have a 2/X... but the principle remains the same.

Based on your screenshot, it looks like you've in fact clipped the video to start after the green lights go off (not a huge deal)!

Since you're using the in-game view with the regular PCARS HUD displays, there's a super-easy way to fix this, and might help make it a bit less mysterious, too! Here we go:

Note the Replay Enhancer "time remaining in race" timer in the upper right; it's the second line, and says "43.57.87" in your screenshot.
Note the PCARS HUD "time remaining in race" timer in the upper left, "behind" the Replay Enhancer standings tree, and says, I think, "43.19" in your screenshot.

Those two numbers should be the same. Because the Replay Enhancer timer has been running for less time than the actual time of the race, you need to increase your offset (I hope I'm thinking through this correctly!). Since the difference in time is 38 seconds, that's how much you need to change the offset by! If you're currently running at -39, that would become -1. You can easily check it by seeing if those two numbers are equal (or at least close, there's some inaccuracy based on your UDP data rate).

Again, sorry if this is hard for me to explain, but I'm willing to help!

BulletEyeDK
23-03-2016, 16:42
@SenorPez - i've sent you a PM with details on how you get your hands on the packetdata from my last race which had some trouble ;)

SenorPez
24-03-2016, 14:02
Race Marshal Report:

There's a ton of code cleanup, and I need to bolt a front-end to it and add some data, but you can see something resembling progress in the 0.1 development branch right now: https://github.com/SenorPez/project-cars-marshal-report/tree/0.1-devel

Don't get too excited yet. Here's what it does at this point:
Command Line Options

-h: Show help.
-v: Show version.
-s: Save packets for future use. Perhaps... enhancing a replay?


What it does so far:
Running python3 MarshalReport.py will open up a listener for UDP packets. Running python3 MarshalReport.py /directory/ will read a directory of saved packets.
In either case, as each packet arrives, it's parsed, and a file called "output.json" is created. This JSON file has all the data crunched that will form the basis of reports. Right now, it includes the following data:

For each participant:

Overall best lap time.
Overall best sector 1 time.
Overall best sector 2 time.
Overall best sector 3 time.
Name
For each of the driver's laps:

Lap invalid flag
Lap number (Lap 0 is the starting grid.)
Lap time
Position (at the completion of that lap, or on the starting grid)
Sector 1 time
Sector 2 time
Sector 3 time


For each lap:

Best lap time
Best Sector 1 time
Best Sector 2 time
Best Sector 3 time
Lap number (lap 0 is the starting grid)
A list of drivers:

Invalid lap flag
Lap Time (driver)
Name
Position (at end of lap)
Sector 1 time
Sector 2 time
Sector 3 time




(Yes, data is basically duplicated, but that's intentional. One is giving you a "grouped by driver" view, the other is giving you a "grouped by lap" view.)
I still need to add in race data like duration,, distance, track name, etc.

I've attached a sample JSON file to this post if you want to see what it's like.

My next steps is adding in a parser for that JSON file. It's updated every time a telemetry packet arrives, so you can get a real-time view of the race. The two parsers I'm planning on working on, and hoping I'm not biting off more than I can chew:

Web-based, with an update tick, so you can watch live race data while folks race.
PDF-rendering, to get a nice printable report at the end of the race.


Thoughts? Questions? Data you'd like crunched?

Sample JSON: 230345

SenorPez
24-03-2016, 14:03
(Oh, also note that you'll probably be able to easily break this at this point. If you find errors, feel free to post them on the Github issue tracker or here, so that I can squash them.)

azidahaka
27-03-2016, 12:05
You mean you started adding the race reports through udp?

If so I'll have some work to do with it from now on lol

BulletEyeDK
28-03-2016, 09:21
Is it possible to run python3 MarshalReport.py /directory/ on UDP packets secured with ReplayEnhancer.py or are their relying on different things ??

SenorPez
30-03-2016, 16:10
Is it possible to run python3 MarshalReport.py /directory/ on UDP packets secured with ReplayEnhancer.py or are their relying on different things ??

Yes, that's possible. There's actually the different use cars, in fact:

Running it with no options will produce a live report for the current race. This isn't super mature yet; it'll clear the report if you start a new race. I'm intending to change this behavior.

If you run it with the -s option, it does as above, but also saves the packets for use in future apps.

If you provide it a folder of packets, it produces the report not from a live feed but from the packets saved in that folder! So you can get reports from past races, as long as you saved the packets!

I've found a fair number of bugs so far, but development will pick up markedly next week! Thanks for staying tuned!

BulletEyeDK
02-04-2016, 16:45
Yes, that's possible. There's actually the different use cars, in fact:

Running it with no options will produce a live report for the current race. This isn't super mature yet; it'll clear the report if you start a new race. I'm intending to change this behavior.

If you run it with the -s option, it does as above, but also saves the packets for use in future apps.

If you provide it a folder of packets, it produces the report not from a live feed but from the packets saved in that folder! So you can get reports from past races, as long as you saved the packets!

I've found a fair number of bugs so far, but development will pick up markedly next week! Thanks for staying tuned!

I've just tried running MarshalReport.py on already secured packets from ReplayEnhancer, this seems to work pretty well, but unfortunally 1 driver are completely missing, which seems odd to me.

I've got the replay from the race, but this is also with some of the classic pCARS replay errors, where livery are switches from cars to cars, and one car is stuck on the grid.

BulletEyeDK
02-04-2016, 20:37
@SenorPez - thanks for your ongoing effort with both replayenhancer and now the marshalreport, both very usefull...

Do you know of https://plot.ly ? it's an online chartmaker with an python api possibility... i really like the way it can handle evolving standings during a race, try looking at this -> https://plot.ly/940/~pfsq/

I really haven't spend more than just 5 minutes looking at plot.ly - but im sure it could go along with some of your marshalreport ?? could be really cool ;)

dale3d
06-04-2016, 18:48
I am no python guru, or even novice. is there an install for the replay enhancer? or a step by step instruction?

BulletEyeDK
07-04-2016, 07:45
I am no python guru, or even novice. is there an install for the replay enhancer? or a step by step instruction?

Are you preparing to run on Windows or Linux ? I had some issues getting it all up and running, but when it's at first configured, it's not that hard at all... will try to help as much as i can...

azidahaka
07-04-2016, 08:55
Talking about the race steward; does it work? Live? on replay only?
Is there a screen of it? an output file to check?

BulletEyeDK
07-04-2016, 09:59
I've tested the marshalreport.py with allready secured UDP packets from an earlier session using packetgrab.py and the result seems ok, it returns a .json file that needs to be parsed before you'll get visible data

SenorPez
07-04-2016, 21:32
Sorry I've been radio-silent for the past week. Real life has taken priority a bit; I'm going to scan the thread and the projects, see where I am, and hopefully get back to work as soon as possible!

dale3d
08-04-2016, 03:44
I'm sorry for the delayed response. I using Windows.

azidahaka
08-04-2016, 06:51
I've tested the marshalreport.py with allready secured UDP packets from an earlier session using packetgrab.py and the result seems ok, it returns a .json file that needs to be parsed before you'll get visible data

Like if i did understand anything :D


Sorry I've been radio-silent for the past week. Real life has taken priority a bit; I'm going to scan the thread and the projects, see where I am, and hopefully get back to work as soon as possible!

Are we there yet? :D ;) Take it easy man!

BulletEyeDK
08-04-2016, 08:33
I'm sorry for the delayed response. I using Windows.

Hi dale3d, another user have made this tutorial on how to run ReplayEnhancer under Windows, try that out -> http://forum.projectcarsgame.com/showthread.php?43736-UDP-Replay-Enhancer&p=1218881&viewfull=1#post1218881

NB. im using Linux my self, so can't really help any further than that

dale3d
08-04-2016, 18:11
Thanks, I will dig into it this weekend.

keppo
10-04-2016, 08:31
is it possible to change the location of the timing boxes. I could not find a option for it.

I run the cockpit view and I would like to lower the timing info

SenorPez
25-04-2016, 15:55
Real life is a terrible place to be. Hopefully I've fulfilled my quota of bad weeks for a while, the capstone was my main computer (which contained a lot of in-progress work data, as well as the development of these projects) deciding to chew up its hard drive. Luckily, I have backups. Unluckily, it takes a while to get back up to speed (again) after losing a few days to rebuilding the drives.

Back in development, for real this time. Apologies again, will review thread once I'm sure the train I'm riding on this morning isn't about to get hit by a meteorite. ;)

azidahaka
26-04-2016, 07:43
Had a catastrophic crash a couple of times... Usually ends in a couple weeks of swearing :D

SenorPez
28-04-2016, 14:20
@azidahaka: I've found a BUNCH of bugs in the Marshal, but they're coming along. They're mostly related to data handling in multiplayer, when people drop out early. Project CARS *does* actually behave in a consistent and sane manner, but that doesn't make it easier to "switch over" as the participants change, especially given the non-guaranteed nature of UDP packets. (In simpler terms, UDP is like regular mail: It doesn't check or care about delivery order, or even delivery confirmation.)

@Bullet: I like the Plot.ly graphs for standings... those are really slick. I'll see what I can do with them as I move forward.

@Dale: If you're still having issues, give me a PM. An installer and GUI are on the way, but in the meantime, if you work through the heartburn to get things working, actual usage gets a lot simpler.

@keppo: Right now, positions would be (most easily) set by using a custom output. That's specified with the -u option, but you'll have to dig into the code to adjust the behavior. (For what it's worth, positioning of modules is coming. There's a lot on the TODO plate right now!).

https://github.com/SenorPez/project-cars-replay-enhancer/blob/master/ReplayEnhancer.py
The create custom function is on line 596. Right now, all it does is make the default video layout and create a subclip of that, because I've mostly used the -u option to debug and test.
To change, this, you could copy the __build_default_video function on line 629 and create your own function. (Or just edit __build_default_video if you don't like the existing defaults!) The positioning lines are shown with set_position, and are documented in the MoviePy docs: https://zulko.github.io/moviepy/crash_course/crash_course.html

If that's too far over your head (and trust me, it can be a lot to absorb!), send me a screenshot and I can adjust positions to your liking!

Last, but not least, just a teaser of something else I've been plugging away at. It's ugly as sin, has no validation, but...
http://i.imgur.com/XYZNm35.png

BulletEyeDK
28-04-2016, 21:04
Thanks for updating us on the progress... im personally looking forward to an improved marshalreport ;)

azidahaka
29-04-2016, 08:36
@azidahaka: I've found a BUNCH of bugs in the Marshal, but they're coming along. They're mostly related to data handling in multiplayer, when people drop out early. Project CARS *does* actually behave in a consistent and sane manner, but that doesn't make it easier to "switch over" as the participants change, especially given the non-guaranteed nature of UDP packets. (In simpler terms, UDP is like regular mail: It doesn't check or care about delivery order, or even delivery confirmation.)


Last, but not least, just a teaser of something else I've been plugging away at. It's ugly as sin, has no validation, but...
http://i.imgur.com/XYZNm35.png

Very cool stuff! I didn't think the UDP stream would get weirded up after a race/qualy session starts if someone drops, but that is certainly a UDP stream issue and not any fault of yours. Keep up the good work!

SenorPez
27-05-2016, 15:57
I'm TRYING to get 0.3.1 out the door, but the wifi on my work train hasn't been cooperating most of this week. There's a few small fixes in 0.3.1, mostly code cleanup to prepare for some bigger changes that I've in the pipeline. Also I've created the skeleton for live reports with the Marshal Report. Unfortunately, Amtrak's wireless service seems to be against me lately!

SenorPez
01-06-2016, 19:11
0.3.1 Released.

There's not a huge amount of change here, owing mostly to the chaos that's been my life in the past 8 weeks. For that, I apologize.

What is here:

Support for what I'm tentatively calling "additional participants." These are racers who may have points in a series but are not racing in the current race. They're handled appropriately.
Support for entering the colors for your heading and regular fonts.
Code cleanup and backend changes to make things a bit more stable and faster.


More is coming, I promise.

Here's the current roadmap for the Replay Enhancer (marshal report is separate right now, as I can work on that without wifi connections!):

A 0.3.2 release to fix any bugs that might crop up right now.
A 0.4.0 release with new features. If you have something you'd like added, from new overlays to new graphics, please file it on Github. For example, there was a request for "Positions Gained/Lost" arrows, which is a great thing to request.
A 1.0.0 release that includes packaging as an application, instead of a python script, and possibly a GUI.


All of these are being developed in parallel, so there's no dependency between them. If you have suggestions, or if you find problems, please reach out. Thanks!

BulletEyeDK
03-06-2016, 07:54
Thanks keep up the good work, will for sure test this new release ;)

SenorPez
03-06-2016, 19:25
Small error in the release, so I'm pushing out a 0.3.2 today (literally, two lines of code changed). Sorry about that!

SenorPez
14-06-2016, 19:21
Just a quick teaser of what's coming soon, time permitting...

New graphics style: Much more minimalist. Giving less information to clean up the visual clutter, inspired by other games and the current F1 graphics package, where exact data isn't necessarily important.
The order looks a little funny because the rows are in the middle of animating to their new positions. (My YouTube upload isn't processing, so I'm resorting to a static screen shot.)

http://i.imgur.com/4AQDBrE.png

SenorPez
23-06-2016, 22:12
Maybe not the best exemplar, as I'm in the lead most of the race and there's very little passing, but a sneak-peek some of the new graphics in the 0.4 branch.

Note that if I wasn't in the Top 8, the standings would split into two "windows:" One showing the Top 5, the other showing me and the two cars ahead and two cars behind me.

Also, there's a few hooks in here that will make some things easier. For example, those flyouts that show the laptime? Easily changed to show, for example, gap to the leader.


https://www.youtube.com/watch?v=DnNfij01sc8

BulletEyeDK
25-06-2016, 20:43
@SenorPez - Looks really crisp ;) Is this version available ?

SenorPez
27-06-2016, 14:32
@SenorPez - Looks really crisp ;) Is this version available ?

With the disclaimer below in mind, but if you download the 0.4-devel branch and run it with the -u flag, it'll use the new graphics.

Once 0.4 is released, I plan on making this the default, with a flag (letter to be determined) to use the old style instead.

However, there are also backend changes (ways the telemetry is read, so that the whole block of data isn't in memory at once, making things faster and easier to use) that will affect it's suitability. Right now, it'll probably only work with some races. As I'm driving toward a 0.4 release (and working on other projects), I'm increasing the compatibility to where it needs to be. Unfortunately, I may have broken a finger this weekend, so... vOv. Hopefully the MD appointment brings good news.

I realize that this is probably all too little, too late, given where PCARS is in its lifecycle. But it remains a labour of love for me, so I plan to keep working on it, fingers and time allowing. If I'm not responding here, you can always reach me with errors and suggestions on the Github pages!

BulletEyeDK
27-06-2016, 18:46
Thanks for the heads up, will give it a go, great work :)

Good luck with that finger of yours ;)

SenorPez
12-07-2016, 14:30
Huh, thought I'd posted here.

The finger wasn't broken, and I'm continuing to chug away at getting a functional 0.4 release. Part of the hurdle is that, with the rearchitecting I've done, not every data set is working currently. It'll get there, though. If you have suggestions, problems, or improvements, let me know... GitHub's issue tracker is probably the best way to do that!

keppo
16-07-2016, 06:37
i just started replayenhancer again. actually I started Prjcars again. I started to use the 0.3.2 branch but i have this error

Traceback (most recent call last):
File "ReplayEnhancer.py", line 21, in <module>
import unicodecsv as csv
ImportError: No module named 'unicodecsv'

problaly easy fix but i can't solved it:confused:

PS:I will make a issue in GitHub tracker

SenorPez
18-07-2016, 21:40
I've made some comments on Github, but I'll also summarize here:

Apparently, I was mistaken in that UnicodeCSV was included with one of the other packages I use. It should be installable with "pip install unicodecsv".
Second, the standings code is an absolute horror right now, and I'm working on getting it fixed. :D

SenorPez
25-07-2016, 14:25
Work continues. 0.4 is turning out to be a major rewrite, but it should be worth it. It's probably mostly unusable right now, as I need to rework a bunch of the code that handles things like multiplayer dropout / join, but it's getting there!

SenorPez
01-08-2016, 13:56
A quick update as to where we are. Thanks to anyone who is still following this. :)

Replay Enhancer 0.4: 0.4 appears to be finished for single-player races, so my next step is readding the logic for handling the more chaotic nature of multiplayer races, namely, players leaving and joining mid-race. Once that's done (maybe this week, depends on a few external influences), I'll put out 0.4 for testing.

Marshal Report: Most of the roadblocks I hit when working on the Marshal Report have been resolved by the rewrites to 0.4 above. Namely, there were some unexpected challenges in handling packets as they arrive (pre-0.4, the Replay Enhancer just looked at the entire dataset at once, rather than individual packets). Once 0.4 is done and finished, I'll port what I learned and be able to continue.

GUI: There's been some work on a Graphical frontend for all of this, too. Stay tuned. ;)

... now, if I could only figure out the first corner at Brands Hatch...

SenorPez
08-08-2016, 14:40
For those who are willing to test it, 0.4 is now ready for testing.

You can get it from the 0.4-devel branch.
When running the 0.4 branch, you must use the -u switch. Failing to use this switch will cause an error. This behavior will change before release, obviously, just an FYI.
Old configuration JSON files will not work. You must create new ones. (Using the -c switch and just accepting all the values will update the JSON to the latest version.)

A few below-the-fold details:

It's taking everything I have to not start over. There's still some problems here. I'm learning a lot, including that I'm not a professional programmer. ;)
The GUI is close, as is having this as a packaged Python module.

SenorPez
25-08-2016, 16:21
Where We Are
I'm trying to figure out what to do with 0.4. It's not as stable (there are a few edge cases that aren't handled) or as complete (time-based races will just not work) as I'd like. But if people want to use the new fancy graphics, they can. My current plan is this:

If you want to use 0.4, check out the 0.4-devel branch. If you run into problems, I'll help you resolve them.

I'd rather have people using the new graphics and enjoying their replays while having to do some support. So please, if you want to enhance replays, go for it, and if you get stuck or frustrated, reach out to me (either here, or Github).

Where We're Going
Here's some exciting stuff, if you've still reading!

A Java Application to create and edit configurations is almost done. I just have some testing to do before I put out a pull request for public testing.
A Java Application for capturing packets is almost done. Again, just have to do some more testing before I put out a pull request.
A Java Application that's a frontend to the python scripts has been started. Yes, this means that you'll NEVER have to directly run the python scripts. Just click with your mouse, and go.
BIG refactors in the python modules, decoupling things from each other. If you have no idea what that means, let me give you an example:

In the current structure, everything relies on everything else. This means if something breaks, or if I have to change something, a bunch of things can break. Also, other app developers couldn't use anything I've worked on.
In the new structure, things only rely on things they need to rely on. This not only makes things easier to build, but should other app developers want to use my terrible code, they could.
A great example of this is what I've built for "Race Data." Race Data is things that can't be divined from a single telemetry packet or is lost by the arrival of future packets: Starting Grid, Sector Times, etc. Old version, Race Data relied on the Replay configuration. It really shouldn't. You can now get Race Data without creating a replay.



All in all, there's progress being made.

tl;dr summary:

0.3.2 works great. Old graphics.
0.4 works for most replays. New graphics. Let me know if you have problems.
New version that's better is coming.

SenorPez
26-09-2016, 15:38
I've been super-quiet lately (my actual wage-paying job has required more travel that hasn't allowed me as much time to code, and we're closing in on October, which is a busy month), but there has been work done. You can see the results here:


https://www.youtube.com/watch?v=nLGH2Bw3ISs

"Wait, Senor Pez," you might ask. "That looks exactly like what you had before."

"And you're correct," I'll respond. "But there's a lot of differences under the hood that make things awesome."

What's new?

It's completely modular now. In fact, if you're willing to deal with default fonts, no fancy styles, no background, etc., you can actually run the Enhancer without a configuration. It'll load defaults where needed, and just not render elements elsewhere, and put your output. And each component (Starting Grid title card, Results end card, Series Standing end card, Champion end card, and even the animated Standings tree during the race) can be created separately. Which is a long way of saying that, if you wanted to use the Replay Enhancer to create a Starting Grid card and nothing else, you can do that now!

As a corollary to the one above, it also means that, with a little effort, you can use your own graphics or animations in the rendered replay. Don't want to use my default Results card? Want to just whip something up in Illustrator yourself and have it displayed after your video. This can now be done. (Due to the nature of the code in the previous iteration, that was difficult-to-impossible.)

Even the video is optional, in fact. Want to just get an animated Standings list, and nothing else? You can have that.
"Static Cards" as I call them (like the Starting Grid) are easier to create and configure now. For those enterprising users who want to add additional data columns (for example, if you want to show a Car Number), it's much easier to create your own cards that use data from the telemetry.
The configuration was completely created (there are a few bugs I have to squash, but we're close) with the Java-based front-end. No more command line configuration creating, where you have to suffer through every entered field to edit one, or venture into a JSON file to manually edit it.
The process to create the video was launched through the Java-based front-end. This ones a little less mature, but I'm not going to release without it. This means you never have to run a Python command line unless you want to.
It's faster.


It's not complete yet. There are still features that need to be added, but I'm making progress, and will hopefully have the fruit of my labours to show sooner rather than later.

--

A quick question:
The lines in the "Standing" list during the race are transparent, but block content behind them when they move. This actually creates a clean visual effect (allowing the "rising" driver to be read, instead of making it harder to read), but violates the nature of a transparent object. Thoughts? I like it the way it is, but I'm not sure if I'm the only one.

Alan Dallas
23-10-2016, 04:11
~snip

It's not complete yet. There are still features that need to be added, but I'm making progress, and will hopefully have the fruit of my labours to show sooner rather than later.

--

A quick question:
The lines in the "Standing" list during the race are transparent, but block content behind them when they move. This actually creates a clean visual effect (allowing the "rising" driver to be read, instead of making it harder to read), but violates the nature of a transparent object. Thoughts? I like it the way it is, but I'm not sure if I'm the only one.

Waiting patiently for this awesome work. I too like that it that rising driver's name blocks the overtaken driver. Keep it.

BulletEyeDK
24-10-2016, 10:24
@SenorPez - been a while since my last visit here... this update sure looks pretty crisp, will for sure keep track of this topic waiting for any news on the new improved version, thanks for your continued work on the replay enhancer ;)

SenorPez
27-10-2016, 17:02
A quick update... I've been quiet, mostly because my actual job has been taking up way too much time lately!

The Java-based Configuration Editor is just about complete. I'm currently generating configuration files from it, and squashing bugs as I come across them.

Once that's done, I need to figure out how to wire launching the Python script from the Java application, and we'll be ready for you to find all the bugs and errors that I've missed. ;)

chrcoluk
28-10-2016, 22:28
Hi guys, sorry if this is a dumb question but how do I download this? I see no download links.

SenorPez
09-11-2016, 16:39
It's been way too long since I pushed a release, and for that, I apologize. By pushing a release for testing.
There's not yet a link between the UI and the scripts. But we're close.

First up, the Configuration Editor.

Configurations are now created using a Java application. (I mean, technically, you could write it by hand. Don't do that.)

The Release Candidate for this application can be downloaded from here: https://github.com/SenorPez/project-cars-replay-enhancer-ui/releases/tag/release-0.1rc1
Download ConfigurationEditor.jar and run it to launch the configuration editor.

If you find a bug or have a suggestion, they can be reported to the UI project: https://github.com/SenorPez/project-cars-replay-enhancer-ui/issues
Not everything is implemented. Additional Participants and Car Classes are currently non-functional.

Second up, the actual Replay Enhancer.

It's published to PYPI! This is a big deal because installing is super easy now.

To install:

Install Python 3.3 or greater for your platform: https://www.python.org/downloads/
Install the Replay Enhancer through PIP (usually installed by default... if you need to install PIP, see https://pip.pypa.io/en/stable/installing/). From a command line, run pip install replayenhancer. The Replay Enhancer and all its dependencies are downloaded.


To run the Replay Enhancer, from the command line:

To create a telemetry-sync video (see the README for details), run replayenhancer -s config.json.
To create a final video, run replayenhancer config.json.


If you find a bug or have a suggestion, they can be reported to the project: https://github.com/SenorPez/project-cars-replay-enhancer/issues
Car class "chits" aren't yet implemented for multi-class races.

Questions, comments, let me know!

SenorPez
09-11-2016, 17:02
Hi guys, sorry if this is a dumb question but how do I download this? I see no download links.

The "old release" was... somewhat clunky to download.
The "new release" is less clunky. You'll still need to use the command line in Windows, but it's far less difficult. See the above post for installation!

It's still in testing, but I'd love feedback from someone new. Message me here or post in the thread if you get stuck; I'm happy to help!

Michel--NL
09-11-2016, 19:18
Good to see you are still working on it.
For myself i'm mostly playing F1 2016 at the moment. It has also UDP streaming but no replay function for multiplayer :-(

Maybe going to participate in AOR league GT3 for Project Cars end November. If so I will definitely try the new Replay Enhancer.

SenorPez
02-12-2016, 16:16
Hi. Sorry. Been busy.

We're really close to a release. I've got one more feature to add, and I'm going to make sure that Michel--NL's latest race renders right, and then I'm going to push this out the door to start on the the batch of bugfixes and such!

SenorPez
02-12-2016, 16:19
Terminology question for you:

In the standings, there are two... "areas."
The first shows positions 1 through x.
The second shows y positions, centered on the subject car, if the subject car isn't in that first area. If it is, than the first area just shows 1 through x + y.

What would you call these? Because in the feature I'm pushing out today, x and y are now configurable... but I'm not sure how to clearly name them in the configuration.

Thoughts?

Thanks!

SenorPez
15-12-2016, 15:25
0.5 released. It's faster (everything basically waits on the video processing library I'm using, now, as opposed to my own scripts), and has a GUI to create configurations, so it's MUCH easier to use!

There are the scripts: https://github.com/SenorPez/project-cars-replay-enhancer
And the graphical frontend for creating configurations: https://github.com/SenorPez/project-cars-replay-enhancer-ui

Feel free to lodge bugs and suggestions on the github trackers, and enjoy!

BulletEyeDK
10-01-2017, 07:35
Will have to try the new version out in the near future, have been away from playing pCARS for nearly a month....

Thanks for your hard work on this one ;)

SenorPez
12-01-2017, 20:23
Hey gang, a quick update here!

First off, happy birthday, Project CARS Replay Enhancer. A year ago (give or take), I made the first public commit to this quixotic endeavor.
Second, and more importantly, a schedule. The New Year has been horribly busy for me (both in work, which is normal, and socially, which is new), so I need to get caught up:

A new Release Candidate of everything should be published tonight or tomorrow. I went down the rabbit hole to try and figure out why replays on longer races are getting out of sync eventually... and still haven't figured out a solution.
If that RC seems decent and things are handled, 0.5.1 will be released.
0.6 will follow, including the last of the features that will constitute "completeness" (timed races and the ability to fake the watched car, if you want to have a target other than the one in the race telemetry) when compared to the older, slower version.


Thanks to everyone who's been willing to test and use this.

And as an added bonus, I've even been able to PLAY a bit of PCARS lately, which has been a fun return. Coming back to the Lotus 98T series after a few months off is... difficult.

SenorPez
25-01-2017, 18:36
I'm going to put together a more comprehensive post, but 0.5.2 has been released. It's more stable, and fixes a nasty bug that's been hanging around for a while: Namely, on longer races, you'll notice the telemetry and video slowly drift out of sync. My life is SUPER busy right now, but I wanted to put out a quick notice, with more details coming in the future.

As always, if you have problems or feature requests, please reach out; I'll gladly help you get up and running!

MadMohawk
10-02-2017, 19:51
Sooooo I could use UDP to my Windows 7 PC to capture live race standings during replays as an overlay I can place in my replay footage? Am I right that I replay on PS4 not on my PC? That's awesome, or does the UDP send the video over and the python scripts Munge it altogether into a lovely finished video with the race standings overlayed? Thanks just getting back into Sim Racing

SenorPez
13-02-2017, 16:36
You're close, but just to make sure:


Project CARS outputs a UDP stream of telemetry data (no video). This can be output from PC, PS4, or XB1, and captured by a computer. You do, however, need to capture the telemetry during a live race; the telemetry output while viewing a replay doesn't include enough data, unfortunately.
Your video (either of your live race or of the saved replay) can be captured through whatever method you choose. I have an Elgato HD that I use to capture from my PS4, but there are other free methods available. For example, PS4 can stream to YouTube and you can then download the YouTube video.
The script will then take that telemetry data, that video, and a configuration you create to produce the overlay on the video.


UDP does not send any of the video data, unfortunately. That's one of the trickiest parts of creating a video: Making sure the video and telemetry are synchronized.

Also note that the movie rendering library isn't fast enough for live broadcasting. If you want a "live" overlay, you may look into something like this: http://forum.projectcarsgame.com/showthread.php?46987-Race-Overlay-(for-console-streamers)

If you have any questions while getting started, please feel free to reach out!

SenorPez
14-02-2017, 18:51
Releases coming soon, either in release candidate form now or shortly will be:

0.6 adds support for time-based races, the ability to fake the watched car, and a few other fun features.
0.2 of the UI will add support for those new features, along with some speed and execution enhancements.


As part of the testing, I'm rerendering a bunch of my career mode videos. They'll trickle out onto the YouTube Playlist: Let's Play Project CARS: Kobernulf Monnur (https://www.youtube.com/playlist?list=PLy-S2xlLES80Wy18ydpmO1D9jU200jcWJ)


https://www.youtube.com/watch?v=JMT7R1nyt6c

SenorPez
21-02-2017, 20:43
Everything's in testing. By the end of the week we'll have a release. If you're inclined, head over and download the Release Candidates, or don't, and wait until official releases. :D

In the meantime, I spent a bit of time writing words (because I didn't have much else to do while 65+ videos rendered to test the new releases) about the rewrite, and why things are more awesome now. So much, in fact, that I've got some directions for the future. You can read them here: https://senorpez.github.io/project-cars-replay-enhancer/

SenorPez
24-02-2017, 15:58
0.6 of the Replay Enhancer and 0.2 of the Replay Enhancer UI have been released.

Full details of the release contents are in the posts below, but a wider array of features, greater speed, and more stability come to the project.

The Replay Enhancer can be installed using the python package manager "pip": pip install replayenhancer
The Java JAR files for the Replay Enhancer are included in the release post linked below.

Replay Enhancer 0.6: https://github.com/SenorPez/project-cars-replay-enhancer/releases/tag/release-0.6
Replay Enhancer UI 0.2: https://github.com/SenorPez/project-cars-replay-enhancer-ui/releases/tag/release-0.2

As always, if you have any questions or need help getting started, please feel free to reach out!

Bigbadbez
14-03-2017, 15:38
Hi mate,

Been looking for something similar to this add-on fro a while and havent' got in touch as your is described as a replay enhancer rather than for a live race... Would it be possible to get this to work for a live race as an overlay in, say, OBS?

Cheers,

Bez

Ryzza5
15-03-2017, 02:37
Thanks for the steady updates, Pez. It'll be interesting to see how the out-of-box feature in pCARS2 replays/broadcasting compares to tools like these.

SenorPez
21-03-2017, 15:40
Hi mate,

Been looking for something similar to this add-on fro a while and havent' got in touch as your is described as a replay enhancer rather than for a live race... Would it be possible to get this to work for a live race as an overlay in, say, OBS?

Cheers,

Bez

I can't promise anything definite right now (in part because it's the end of the quarter, meaning I'm swamped with real job stuff for the next week!), but I might have a line on doing something as a live race overlay. It would be far less elaborate that say, Chewbax's project, but more appropriate for streamers that want a fire-and-forget solution as opposed to more "professional" broadcast presentations that require a director and such!

SenorPez
21-03-2017, 15:40
Thanks for the steady updates, Pez. It'll be interesting to see how the out-of-box feature in pCARS2 replays/broadcasting compares to tools like these.

The ironic part is that I hope none of this is necessary in Project CARS 2. :)

SenorPez
27-03-2017, 16:24
I've uploaded a new release for the UI component to fix an error with video length detection. Sorry it took so long; the complexity of figuring out why it was occurring only some of the time combined with real life intruding due to the end of the quarter made progress slow.

SenorPez
14-08-2017, 14:43
Based on what I've seen from PCARS2 replays, there's still going to be a need (and hopefully a want?) for the Project CARS Replay Enhancer. As I plan on playing PCARS2, and want to enhance my replays, I might as well make it available to others.

If you have any suggestions for improvements or new features, to either the Project CARS Replay Enhancer or the support tools I'm developing, please feel free to submit them to github under the https://github.com/SenorPez/literate-invention project.

My current plan includes:

Race Data Processor: Created in Java. Faster.
Static Data API: RESTful API for accessing static Project CARS data (race information, car data).
Race Data API: RESTful API presenting race data in progress.
Replay Enhancer: Obviously. Looking into migrating it to Java for speed, but the Python library I use in the existing project is pretty easy and faster.


Please, let me know if you have suggestions. As before, I think it's great to have community-supported projects, and want to help provide that!