Recording and preparing videos for indoor cycling

Here's a workflow for recording and preparing videos for indoor cycling with Incyclist.

The basics

The files to be prepared

The recording equipment

The software tools

Openshot - Open-source Video-Editor
FFmpeg - A Swiss army knife for video file manipulation
GPS Track Editor - Free GPX-editor
GPX Smoother - Free online utility for smoothing elevation data in GPX files
GUID Generator - Free online utility for generating a GUID (Globally Unique Identifier) for the video

The complete workflow

Step 1: Concatenate action cam files

The action cam will record multiple files, which should be combined into one big MP4 file. In this example I have 4 files for a video called 'DE_MR-Lahntal' Every video editing software should allow this. I personally prefer the FFmpeg command line tool for this because it's very fast.

Concatenate command example with FFmpeg

    ffmpeg -safe 0 -f concat -i d:\ActionCam-Raw\files.txt -c copy d:\video-production\DE_MR-Lahntal.mp4''

The files.txt content for above FFmpeg command:

file 'GX010025.MP4'
file 'GX020025.MP4'
file 'GX030025.MP4'
file 'GX010026.MP4'

Step 2: Cut the resulting MP4 and render the final video

Any pauses, stops (e.g. at traffic lights) and undesired footage should be cut out and rendered in a final MP4 file for use with Incyclist.
Openshot will display the total length, the frame rate and the last frame number. You will need those values later on for the XML file, it's worth writing them down.

Edit the video for round trips (optional)

If desired, Incyclist can simulate round trips. During simulation the application will restart the video at the end of the ride allowing us to cycle multiple laps.
For this to work properly, the video should be cut in such a way that the last frame looks like the first frame. In doing so, there will be a smooth transition from one lap to the next.

Step 3: Create the GPX file

The bike computer will record your ride as a FIT file which will need to be converted to GPX. There are conversion utilities for this but I prefer to download the GPX from my online workout tracker.
I use Velo Hero for this, but other tracker such as Strava will work as well.

Step 4: Shift the recording time in the GPX file

The GPX-Recording should have exakt the same length as the resulting MP4 video. It appeared to be useful, to reset the track date and time to a new reference value, e.g. 2000/01/01 00:00:00 a.m. In doing so, it is easy to verify the resulting length of the GPX recording by verifying the timestamp of the last track point: it should be the same as the MP4 length you noted down during step 2.
This can be achieved with GPS Track Editor. Open the GPX file in the application and do the following:

Setting a new start date and time for the track with GPX Track Editor

  Menu Track --> Time --> Shift... --> "New timestamp of the first trackpoint"

Step 5: Cut the GPX file

If the video was cut, the GPX-recording will be longer and needs to be cut as well.
This can be easily done with GPS Track Editor. Open the GPX file in the application and perform following steps:

Cutting the GPX File with GPS Track Editor

  --> Move with your cursor quickly in the track points list through all points, this will move an indicator on the map. 
  --> In doing so, you will now see locations where there is no movement. Leave the cursor on such a location
  --> Right click the point --> Restructuring --> Add break (a new segment is created in the track list)
  --> Right click any undesired segments --> Delete

  Reset the time of a cut segment:
  --> Right click a segment --> Save As... (a new GPX-file containing the segment will be added to the list)
  --> Delete the original segment
  --> Shift the timestamp of the first track point in the new GPX-file to the correct time 

  Combine all cut tracks together:
  --> Select all resulting GPX-Files in the track list and 
  --> Right click them --> Merge
  --> A new GPX file is then created, which we now can use for further processing

Edit the GPX for round trips (optional)

As above mentioned, Incyclist can simulate round trips. For this to work properly, altitude values at the end of the GPX file should be in the range of the altitude values of the first track points in the file.
It might be necessary to edit those values accordingly.

Step 6: Smooth the resulting GPX file

Despite the barometric altitude measurement, most GPX files will still have some unrealistic elevation value changes from point to point. Which then leads to the fact that Incyclist calculates wrong slopes during simulation. This can be corrected easily with GPX Smoother. For good results do the following:

Smoothing the GPX File with GPX Smoother:

  --> Number of points to smooth: 5
  --> Set Slope Range           : Minimum -20   Maximum  20
  --> Flatten Values            : Maximum Change In Slope Between Points 1

The resulting GPX content is displayed and can be copied and pasted into a new file, which is our final GPX file for Incyclist.

Step 7: Get a GUID for the indoor cycling video

Incyclist needs a unique identifier for the video. This is easily obtained using the online GUID Generator.
The tool is self-explanatory, just make sure that the Hypens option is ticked.
Copy the GUID to the clipboard and save it for later use in the XML file.

Step 8: Create the XML file

In order to import the MP4 file along with the GPX data, Incyclist needs an XML-File. Create it with any text editor of your choice.
For this you will need the file names of the MP4 and the GPX files, the video's frame rate and last frame number (you wrote down before) and the GUID you obtained in the previous step.
The GUID must be entered in the id-tag. All other tags are self-explanatory.

Additional information to be displayed (optional)

Incyclist can display information about your ride during simulation. For this, information-tags can be added to the XML file.
The example below, shows bilingual information tags (German, English).
Line breaks can be added with \n.
International characters (accents, Umlaut, etc.) can be entered using their corresponding HTML-codes.
The distance attribute is a value in meters for the exact location where the information should be displayed during the ride.

XML file example for Incyclist

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <gpx-import>
        <name>FR_My_Demo</name>    
        <id>97b87247-a447-4b11-a0c8-99e2abd5ac41</id>
        <country>FR</country>
        <title>FR_My_Demo</title>
        <video-file-path>FR_My_Demo.mp4</video-file-path>
        <gpx-file-path>FR_My_Demo.gpx</gpx-file-path>
        <framerate>30.0</framerate>
        <start-frame>1</start-frame>
        <end-frame>1234567</end-frame>    
        <informations>
            <information distance="100" de="My Demo\nL&auml;nge: 20 km - Anstieg: 100 hm" en="My Demo\nLength: 20 km - Ascent: 100 hm" />           
            <information distance="12300" de="Pont d'Espenel\n(Br&uuml;cke &uuml;ber die Dr&ocirc;me)" en="Pont d'Espenel\n(bridge across the river Dr&ocirc;me)" />
        </informations>
    </gpx-import>