GM PDR Data Extraction

Started by JSenek, June 17, 2020, 08:28:28 PM

Previous topic - Next topic

JSenek

GM vehicles such as Corvettes and Camaros can record videos in mp4 format with a wide variety of embedded data, from engine RPM to oil temperature. Would exiftool be an appropriate tool for extracting said data?

I've gotten as far as seeing a few interesting tags such as the following, but want to make sure I'm not trying to fit a square peg in a round hole:
HandlerType                     : Unknown (ctbx)
HandlerDescription              : Marlin PDR 1.0
OtherFormat                     : marl

An example can be found at https://www.dropbox.com/s/rgz9cklhoufqvy5/200513_213223_00005_.mp4?dl=0

Thanks ahead of time to anyone with any advice!

Phil Harvey

This looks interesting, and is something that ExifTool could possibly decode.  I'll take a look at this when I get a chance, but any additional information you can provide would be helpful

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JSenek

#2
Thanks for taking a look. Is there anything in specific you would like to know?

Edit:
It's possible to view the embedded data with software put out by Cosworth, such as https://www.cosworth.com/toolbox-for-corvette/ . I can also provide lots of other sample files.

Phil Harvey

Unfortunately that software is Windows only.  Could you run it for the file you uploaded and tell me all of the recorded values for the first few samples?  Thanks.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JSenek

In one part of the UI, the software displays some values plotted onto a chart, and allows stepping through it with video playback side-by-side. Different data appears to have different polling rates.

The following appear to update in 0.01s increments. Here is the data displayed for the first 10 data points in the UI (0:00.00 - 0:00.09).
Accelerator: -, 13, 13, 13, 13, 13, 13, 13, 13, 13
Brake: 2, 1, 1, 1, 1, 2, 2, 1, 1, 1
Time Delta: No values, and I believe this is calculated anyways.

The following appear to update in 0.1s increments, and thus are not synched with the start of the video. Here are the first 10 data points (0:00.06 - 0:00.96).
Speed: 68.2, 68.2, 68.2, 68.2, 68.2, 68.2, 68.3, 68.3, 68.3, 68.3
Lateral Acceleration: -, 0, 0, 0, 0, 0, 0, 0, 0, 0
Longitudinal Acceleration: -, 0, 0, 0, 0, 0, 0, 0, 0, 0

I have never seen values populate for the following, but they are displayed in the UI in 0.01s increments.
LF Suspension
RF Suspension
LR Suspension
RR Suspension
Yaw Rate

There is yet more data displayed in the UI as only per-lap data. For this, there is obviously only one set, but in other on-track recordings it does display one set per lap. Here is data that is being recorded at unknown intervals:
Min LF Tire Air Temperature: 100
Max LF Tire Air Temperature: 100
Min LR Tire Air Temperature: 97
Max LR Tire Air Temperature: 97
Min RF Tire Air Temperature: 102
Max RF Tire Air Temperature: 102
Min RR Tire Air Temperature: 99
Max RR Tire Air Temperature: 99
Min LF Tire Pressure: 29.6
Max LF Tire Pressure: 30.2
Min LR Tire Pressure: 29.6
Max LR Tire Pressure: 29.6
Min RF Tire Pressure: 30.7
Max RF Tire Pressure: 30.7
Min RR Tire Pressure: 30.2
Max RR Tire Pressure: 30.2
Min Water Temperature: 185
Max Water Temperature: 187
Min Engine Oil Pressure: 36.0
Max Engine Oil Pressure: 37.1
Min Engine Oil Temperature: 185
Max Engine Oil Temperature: 185
Min Transmission Oil Temperature: 163
Max Transmission Oil Temperature: 163
Max Intake Boost Pressure: -5.8

Buried in yet another portion of the interface (ugh) it is possible to see two more readings, but they can only be stepped through by progressing the video feed frame by frame.
Steering Angle: Starts with no value, first value of 3.3 at 0:00.16
Gear Number: Starts with no value, first value of 7 at 0:01.6

Finally, here is some displayed data that I believe is merely calculated:
Lap Time: 0:23.16
Average Speed: 71.08
Max Speed: 72.9
Max Lateral G: 0.00
Time on Accelerator: 0.0
Time on Brake: 0.0

