Skip to content
ObaShionPublic

About

Turn DJI Osmo 360 .OSV files into 360° video on your GPU (CUDA / Metal / CPU), from the command line.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

osv2pano

Turn DJI Osmo 360 .OSV files into 360° video on your GPU, from the command line.

build License: MIT C++17 Platforms Backends

DJI Studio (top) and osv2pano (bottom) exporting the same clip
The same clip exported by DJI Studio (top) and osv2pano (bottom). Watch the video (9 s, no audio).

osv2pano footage/ -o pano/

Every .OSV in the folder becomes a 6K equirectangular MP4 that closely matches DJI Studio's export. No GUI, no clicking through clips one by one.

Highlights

  • Fast. 6K at 60 fps converts in about real time on an RTX 5070. On NVIDIA the frames never leave the GPU (NVDEC → CUDA → NVENC).
  • Matches DJI Studio closely. It uses the factory lens calibration stored in the file, plus a rim profile measured against DJI Studio for the outer part of the lens, where the calibration formula is no longer valid. Horizon leveling and the locked heading follow the same rules as DJI Studio.
  • Clean seams. Brightness and colour are matched between the two lenses on every frame, then blended across a 6° seam.
  • Built for batches. Give it files or folders. Finished outputs are skipped, and an interrupted run never leaves a half-written file behind.
  • Runs everywhere. CUDA on NVIDIA, Metal on Apple Silicon and a multithreaded CPU fallback elsewhere, all from the same kernel source.
  • Ready to publish. Output is H.265 10-bit with the original audio (not re-encoded) and 360° metadata, so YouTube and 360° players recognise it.

Quick start

With an NVIDIA GPU on Linux (or WSL2) and the NVIDIA Container Toolkit, there is nothing else to install:

git clone https://github.com/ObaShion/osv2pano.git && cd osv2pano
docker build -t osv2pano -f docker/Dockerfile .
docker run --rm --gpus all -v "$PWD:/data" osv2pano footage -o pano

Run the last command from the folder that contains your footage/; the outputs go to pano/ next to it.

To build from source instead, see Installation.

Usage

# convert every .OSV in a folder (outputs that already exist are skipped)
osv2pano footage/ -o pano/

# preview: write a single JPEG from the 5 s mark
osv2pano CAM_0001.OSV --still 5 -o check/

# lighter files: 30 fps, 3840×1920, 10 s starting at 4 s
osv2pano CAM_0001.OSV --fps 30 --width 3840 --start 4 --duration 10 -o out/

Outputs are named <input>_pano.mp4. If you built from source and did not install, the binary is build/osv2pano (build\Release\osv2pano.exe on Windows).

