How to Use gpx2srt to Create Timecoded Movement Subtitles
What gpx2srt does
gpx2srt converts GPX (GPS track) data into SRT subtitle files that display time-stamped location or movement information alongside video. This is useful for overlaying speed, distance, coordinates, or lap/time markers in video editors or players that support external subtitles.
When to use it
- You recorded video and GPS data separately (action camera + GPS logger or smartphone).
- You want a time-aligned textual overlay showing position, speed, distance, or timestamps.
- You need an easy way to generate subtitle files for post-production or analysis.
Quick prerequisites
- A GPX file with timestamps that align to your video timeline (UTC or consistent clock).
- gpx2srt installed (command-line tool or script). If your GPX timestamps differ from video time, note the offset (see Step 4).
- Basic familiarity with running commands in a terminal.
Step-by-step guide
- Inspect your GPX file
- Open the GPX in a text editor or viewer to confirm it containspoints with entries.
- Note the first timestamp and time format (ISO 8601 recommended).
- Install or obtain gpx2srt
- Download or install the gpx2srt tool appropriate for your system (script repository or package). Ensure the executable/script is accessible from your terminal.
- Choose output fields and format
- Decide what to show in the subtitles: coordinates, elapsed time, speed, cumulative distance, or formatted timestamps.
- Plan concise text lines (SRT displays for a few seconds—keep text short).
- Align GPX timestamps to video time
- If your camera’s clock differs, calculate an offset: video_start_time − gpx_starttime.
- Many gpx2srt implementations accept a time-offset flag (e.g., –offset +00:00:05 to shift GPX forward 5s). Apply the offset so subtitle times match video frames.
- &]:pl-6” data-streamdown=“ordered-list” start=“5”>
- Run gpx2srt with desired options
- Example command patterns (adjust to your tool’s flags):
- Basic conversion:
gpx2srt input.gpx -o output.srt - Include speed and distance (flags vary by implementation):
gpx2srt input.gpx -o output.srt –fields speed,distance –interval 1 - Apply time offset:
gpx2srt input.gpx -o output.srt –offset +00:00:05
- Basic conversion:
- Use an interval or sampling rate to avoid excessive subtitle count (e.g., every 1–5 seconds).
- Review and edit the SRT
- Open output.srt in a text editor or subtitle tool. Each entry has an index, start/end times, and text.
- Trim or reformat lines for readability, shorten long coordinates, or convert decimals to degrees/minutes if preferred.
- Load subtitles into your video editor/player
- Import the SRT alongside your video; adjust subtitle styling (font, size, position) in the editor.
- Verify timing across different playback rates; adjust offset if needed.
Tips for better results
- Use a consistent sampling interval (1–5s) to balance readability and precision.
- Convert speed to the viewer’s preferred unit (km/h or mph) before exporting.
- Round coordinates to a sensible precision (3–5 decimal places) to avoid clutter.
- If showing distance, start cumulative distance at zero or show lap splits for races.
- For live overlays, consider embedding the SRT or burning text into video during export.
Troubleshooting
- No timestamps in GPX: the tool cannot align subtitles—use other sources to timestamp or sync manually.
- Subtitle times off: re-calculate offset and re-run conversion.
- Too many subtitles: increase interval or filter points by distance delta.
Example short SRT entry
1
00:00:05,000 –> 00:00:07,000
Speed: 12.3 km/h — 12.3456°N, 98.7654°W
Final note
gpx2srt turns raw GPS tracks into readable, time-aligned subtitles for video and analysis; with correct timestamp alignment and sensible sampling, it’s a fast way to add movement data to footage.
Leave a Reply