I'm hoping this is a little more thorough then you need. As you can see, there's a lot in there that would be nice to have as a data dump for reformatting for other software.

Phil Harvey

Thanks.  That should be useful.  To decode the acceleration I may need some no-zero values.  What are the first non-zero values for each of these in the file you sent.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JSenek

Unfortunately since that was a small recording on the highway, there are no nonzero g-force values.

I do have other recordings with much more active data, but they're ~800-960Mb each. I'd be happy to link one or go take a spirited spin around the block to make a new sample.

Phil Harvey

A small sample would be better.  :)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JSenek

Sorry for the delay. I recently returned from Road Atlanta and remembered to grab a few quick samples afterwards. Below is the one I selected for this post.
https://www.dropbox.com/s/tsalggxb347ohfm/200627_184111_00004_.mp4?dl=0

As I began to transcribe some of the data from the selected clip, I realized that it appears that the UI is rounding all displayed timestamps to the nearest 0.01s, while the data is probably actually logged with more precision.

Since this rather complicates data transcription, I've saved the samples to the following spreadsheet: https://docs.google.com/spreadsheets/d/1JCRBaXIRBxwbcZZzjOUY_4OFfQhErxPS_3MKjJc-xoY/edit?usp=sharing

I grabbed the first 10 datapoints per sensor, and then I selected another set of 5 with more "interesting" values.

EDIT: I also wanted to mention that GPS data is also being recorded, but I did not see an easy way to export that information.

Phil Harvey

Great, thanks.  I'll take a look at this when I get a chance... it may be a couple of weeks (summer is busy time for me).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JSenek

No expectations here. Thanks a bunch for being willing to take a look. If there's any preliminary work I can do to assist, please let me know. I program for a living, but my area of expertise isn't at all related to this.

Phil Harvey

Wow.  OK.  I stared at this data for about 4 hours yesterday, and finally managed to see some patterns, but I still haven't been able to find the GPS or any other useful tags.

First, the 'mrld' box gives this list, which one might expect to tell us what metadata is available:

1) System Power Mode ()
2) System Backup Power Enabled ()
3) System Backup Power Mode ()
4) Steering 1 Switch ()
5) Steering 2 Switch ()
6) Transport Storage Mode ()
7) Infotain Op Mode ()
8) Valet Mode ()
9) Boost Pressure Ind (%)
10) Coolant Temp (°C)
11) Intake Boost Pressure (kPa)
12) Oil Pressure (kPa)
13) Oil Temp (°C)
14) RPM (rpm)
15) Accel Pos (%)
16) Clutch Pos (%)
17) Brake Pos (%)
18) LF Tyre Pressure (kPa)
20) RF Tyre Pressure (kPa)
19) LR Tyre Pressure (kPa)
21) RR Tyre Pressure (kPa)
22) LF Tyre Temp (°C)
24) RF Tyre Temp (°C)
23) LR Tyre Temp (°C)
25) RR Tyre Temp (°C)
26) Gear ()
27) Trans Oil Temp (°C)
28) Fuel Level (%)
29) Fuel Capacity (ltr)
30) Steering Angle (°)
31) Distance (km)
32) Speed (kph)
33) ABS Active ()
34) Traction Control Active ()
35) Vehicle Stability Active ()
36) Corner Exit Setting ()
37) Speed Request Intervention ()
38) Speed Control Response ()
39) Engine Speed Request (rpm)
40) Engine Torqure Req (Nm)
41) Battery Voltage (V)
42) Lateral Acceleration (G)
43) Longitudinal Acceleration (G)
44) Vertical Acceleration (G)
45) Latitude (°)
46) Longitude (°)
47) Altitude (m)
48) Heading (°)
49) GPS Fix ()
50) Beacon ()


But now the tricky part.  The timed metadata is stored separately in a timed 'marl' box.  It seems to be composed of 8-byte records.  I think the first byte is the tag ID.  ID 0 is a timestamp, but I don't know what the other tags are.  The next 3 bytes are a 24-bit signed integer, usually with small positive or negative values, but I don't know its significance.  The next 4 bytes are a 32-bit unsigned integer value.  Most values are multiples of 10000.  But I can't figure out what any of them mean.

I've included a text dump of the metadata from the 15-second video you sent, organized into section based on the tag ID.  The first two columns of the text output are the 8 bytes displayed as 2 hex words.  The third column is the second word displayed in decimal.  You can see the timestamps in the first section.  Let me know if you have any idea what the other sections mean. 

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jparrish88

Hi All,

Phil this is awesome. I too am looking to get a hold of some of this raw data. I would love to look at the data indicated by the marl and look to see if it lines up with the Cosworth tool set.

Could you note how you pulled the marl data? I can't seem to get there myself. Any help would be very appreciated. I can also provide several samples of mp4's where data was recorded and provide the dumped information.

If I can get my hands on the MARL data from my videos, I hope to provide you the means to parse the data.

Phil Harvey

Did you want the marl data from the posted video?  Attached are the raw data blocks from that video for 'marl' plus other unknown chunks.

You can extract the marl data in hex form using exiftool -ee -v5 (but note the -v5 output will be very lengthy)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

oosheixe

much of the info to decode the pdr file is found in the following patent:
https://patents.google.com/patent/US20160307378/en
https://patentimages.storage.googleapis.com/71/28/87/3f66579cb7f7e4/US20160307378A1.pdf

i'm interested in poking through my own pdr data

i've extracted the data stream directly using:
$ ffmpeg -loglevel info -i 200509_130855_00001_.mp4 -map 0:d -c:d copy -f data sensor.dat

looking at my file i see content as follows:
$ xxd -b -c 8 sensor.dat | head -21 | cut -d\  -f-9
00000000: 11100000 00000000 00000000 00100010 00000000 00000000 00000001 11000101
00000008: 00000000 00000000 00000000 00000000 00000000 00000000 00111111 10100000
00000010: 01000001 11111111 11100001 11100101 00000000 00000000 00000000 00000000
00000018: 01000001 11111111 11100001 11000110 00000000 00000000 00100111 00010000
00000020: 01000001 11111111 11100001 11101010 00000000 00000000 00000000 00000000
00000028: 01110001 00000000 00000111 00110000 00000000 00000000 01110101 00110000
00000030: 01010000 11111111 10000001 00000000 00000000 00000000 01001110 00100000
00000038: 01000001 11111111 10000000 11111000 00000000 00000000 00000000 00000000
00000040: 01000001 11111111 10000000 11101011 00000000 00000000 00000000 00000000
00000048: 01000001 11111111 10000000 11110001 00000000 00000000 00000000 00000000
00000050: 11100000 00000000 00000000 00000111 00000000 00000000 00000000 00001001
00000058: 00000000 00000000 00000000 00000000 00000000 00000001 11000110 01000000
00000060: 01111100 00000000 00000000 00000001 00000000 00000000 00000000 00000000
00000068: 01000011 11111111 10001100 00011101 00000000 00000000 00000000 00000000
00000070: 01011010 11111111 11111110 11110101 00000000 00000000 01001110 00100000
00000078: 01110110 00000000 00000000 00000010 00000000 00000000 01110101 00110000
00000080: 01000010 11111111 11000011 10110111 00000000 00000000 00100111 00010000
00000088: 11100000 00000000 00000000 01000010 00000000 00000000 00000000 00001100
00000090: 00000000 00000000 00000000 00000000 00000000 00000011 00100110 01000110
00000098: 11100000 00000000 00000000 00000111 00000000 00000000 00000000 00001001
000000a0: 00000000 00000000 00000000 00000000 00000000 00000011 11000010 00010000

referencing the patent doc section [0033] i believe this data shows:
- a full sensor reading at 00000000 followed by 8 compact sensor readings
- a full sensor reading at 00000050 followed by 5 compact sensor readings
- a full sensor reading at 00000088
- a full sensor reading at 00000098

i'm not sure if exiftool is the correct tool for looking at the sensor data itself,
however in addition to the sensor data itself, the patent indicates that there is
a "a series of lookup tables", including:
-  a Header ('mrlh') box 30.15
-  a Values ('mrlv') box 30.16
-  a Dictionary ('mrld') box 30.17

i think exiftool would be perfect for extracting these fields
i don't know if exiftool can do this today through a combination of flags or if this is something that would need to be coded separately

@PhilHarvey, if it is possible to extract the referenced metadata, would you demonstrate how to do so?

and, thanks for making a such a useful tool
and, thanks for responding and following up to community requests -- it is very refreshing