All options
Option Default Description
-o DIR next to input output folder
-r search folders recursively
--overwrite re-create existing outputs
--width N 2× fisheye height (6000) output width; height is half of it
--fps F source (59.94) output frame rate (frames are dropped, not interpolated)
--start S / --duration S trim [s]
--still S write a single JPEG at S seconds instead of a video
--bitrate R 170M video bitrate (about DJI Studio's "recommended")
--quality Q constant quality instead of a bitrate (NVENC CQ / x265 CRF; lower is better)
--level MODE lock lock: level + world-locked heading (like DJI Studio) · horizon: level only · smooth: level + smoothed heading · none
--smooth S 1.0 smoothing time for --level smooth [s]
--yaw / --pitch / --roll 180 / 0 / 0 view orientation [deg]; yaw 180 is DJI Studio's front
--blend D 6 seam blend width [deg]
--seam MODE match match: match brightness and colour of both lenses · none: plain blend
--device D auto cuda, cuda:1, metal or cpu
--encoder E / --hwdec H auto force an encoder / hardware decoder (--hwdec none for software decoding)
--suffix S _pano output file name suffix
--calib-set N 0 which calibration set in the metadata to use
--no-spherical-tag don't write 360° metadata

Installation

You need CMake ≥ 3.20, a C++17 compiler and the FFmpeg ≥ 6 development libraries (libavformat, libavcodec, libavutil, libswscale). The CUDA backend is built when the CUDA Toolkit (≥ 11.8) is found, and the Metal backend is always built on macOS.

Linux (Ubuntu 24.04+ / Debian 13+)
sudo apt install build-essential cmake ninja-build pkg-config \
    libavformat-dev libavcodec-dev libavutil-dev libswscale-dev nvidia-cuda-toolkit
cmake -S . -B build -G Ninja
cmake --build build
sudo cmake --install build   # optional: installs to /usr/local/bin

Older releases ship FFmpeg 4.x; use the Docker image there. Without nvidia-cuda-toolkit you get the CPU backend only. NVDEC and NVENC come from the NVIDIA driver at run time.

macOS (Apple Silicon)
brew install cmake ninja pkg-config ffmpeg
cmake -S . -B build -G Ninja
cmake --build build
Windows
  1. Install Visual Studio 2022 (C++ workload), CMake, and optionally the CUDA Toolkit.
  2. Download an FFmpeg shared build with headers, e.g. ffmpeg-n8.1-latest-win64-gpl-shared-8.1.zip from BtbN/FFmpeg-Builds, and unpack it to C:\ffmpeg.
  3. Build:
    cmake -S . -B build -DFFMPEG_ROOT=C:/ffmpeg
    cmake --build build --config Release
  4. Put C:\ffmpeg\bin on PATH, or copy its DLLs next to build\Release\osv2pano.exe.

Performance

Converting 10 s of 6000×3000 59.94 fps footage to H.265 10-bit at 170 Mbps (RTX 5070, Core Ultra 7 265, Linux on WSL2):

Setting fps × real time
6000×3000 59.94p, default (NVDEC → CUDA → NVENC) 58.7 0.98
6000×3000 29.97p 53.1 1.77
3840×1920 59.94p 131.1 2.19
3840×1920 29.97p 102.4 3.42
software decoding (--hwdec none) 26.5 0.44
CPU backend (--device cpu) 5.4 0.09
libx265 instead of NVENC 3.4 0.06

At the default settings NVENC encoding of 6K is the bottleneck. Seam matching and leveling add no measurable cost. A --still JPEG takes about 2.5 s. Run tools/benchmark.sh build/osv2pano CLIP.OSV to measure your own machine.

Accuracy vs DJI Studio

These numbers come from frame-by-frame comparisons with DJI Studio's panorama export, with horizon leveling on:

Result
Horizon tilt differs by ~0.25° per frame on average (rolling shutter is not corrected)
Heading locked to the world like DJI; the initial-heading rule agrees within 0.7° on all 7 test clips
Lens rim the measured profile fits DJI within ~1.3 px RMS from 59° to 94° off-axis
Seam the brightness step across the seam is the same size as in DJI's export
Brightness ~1% darker than DJI overall, uniform from centre to rim

Objects closer than about 50 cm can misalign slightly at the seam, because the two lenses see them from different positions (parallax). DJI Studio has the same limitation.

Platform support

Platform Backend Status
Linux / WSL2 CUDA + NVDEC / NVENC ✅ tested on real footage
Linux CPU, libx265 ✅ tested on real footage
macOS (Apple Silicon) Metal + VideoToolbox 🟡 CI only. Metal output matches the CPU backend in tests
Windows CPU 🟡 CI only
Windows CUDA ⚪ untested

Tested so far with Osmo 360 footage only. Reports from macOS and Windows users are welcome: please use the Platform report issue template.

How it works

OSV ─┬─ fisheye 1 (HEVC 10-bit) ─ decode ─┐
     ├─ fisheye 2 (HEVC 10-bit) ─ decode ─┼─▶ GPU: fisheye → equirect, seam match + blend ─▶ encode ─▶ MP4
     ├─ audio (AAC) ──────────────────────┼──────────────────────────────────── copied as is ──┘
     └─ djmd metadata ─▶ lens calibration + per-frame attitude (gyro)
  • Each output pixel computes its view direction, both lens models, the seam weight and the colour correction directly, so per-frame leveling is free: it only changes the rotation passed to the kernel.
  • It works in 10-bit YUV throughout, with luma at full resolution and chroma at half, so there is no RGB round trip.
  • Seam correction is measured every frame in a strip along the seam (720 × 61 samples), then smoothed along the seam and over time.
  • Decoding (one thread per lens), stitching and encoding run in parallel.

The metadata format, as far as it has been reverse-engineered, is documented in docs/osv-format.md.

The source layout is described in CONTRIBUTING.md.

Roadmap

  • Prebuilt binaries for Windows and macOS
  • Rolling-shutter correction (the file has ~1 kHz attitude samples for it)
  • Verified CUDA build on native Windows
  • Other cameras that use the OSV format

Contributing

Found a problem? Open an issue. Bug reports, platform reports and pull requests are welcome; please read CONTRIBUTING.md first. The unit tests don't need any footage:

ctest --test-dir build --output-on-failure

License

MIT. FFmpeg is used under its own license (LGPL or GPL, depending on the build you link against).

osv2pano is an unofficial tool and is not affiliated with or endorsed by DJI. "DJI" and "Osmo" are trademarks of SZ DJI Technology Co., Ltd. The OSV metadata layout was inferred from real files and may change with future firmware.

About

Turn DJI Osmo 360 .OSV files into 360° video on your GPU (CUDA / Metal / CPU), from the command line.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages