Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

将 Columbus 系列 GPS 记录仪导出的 CSV 轨迹转换成视频。
流程为:计算视窗 -> 渲染底图 -> 生成轨迹视频。

依赖
- Python 3(建议使用 venv)
- Node.js(用于 MapLibre 渲染)
- ffmpeg(视频合成)

依赖安装示例
1) Python 依赖
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install pillow

2) Node.js 依赖
npm install

3) ffmpeg
macOS: brew install ffmpeg
Ubuntu: sudo apt-get install ffmpeg

准备数据与地图
1) 下载 OSM 数据
https://download.geofabrik.de/asia/china.html
获取 china-latest.osm.pbf

2) 生成 MBTiles
https://github.com/systemed/tilemaker
将 pbf 转换为 mbtiles(tiles.mbtiles)

3) 生成样式与字体
https://github.com/openmaptiles/openmaptiles
生成 style、glyphs、sprite 资源

目录建议
- input/  放置原始 CSV
- output/ 放置中间文件与视频输出

使用
1) 计算视窗与边界(依据轨迹生成渲染视窗)
.venv/bin/python src/compute_view.py \
 --csv "input/15094400.CSV" \
 --width 1920 \
 --height 1080 \
 --padding 0.08 \
 --view-out "output/view.json" \
 --bounds-out "output/bounds.json"

2) 渲染底图(MapLibre 本地渲染)
node src/render_map.js \
 --style "/Users/steve/Downloads/maps/openmaptiles/build/style/style.json" \
 --mbtiles "/Users/steve/Downloads/maps/openmaptiles/data/tiles.mbtiles" \
 --glyphs "/Users/steve/Downloads/maps/openmaptiles/data/fonts" \
 --sprite "/Users/steve/Downloads/maps/openmaptiles/build/style/sprite" \
 --out "output/map.png" \
 --width 1920 \
 --height 1080 \
 --buffer-scale 2 \
 --view-in "output/view.json" \
 --render-bounds-out "output/render_bounds.json"

3) 生成视频(叠加轨迹并导出 mp4)
.venv/bin/python src/track_video.py \
 --csv "input/15094400.CSV" \
 --map "output/map.png" \
 --bounds "output/render_bounds.json" \
 --out "output/out.mp4" \
 --width 1920 \
 --height 1080 \
 --fps 60 \
 --min-distance 0 \
 --mode fixed-step \
 --speed 150 \
 --step 10 \
 --follow

输出
- output/map.png        渲染底图
- output/render_bounds.json  渲染范围
- output/out.mp4        最终视频

About

将 Columbus 系列 GPS 记录仪导出的 CSV 轨迹转换成视频

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages