> Agents can also search and read this documentation through its [MCP server](https://docs.gyroflow.xyz/app/~gitbook/mcp).

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
This site has an agentic ask interface you may use to query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gyroflow.xyz/app/index.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

---

# Welcome to Gyroflow

Gyroflow is an advanced video stabilization tool, which uses gyro data for accurate motion compensation. It's blazingly fast, easy-to-use and available for all platforms. It's free and open-source.

<figure><img src="https://raw.githubusercontent.com/gyroflow/gyroflow/master/resources/screenshot.jpg" alt=""><figcaption></figcaption></figure>

## What is Gyroflow?

In order to achieve smooth, cinematic footage, video stabilization is often essential. For cinema cameras, this is often achieved using motorized gimbals or other bulky camera stabilizers. Phone cameras and compact action cameras on the other hand use Electronic Image Stabilization (EIS) applied in real-time based on gyro sensor data. Finally, video editing packages can often stabilize video based on estimated camera motion, which may be unreliable.

This is where Gyroflow comes into play. Gyroflow is a post-processing video stabilization software based on logged motion data. With the help of precise lens calibrations, rolling shutter correction, and tweakable stabilization algorithms (including horizon levelling), Gyroflow can produce gimbal-like stabilization with no or minimal weight penalty. It also works regardless of lighting conditions or moving subjects. This is especially suited for aerial videography, where the beta version has been extensively evaluated for large and small productions alike. With many cameras from GoPro, Sony, insta360 etc. supporting built-in motion data recording, additional hardware might not even be required. You can even use a GoPro as a logger for a cinema camera.

Gyroflow is cross-platform and uses hardware acceleration for blazingly fast processing combined with a modern multilingual user interface.

{% embed url="<https://www.youtube.com/watch?v=QR-SINyvNyI>" %}

## Examples

![](https://github.com/gyroflow/gyroflow/raw/master/resources/comparison1.gif) ![](https://github.com/gyroflow/gyroflow/raw/master/resources/comparison2.gif)

{% content-ref url="/pages/fbUgqWssOJ1pygRVkJvP" %}
[Examples](https://docs.gyroflow.xyz/app/readme/examples)
{% endcontent-ref %}

## Quick links

{% content-ref url="/pages/0Rfl1C7xYWDXB7o9lh7r" %}
[Features](https://docs.gyroflow.xyz/app/readme/features)
{% endcontent-ref %}

{% content-ref url="/pages/ydEKvBRkMlPkdCx4Ec98" %}
[Supported Cameras](https://docs.gyroflow.xyz/app/getting-started/supported-cameras)
{% endcontent-ref %}

{% content-ref url="/pages/74YF13qSeeG2rtySe5yO" %}
[Basic Usage](https://docs.gyroflow.xyz/app/getting-started/basic-usage)
{% endcontent-ref %}


# Features

* Real-time preview, parameter adjustments and all calculations
* GPU processing and rendering, all algorithms fully multi-threaded
* Rolling shutter correction
* [Optical correction](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction): measures the camera motion from the video itself, so footage without motion data can be stabilized, and bad gyro data (like vibrations on hard-mounted FPV cameras) can be corrected
* [Video editor plugins](https://github.com/gyroflow/gyroflow-plugins) (Adobe Premiere/Ae, DaVinci Resolve, Final Cut Pro, Shotcut and more), allowing you to apply stabilization directly in a video editor without transcoding
* Supports full Sony metadata (recording params, automatic lens, support for IBIS, OIS, EIS, Active and Dynamic Active, lens breathing compensation - you can have IBIS enabled in camera and still apply Gyroflow on top)
* Supports already stabilized GoPro videos (captured with Hypersmooth enabled) (Hero 8 and up)
* Uses the lens calibration recorded in GoPro HERO11 and newer videos, including SuperView and HyperView
* Follows the recorded focal length of zoom lenses, with optional focal length stabilization that smooths out fast zooms
* Supports and renders 10-bit videos (up to 16-bit 4:4:4:4 for regular codecs and 32-bit float for OpenEXR - working directly on YUV data to maintain maximum quality)
* Customizable lens correction strength
* Render queue
* Keyframes
* Ability to create custom settings presets
* Visual chart with gyro data (displays gyro, accelerometer, magnetometer, and quaternions, including smoothed quaternions)
* Supports underwater footage (corrects underwater distortions)
* Modern responsive user interface with Dark and Light theme
* Adaptive zoom (dynamic cropping)
* Zoom limit, or a fixed zoom level for every video
* Rectilinear or fisheye output projections (stereographic, equidistant, equisolid angle, orthographic), to show the whole picture of very wide lenses
* Supports image sequences (PNG, OpenEXR, CinemaDNG)
* Based on [telemetry-parser](https://github.com/AdrianEddy/telemetry-parser) - supports all gyro sources out of the box
* Gyro low pass filter, arbitrary rotation (pitch, roll, yaw angles) and orientation
* Multiple gyro integration methods for orientation determination
* Multiple video orientation smoothing algorithms, including horizon levelling (with pitch locking and automatic leaning into turns) and per-axis smoothness adjustment.
* Cross-platform - works on Windows/Linux/Mac/Android/iOS
* Multiple UI languages
* Supports variable and high frame rate videos - all calculations are done on timestamps
* H.264/AVC, H.265/HEVC, AV1, ProRes, DNxHD, CineForm, PNG and OpenEXR outputs, with H.264, H.265 and AV1 fully GPU accelerated (ProRes also accelerated on Apple Silicon)
* Easy lens calibration process, with the OpenCV fisheye, OpenCV standard and generic polynomial models, and a calibration method for lenses that see more than 180°
* Fully zero-copy GPU preview rendering
* Core engine is a separate library without external dependencies (no Qt, no ffmpeg, no OpenCV), which is also used by the video editor plugins
* Automatic updates of lens profile database
* Built-in official lens profiles for GoPro HERO 5-13; Sony; DJI; Insta360 action cameras; RunCam: Thumb series, 5 Orange
* Easy management of the video editor plugins from within the app
* Ability to add an additional 3D rotation (useful for framing vertical videos)

### Supported gyro sources

* [x] GoPro (HERO 5 and later, including .LRV proxy files)
* [x] Sony (most newer models, see the [list](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/sony#supported-models))
* [x] Insta360 (OneR, OneRS, SMO 4k, Go, GO 2, GO 3, GO 3S, GO Ultra, Caddx Peanut, Ace, Ace Pro, including .lrv proxy files; motion data only: X5, Antigravity A1)
* [x] DJI (Avata, Avata 2, O3/O4 Air Unit, Action 2/4/5/6/Nano, Neo, Neo2; motion data only: Osmo 360, Avata 360)
* [x] Xtra (Edge, Edge Pro)
* [x] Blackmagic RAW (\*.braw)
* [x] RED RAW (V-Raptor, KOMODO) (\*.r3d)
* [x] Canon (C50, C80, C400, R6 Mk3, R5 Mk2, R6 V) (\*.mp4, \*.mov, \*.mxf, Cinema RAW Light \*.crm)
* [x] Z CAM (E2-M4 Mk2, E2-S6 Mk2, E2-F6 Mk2, E2-F8 Mk2, E2-M4G Mk2, E2-S6G Mk2, E2N Mk2) (\*.mp4, \*.mov; motion data only: ZRAW \*.zraw)
* [x] HOVERAir
* [x] Freefly (Ember)
* [x] Betaflight blackbox (\*.bfl, \*.bbl, \*.csv)
* [x] ArduPilot logs (\*.bin, \*.log)
* [x] Gyroflow [.gcsv log](https://docs.gyroflow.xyz/app/technical-details/gcsv-format)
* [x] [Gyroflow Protobuf](https://docs.gyroflow.xyz/app/technical-details/gyroflow-protobuf) (embedded in \*.mp4, \*.mov, or a \*.jsonl sidecar file)
* [x] iOS apps: [`Sensor Logger`](https://apps.apple.com/us/app/sensor-logger/id1531582925), [`G-Field Recorder`](https://apps.apple.com/at/app/g-field-recorder/id1154585693), [`Gyro`](https://apps.apple.com/us/app/gyro-record-device-motion-data/id1161532981)
* [x] Android apps: [`Sensor Logger`](https://play.google.com/store/apps/details?id=com.kelvin.sensorapp\&hl=de_AT\&gl=US), [`Sensor Record`](https://play.google.com/store/apps/details?id=de.martingolpashin.sensor_record), [`OpenCamera Sensors`](https://github.com/MobileRoboticsSkoltech/OpenCamera-Sensors), [`MotionCam Pro`](https://play.google.com/store/apps/details?id=com.motioncam.pro) (including its RAW video \*.mcraw, motion data only)
* [x] Runcam CSV (Runcam 5 Orange, iFlight GOCam GR, Runcam Thumb, Mobius Maxi 4K)
* [x] Hawkeye Firefly X Lite CSV
* [x] XTU (S2Pro, S3Pro)
* [x] WitMotion (WT901SDCL binary and \*.txt)
* [x] Vuze (VuzeXR)
* [x] KanDao (Obsidian Pro, Qoocam EGO)
* [x] [ESP-gyrologger](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/esp-gyrologger)
* [x] [NiYien SenseFlow A1](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/niyien-a1)
* [x] [CAMM format](https://developers.google.com/streetview/publish/camm-spec)


# Examples

{% embed url="<https://gyroflow.xyz/demo/?v=1>" %}
GoPro Hero 6
{% endembed %}

{% embed url="<https://gyroflow.xyz/demo/?demo=1&v=2>" %}
GoPro Hero 5 Session
{% endembed %}

{% embed url="<https://gyroflow.xyz/demo/?demo=2>" %}
GoPro Hero 8
{% endembed %}

{% embed url="<https://gyroflow.xyz/demo/?demo=3>" %}
GoPro Hero 8
{% endembed %}

{% embed url="<https://gyroflow.xyz/demo/?demo=4>" %}
GoPro Hero 10 + Horizon Lock
{% endembed %}

{% embed url="<https://gyroflow.xyz/demo/?demo=5>" %}
Blackmagic Pocket Cinema Camera 4k + Laowa 9mm
{% endembed %}


# Test Files

If you want to try Gyroflow, but you don't have any supported camera yet, here are some sample files with gyro data you can download and try for yourself.

{% embed url="<https://drive.google.com/drive/u/1/folders/1sbZiLN5-sv_sGul1E_DUOluB5OMHfySh>" %}

Google Drive link: <https://drive.google.com/drive/u/1/folders/1sbZiLN5-sv_sGul1E_DUOluB5OMHfySh>


# Installation

Gyroflow is officially available in Microsoft Store, Apple Store and Google Play store. Downloadable binaries are available as well.

{% tabs %}
{% tab title="Windows" %}

## Install from the Microsoft Store:

[![](https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FceDhtNVg4tP0nWnVTe9U%2Fbadge_microsoft_store.png?alt=media\&token=95557b6f-516f-422b-8261-ff5a50decee0)](https://apps.microsoft.com/store/detail/gyroflow/9NZG7T0JCG9H)

## Manual install:

1. Download the latest version from <https://gyroflow.xyz/download>
2. Extract `Gyroflow-windows64.zip` (or `Gyroflow-windows-arm64.zip` on Windows on ARM) somewhere
3. Open the extracted folder and run `Gyroflow.exe`
4. If it shows an error about `VCRUNTIME140.dll`, [install VC redist](https://aka.ms/vs/17/release/vc_redist.x64.exe)

## Minimum system requirements

Windows 10 64-bit (1809 or later)

* If you have Windows "N" install, go to `Settings` -> `Apps` -> `Optional features` -> `Add a feature` -> enable `Media Feature Pack`

{% hint style="info" %}
Windows 7 is not supported, because of Qt 6 requirements
{% endhint %}
{% endtab %}

{% tab title="macOS" %}

## Install from the App Store:

[![](https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FMNVnVzjJCqtuZYWs2Awv%2Fbadge_apple_store.png?alt=media\&token=a9160486-ea9a-4564-88d3-313dabef3f17)](https://apps.apple.com/us/app/gyroflow/id6447994244)

## Beta channel:

Updates are pushed more often to TestFlight. Use this link to join as tester and get most recent updates first: <https://testflight.apple.com/join/e0RI1n5i>

## Manual install:

1. Download the latest version from <https://gyroflow.xyz/download>
2. Run`Gyroflow-mac-universal.dmg`
3. Drag & drop `Gyroflow` app to the Applications folder (or anywhere you want, like on Desktop)

{% hint style="info" %}
You can also install using brew: **`brew install gyroflow`**.

To upgrade Gyroflow, run **`brew update`** then **`brew upgrade gyroflow`**
{% endhint %}

## Minimum system requirements

* macOS 10.15 or later

{% hint style="info" %}
Both Intel and Apple Silicon are supported natively.
{% endhint %}

### Hardware acceleration support:

<table><thead><tr><th width="287">Processor</th><th width="85">H.264</th><th width="91">H.265</th><th>ProRes</th></tr></thead><tbody><tr><td>Intel</td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td>M1</td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td>M1 Pro/Max/Ultra</td><td>✅</td><td>✅</td><td>✅</td></tr><tr><td>M2 and newer</td><td>✅</td><td>✅</td><td>✅</td></tr></tbody></table>
{% endtab %}

{% tab title="Linux" %}

## Installing Gyroflow

1. Make sure you have latest GPU drivers installed
2. Download `Gyroflow-linux64.tar.gz` from <https://gyroflow.xyz/download>
3. Extract the files somewhere and run `./Gyroflow` in the terminal.
4. If it doesn't work, you probably need to install additional dependencies:

`sudo apt install libc++-dev libva2 libvdpau1 libasound2 libxkbcommon0 libpulse0 libvulkan1`

GPU specific packages:

* NVIDIA: `nvidia-opencl-icd nvidia-vaapi-driver nvidia-vdpau-driver nvidia-egl-icd nvidia-vulkan-icd libnvcuvid1 libnvidia-encode1`
* Intel: `intel-media-va-driver i965-va-driver beignet-opencl-icd intel-opencl-icd`
* AMD: `mesa-vdpau-drivers mesa-va-drivers mesa-opencl-icd libegl-mesa0 mesa-vulkan-drivers`

{% hint style="info" %}
`.AppImage`is also available, but it's recommended to run the `.tar.gz` package
{% endhint %}

## Install with Flatpak

Gyroflow is also available as a Flatpak from [FlatPark](https://flatpark.org/apps/xyz.gyroflow.Gyroflow). It installs the official `Gyroflow-linux64.tar.gz` unmodified, and FlatPark updates it for each new Gyroflow release, so `flatpak update` keeps it up to date. It runs on any distro with Flatpak, and you don't need to install the packages listed above.

```
flatpak remote-add --if-not-exists flatpark https://dl.flatpark.org/flatpark.flatpakrepo
flatpak install flatpark xyz.gyroflow.Gyroflow
```

* The Flatpak has access to your `Videos` folder and to removable drives (`/run/media` and `/media`). Gyroflow saves the render next to the source clip by default, so if your footage is stored anywhere else, give it access to your home folder with `flatpak override --user --filesystem=home xyz.gyroflow.Gyroflow`
* Settings and your own lens profiles are stored in `~/.var/app/xyz.gyroflow.Gyroflow`
* OpenCL isn't available inside the Flatpak, so GPU processing uses Vulkan
* Video editor plugins aren't part of the Flatpak. Install them as described in [Video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow)

{% hint style="info" %}
The Flatpak package is maintained by FlatPark, not by the Gyroflow team. Report problems with the package itself at [github.com/flatpark/flatpark](https://github.com/flatpark/flatpark/issues).
{% endhint %}

## Minimum system requirements

* Debian 10+
* Ubuntu 18.10+
* CentOS 8.2+
* openSUSE 15.3+

{% hint style="info" %}
Other distros require glibc 2.28+ (**`ldd --version`** to check)
{% endhint %}
{% endtab %}

{% tab title="Android" %}

## Install from the Google Play Store:

[<img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FDelQCteFrnjbCjjpovP8%2Fbadge_google_play.png?alt=media&amp;token=4e31665e-efdd-4d08-82d9-baf80d890389" alt="" data-size="original">](https://play.google.com/store/apps/details?id=xyz.gyroflow)

## Manual install:

Nightly .apk can be downloaded from <https://nightly.link/gyroflow/gyroflow/workflows/release/master/Gyroflow-android.zip>

## Minimum system requirements

* Android 8
  {% endtab %}

{% tab title="iOS" %}

## Install from the App Store:

[![](https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FMNVnVzjJCqtuZYWs2Awv%2Fbadge_apple_store.png?alt=media\&token=a9160486-ea9a-4564-88d3-313dabef3f17)](https://apps.apple.com/us/app/gyroflow/id6447994244)

## Beta channel:

Updates are pushed more often to TestFlight. Use this link to join as tester and get most recent updates first: <https://testflight.apple.com/join/e0RI1n5i>

## Manual install:

Installing from outside of Apple Store is possible only on jailbroken devices or if you have a developer account and know how to re-sign an .ipa. Nightly .ipa can be downloaded from <https://nightly.link/gyroflow/gyroflow/workflows/release/master/Gyroflow-ios.zip>

## Minimum system requirements

* iOS 14
  {% endtab %}
  {% endtabs %}

## Latest development build

Development moves fast and there are new features added very often, check them out by downloading the nightly build

You can always download the latest build from <https://gyroflow.xyz/devbuild/>

The list of all nightly builds is available on [GitHub actions](https://github.com/gyroflow/gyroflow/actions)


# Supported Cameras

Gyroflow supports wide variety of cameras. You can find links to detailed camera guides here

<table data-column-title-hidden data-view="cards"><thead><tr><th data-card-target data-type="content-ref"></th><th data-hidden></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/gopro">GoPro</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FzsAoouJeMHSy2GCdw2rw%2Fgopro-logo-transparent.png?alt=media&amp;token=dd357bb3-0c25-49cc-ba5e-74ae3dc1bfa0">gopro-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/dji">DJI</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fe5ur5FNZtIe4AsIgVNHe%2Fdji-logo-transparent.png?alt=media&amp;token=bd954a65-4ad4-4371-b621-271828febf1f">dji-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/sony">Sony</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FHyPXtTGmAHGa5DNFUys7%2Fsony-logo-transparent.png?alt=media&amp;token=273ecd79-70f5-48f4-bd87-fa342747204f">sony-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/insta360">Insta360</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FPT5iBwmzllGugDH03lhS%2Finsta360-logo.png?alt=media&amp;token=2e315e32-a3c4-4bad-beda-a58e1a2b18b4">insta360-logo.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/blackmagic">Blackmagic</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fb7lbbNMQR0DmcgMyjEZu%2Fblackmagic-logo.png?alt=media&amp;token=15e28859-336e-41b0-a79b-8d65c439c164">blackmagic-logo.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/red">RED</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FlK7OPbryMIJHW2LKT6VQ%2Fred-logo-transparent.png?alt=media&amp;token=02e01240-0435-43e1-820f-efeb6f26363a">red-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/zcam">Z CAM</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fgit-blob-4483d122544d6c8f3a8ee5bcdf844a9acc24bf2e%2Fzcam-logo-transparent.png?alt=media">zcam-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/canon">Canon</a></td><td></td><td></td><td></td><td><a href="https://1000logos.net/wp-content/uploads/2016/10/Canon-Logo-1024x640.png">https://1000logos.net/wp-content/uploads/2016/10/Canon-Logo-1024x640.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/dji-1">Xtra</a></td><td></td><td></td><td></td><td data-object-fit="contain"><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FcwUeXCtiVPQ3dXIpo0ej%2Fxtra.svg?alt=media&amp;token=f1817298-95d7-4677-bb41-b4a3c343eb8d">xtra.svg</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/flight-controllers">Flight controllers</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FI7Pa24yO7e2xnVd9ssS0%2Fbf-arudpilot-logo-transparent.png?alt=media&amp;token=fe065fbf-5e7e-4d79-8393-882f3d604597">bf-arudpilot-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/runcam">RunCam</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FDydxokoMJPIf8pcKIAfi%2Fruncam-logo-transparent.png?alt=media&amp;token=c6f07e57-b2f7-49a2-a008-ec45a376b9ae">runcam-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/caddx">Caddx</a></td><td></td><td></td><td></td><td><a href="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FTyoDOvcuF0owsbYc8ySc%2Fcaddx-logo-transparent.png?alt=media&amp;token=fd5d6cb0-4d65-404b-af0e-1e5c8fa5b437">caddx-logo-transparent.png</a></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/hawkeye">Hawkeye</a></td><td></td><td></td><td></td><td></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/nikon">Nikon</a></td><td></td><td></td><td></td><td></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/mobile-phones">Mobile Phones</a></td><td></td><td></td><td></td><td></td></tr><tr><td><a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/other">Other Cameras</a></td><td></td><td></td><td></td><td></td></tr></tbody></table>

{% hint style="info" %}
**What about Nikon, Panasonic, Fujifilm, Pentax, etc.?**\
Gyroflow supports all cameras that record gyroscope data. Consumer cameras such as those from Nikon, Panasonic, Fujifilm, Pentax, etc. don't record gyro data internally, and therefore cannot be used with Gyroflow on their own.\
\
Gyroflow requires the camera to have a hardware gyroscope and to record it together with the video file - so there's nothing we can do on the software side, if the camera didn't provide the gyro data. This is not something Gyroflow developers can fix.

You can try to reach the camera manufacturer and express interest in adding gyro data. If they see enough interest, they may add that functionality to the camera.\
\
However, it is possible to use an external gyro source with cameras that don't record gyro data internally. You can learn more [here](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source). Since Gyroflow 1.7.0, you can also measure the camera motion from the video itself, with [Optical correction](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).
{% endhint %}


# GoPro

GoPro cameras are supported in Gyroflow and are proven to deliver great video and stabilization quality.

## Supported models

<table><thead><tr><th width="167">Model</th><th width="117">Gyro data</th><th width="126">Lens profile</th><th width="159">Synchronization</th><th>Remarks</th></tr></thead><tbody><tr><td>Hero 4 or older</td><td>❌</td><td>❌</td><td>❌</td><td></td></tr><tr><td>Hero 5 Black<br>Hero 5 Session</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>❌ <a data-footnote-ref href="#user-content-fn-1">Bad on FPV drone</a><br><a data-footnote-ref href="#user-content-fn-2">🚧 Superview</a></td></tr><tr><td>Hero 6 Black</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td><a href="http://everythingfpv.com/how-to-downgrade-your-gopro-hero6-to-1-6/">Firmware v1.6</a><a data-footnote-ref href="#user-content-fn-3"> recommended.</a><br><a data-footnote-ref href="#user-content-fn-2">🚧 Superview</a></td></tr><tr><td>Hero 7 White<br>Hero 7 Silver</td><td>❌</td><td>❌</td><td>❌</td><td></td></tr><tr><td>Hero 7 Black</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>❌ <a data-footnote-ref href="#user-content-fn-1">Bad on FPV drone</a><br><a data-footnote-ref href="#user-content-fn-4">❌ Hypersmooth<br></a><a data-footnote-ref href="#user-content-fn-2">🚧 Superview</a></td></tr><tr><td>Hero 8 Black<br>Hero 9 Black<br>Hero 10 Black</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td><a data-footnote-ref href="#user-content-fn-5">✅ Hypersmooth<br></a><a data-footnote-ref href="#user-content-fn-2">🚧 Superview</a></td></tr><tr><td>Hero 11 Black<br>Hero 11 Mini<br>Hero 12 Black<br>Hero 13 Black</td><td>✅</td><td>✅ <a data-footnote-ref href="#user-content-fn-6">From the file</a></td><td>✅ Not needed</td><td><p><a data-footnote-ref href="#user-content-fn-5">✅ Hypersmooth</a></p><p>✅ Autoboost<br>✅ Superview<br>✅ Hyperview</p></td></tr></tbody></table>

## Sensor and aspect ratio

All GoPros until 11 use a 4:3 sensor, and Hero 11 uses 8:7 sensor. For Gyroflow stabilization, it's best to capture full sensor information, thus 4:3 or 8:7. However, these modes have less frame rate options than 16:9 resolutions, so if you want to shoot at maximum fps, it's better to choose 16:9 mode. Otherwise choose 4:3 or 8:7.

Gyroflow will output 16:9 aspect ratio by default after stabilization. This can be changed to anything you like in Export settings.

## Lens and field of view

All lens modes are supported, but it's best to choose `Wide`.

Superview and Hyperview modes capture full sensor information (4:3 and 8:7 respectively) and digitally stretch that video to 16:9 in camera, in a non-linear way (center is less stretched and sides are more stretched).

Since Gyroflow 1.7.0, Hero 11 and newer models use the lens calibration that GoPro records in every video, including the Superview and Hyperview stretch, so these modes are stabilized accurately and no lens profile has to be selected.

On older models, these modes use a proprietary stretching equation which is not exactly mapped in Gyroflow, so stabilization will not be as accurate in these modes and they're not recommended.

## Proxy files (.LRV)

Since Gyroflow 1.7.0, you can also open the low-resolution **.LRV** proxy files that GoPro records next to the video.

## Split recording

By default, GoPro files are limited to 4 GB in size. This can be increased by using [GoPro Labs](https://gopro.github.io/labs/) firmware and enabling the [Large chapters](https://gopro.github.io/labs/control/chapters/) feature.

If you already have your recording split at 4 GB file size limit, you can merge them losslessly in Gyroflow. If you open the first file, Gyroflow should detect the sequence automatically and ask you to merge. Otherwise you can just drag & drop all your files in the sequence to Gyroflow to merge.

You can find more information on the [**🎞 File joiner**](https://docs.gyroflow.xyz/app/getting-started/file-joiner) page.

## In-camera stabilization

Since Hero 8, in-camera stabilization (Hypersmooth) can be enabled and is supported in Gyroflow.\
All previous models need to have all internal stabilization (EIS) disabled during recording.

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).

## Hero 5 Black, Hero 5 Session, Hero 7 on an FPV drone

For drone footage, the gyro data from the Hero 5 and 7 is unusable, due to bad noise filtering and aliasing. For this reason, Hero 5 Session, Hero 5 Black and Hero 7 **are not recommended** for cinematic FPV footage. One workaround is to use external gyro logging, for instance using the drone blackbox. Another workaround is the use of vibration-dampening mount, which can be a hassle compared to other GoPros.

Some users have reported that using intense low pass filtering of the gyro data (e.g. cutoff of 4 Hz or less) can yield acceptable results for some drone footage. This cannot correct for e.g. higher frequency propwash oscillations or vibrations, but can smooth out the general movement.

In general try to avoid these cameras if possible. If you want a budget-friendly camera, the **Hero 6 Black** is an great choice and doesn't have these issues.

## Using GoPro as external logger

{% content-ref url="/pages/1eITf28f0umpNyriaLnL" %}
[Action Camera as a Logger](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/action-camera-as-a-logger)
{% endcontent-ref %}

[^1]: Usage on FPV drone is not recommended because of motor vibrations which messes up the gyro data.\
    Handheld footage should work fine

[^2]: Superview mode is supported, but it's not 100% accurate. It may work for your case but is generally not recommended

[^3]: Hero 6 is a well supported and reliable model

[^4]: Hypersmooth mode is not supported, ie. all in-camera stabilization needs to be turned **OFF**

[^5]: Hypersmooth mode is supported.\
    This means you can record with in-camera stabilization turned on and then stabilize further in Gyroflow

[^6]: Since Gyroflow 1.7.0, the lens calibration recorded by the camera in every video is used, so no lens profile has to be selected


# DJI

DJI started to add gyro data to their products with the release of DJI Avata. DJI gyro data has lens profile built in and doesn't require any synchronization. It therefore works out of the box, just drag & drop the video file, click Export and you're good to go.

{% hint style="warning" %}
**Important!** In-camera stabilization (EIS/Rocksteady) needs to be **disabled**, and FOV needs to be set to **Wide.** Otherwise your camera **will not** record gyro data and won't be usable in Gyroflow.\
\
Ultrawide, Normal or "Natural Wide" lens modes are **not supported.**
{% endhint %}

## Supported models

<table><thead><tr><th width="142">Model</th><th width="111">Gyro data</th><th width="124">Lens profile</th><th width="159">Synchronization</th><th>Remarks</th></tr></thead><tbody><tr><td>Avata<br>Avata 2</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td></td></tr><tr><td>Neo<br>Neo 2</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td></td></tr><tr><td>O3 Air Unit<br>O4 Air Unit</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td>Needs to be soft-mounted, or use <a href="#dji-o3-o4-air-unit-vibration-issues">Optical correction</a></td></tr><tr><td>Action 2</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td>Since firmware v01.04.0510</td></tr><tr><td>Action 3</td><td>❌</td><td>❌</td><td>❌</td><td>❌ Won't be supported</td></tr><tr><td>Action 4<br>Action 5<br>Action 6</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td></td></tr><tr><td>Osmo Nano</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td></td></tr><tr><td>DJI FPV</td><td>❌</td><td>❌</td><td>❌</td><td>❌ Won't be supported</td></tr><tr><td>Osmo 360<br>Avata 360</td><td>✅</td><td>-</td><td>-</td><td><mark style="color:yellow;">⚠️</mark> <a href="#osmo-360-and-avata-360">Motion data only</a></td></tr></tbody></table>

## Osmo 360 and Avata 360

Since Gyroflow 1.7.0, Gyroflow reads the motion data of the DJI Osmo 360 and DJI Avata 360, but it can't play their 360° video files. Open a playable copy of the clip (e.g. a transcode or a proxy) as the video, and then load the original file in **Motion data -> Open file**.

Stabilizing stitched 360° video is still not supported, see [🥽 360° cameras](https://docs.gyroflow.xyz/app/advanced-usage/360-cameras).

## Exporting for DJI Mimo

DJI Mimo can show dashboard overlays (like speed or altitude) from the metadata the camera records in the video. Since Gyroflow 1.7.0, **Preserve other tracks** in `Export settings -> Advanced` copies that metadata to the stabilized video as it is, so Mimo recognizes the exported file.

Keep **Audio codec** at **AAC**: with **Copy**, the output is a .mov file, which Mimo doesn't accept.

## Split recording

DJI cameras have a file size limit of 4 GB. If the recording is longer, it will be split into multiple parts. If you want to stabilize such split video, you'll have to merge the parts before stabilization.

Gyroflow can do that for you. Just drag & drop all your files in the sequence to Gyroflow to merge.

You can find more information on the [**🎞 File joiner**](https://docs.gyroflow.xyz/app/getting-started/file-joiner) page.

## DJI O3/O4 Air Unit vibration issues <a href="#dji-o3-o4-air-unit-vibration-issues" id="dji-o3-o4-air-unit-vibration-issues"></a>

A common issue with the O3 Air Unit is that after stabilization, the video is more shaky than before. This happens because the camera module is very lightweight and is often hard-mounted to the drone frame, which makes it very prone to collect noise from the motors.

Try to fix the vibrations in hardware first, if you can: clean motion data always gives the best results. If you can't, use [Optical correction](#if-you-cant-fix-the-hardware-optical-correction).

### Fix the vibrations at the source

#### 1. Change the motor PWM frequency from 24 kHz to 48 kHz

The default 24 kHz PWM frequency creates interference with the IMU sampling frequency. You can adjust the motor PWM in your ESC[^1] to 48 kHz or more, to avoid this interference. For most ESC's you can use [BLHeli Suite or BLHeli Configurator](http://www.multirotorguide.com/guide/blheli-suite-and-blheli-configurator-how-to-download-install-use-blhelisuite/).

#### 2. Soft mount the camera

You should avoid hard mounting the O3 Air Unit camera to the drone frame. It needs some kind of dampening to filter out the noise from the motors. Here's a good example of a soft mounted camera:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FawvMBqWJIDMeHxwcIM7R%2F20230213145359_1.gif?alt=media&amp;token=8ca8aa10-15cd-4b50-a948-29f0298b16a7" alt=""><figcaption></figcaption></figure>

Link to thingiverse: <https://www.thingiverse.com/thing:5674654>

TPU or rubber inserts also work fine, here are some other examples:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FDhfI7S1V791fRTaDRU4Q%2Fimage.png?alt=media&amp;token=6a4a8b33-83d8-4dc8-b156-aeb4ca0d661d" alt=""><figcaption></figcaption></figure>

#### 3. Make sure your lens is not loose

Some people reported that the lens of the camera unit can become loose and needs to be glued.\
If nothing else helps, chances are you also have this issue. Check out this video for explanation and details:

{% embed url="<https://www.youtube.com/watch?t=124s&v=xUikSyR4iz8>" %}

#### 4. Make sure your quad is properly tuned

If your quadcopter is well tuned and doesn't vibrate by it's own, it's less likely to create problems for the O3 Air Unit. Make sure you're using fresh, well-balanced propellers, your quad doesn't have resonance issues and you are using [RPM filtering](https://oscarliang.com/rpm-filter/).

#### 5. Read the official O3 Air Unit manual for more details

Check out page 7 in the [DJI O3 Air Unit user manual](https://dl.djicdn.com/downloads/DJI_O3_Air_Unit/20221123/DJI_O3_Air_Unit_User_Manual_v1.0_EN.pdf).

#### 6. Watch a video by Mads Tech about this issue

{% embed url="<https://www.youtube.com/watch?v=p3WdkTMxlVU>" %}

#### 7. Make sure the Air Unit power supply is filtered by a Low ESR capacitor

Some people reported issues with the O3 Air Units when it was powered directly from the LiPo, without a proper (or big enough) Low ESR capacitor on the power line.

### If you can't fix the hardware: Optical correction <a href="#if-you-cant-fix-the-hardware-optical-correction" id="if-you-cant-fix-the-hardware-optical-correction"></a>

Since Gyroflow 1.7.0, **Optical correction** measures the camera motion from the video and corrects the gyro data wherever the image disagrees with it. It properly fixes the vibrations from the motors on hard-mounted O3/O4 Air Units, the O4 Air Unit (Lite) vibrations, and the gyro issue of the 2026 O4 Air Unit Pro units described below. It also works on footage that's already recorded.

Enable `Motion data -> Optical correction` and click **Analyze**. Read more in [**Optical correction**](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).

### O4 Air Unit Pro gyro issue ("Gyrogate")

Some O4 Air Unit Pro units produced in 2026 use a different gyro chip: the 1469D (ICM-40609-D) instead of the MP66. That's the same chip as in the O4 Air Unit (Lite). The raw footage looks fine, but under motor vibration the gyro reports motion that didn't happen, and in violent shaking it can report only part of the real rotation for seconds at a time. Stabilized footage then looks jittery or nearly unusable, both with DJI's RockSteady and in Gyroflow. Read more in [Oscar Liang's article](https://oscarliang.com/dji-o4-pro-gyro-stabilization-issue/) and in [this IntoFPV thread](https://intofpv.com/t-psa-dji-o4-air-unit-pro-gyro-stabilisation-issues-2026-production-units).

Soft mounting doesn't help here. The only hardware fix is replacing the gyro chip: some vendors replace the camera module with one that has the MP66 gyro. If that's not an option, **Optical correction** fixes this as well. If the gyro data is off for long stretches, increase its **Strength**, so that it also corrects large and long errors. If the gyro data is too broken to correct, check **Ignore motion data from the file** to measure all of the motion from the video.

{% hint style="info" %}
Tools that only filter or repair the gyro data aren't robust enough for this footage. Optical correction measures the real motion from the image, which makes it the only reliable way to make this footage usable. It's still not perfect, but the results are pretty good.
{% endhint %}

## Jello or similar vibrations

If your stabilization is generally working fine, but it adds jello effect (horizontally wobbling lines/blocks), then you can try enabling `Low-pass filter` for the *Motion data*. The amount will depend on your footage fps[^2] and vibration frequency, so you'll have to play around with the filtering value until your footage looks good. In general going lower than 30 Hz is not recommended.

{% embed url="<https://youtu.be/7aRk3PEZ0SE>" %}

If the low-pass filter doesn't help, use **Optical correction** (since Gyroflow 1.7.0) with **Correction** set to **Per row**, which also removes vibration within a frame. Read more in [**Optical correction**](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).

## Using DJI as external logger

DJI cameras (except the 360° cameras) don't record the raw IMU data. They only contain Quaternions, which is the final computed camera orientation.

In order to use that data to stabilize another camera, you have to set`Integration method` to **None**.

Because optical flow data on the chart displays gyroscope information and we don't have it, we can't rely on the charts for synchronizing gyro with video. Instead, **Autosync** should do a good job as long as the **Sync search size** is large enough to cover the time difference between starting the DJI camera and your cinema camera.

If you can't get the synchronization working, try increasing **Sync search size** even further

To view quaternions on the chart, right click on the timeline and choose **Chart display mode -> Quaternions**

[^1]: Electronic speed controller

[^2]: frames per second


# Sony

Newer Sony mirrorless cameras are supported out of the box.

Most newer Sony mirrorless cameras record the motion data internally.

## Supported models

<table><thead><tr><th width="289">Model</th><th width="174">Gyro data</th><th width="320">Lens profile</th></tr></thead><tbody><tr><td>Sony α1</td><td>✅</td><td>✅ Automatic</td></tr><tr><td>Sony α7 IV</td><td>✅</td><td>✅ Automatic</td></tr><tr><td>Sony α7C<br>Sony α7C II<br>Sony α7CR</td><td>✅</td><td>✅ Automatic</td></tr><tr><td>Sony α7R IV<br>Sony α7R V</td><td>❌<br>✅</td><td>❌<br>✅ Automatic</td></tr><tr><td>Sony α7S III</td><td>✅</td><td>✅ Automatic</td></tr><tr><td>Sony α9 II<br>Sony α9 III</td><td>❌<br>✅</td><td>❌<br>✅ Automatic</td></tr><tr><td>Sony FX3<br>Sony FX6<br>Sony FX9<br>Sony FX30</td><td>✅</td><td>✅ Automatic</td></tr><tr><td>Sony RX0<br>Sony RX0 II</td><td>❌<br>✅</td><td>❌<br>✅ Automatic</td></tr><tr><td>Sony RX100 VI<br>Sony RX100 VII</td><td>❌<br>✅</td><td>❌<br>✅ Automatic</td></tr><tr><td>Sony ZV-1<br>Sony ZV-1 II<br>Sony ZV-1F<br>Sony ZV-E1<br>Sony ZV-E10<br>Sony ZV-E10 II</td><td>✅</td><td>✅ Automatic</td></tr><tr><td>Sony α6500<br>Sony α6600<br>Sony a6700</td><td>❌<br>❌<br>✅</td><td>❌<br>❌<br>✅ Automatic</td></tr><tr><td>Sony HXR-NX800<br>Sony PXW-Z200</td><td>✅<br>❓</td><td>✅ Automatic<br>❓Probable, not confirmed</td></tr></tbody></table>

That list might not be exhaustive as Sony will probably add the motion data to all their new cameras. In general if the stabilization is available in Sony's *Catalyst Browse* software, Gyroflow should support it too.

## Supported modes

Some recording modes will not store the motion data in files, for example Sony α7S III in 4k/120fps mode doesn't include the motion data.

Gyroflow reads all of the stabilization metadata recorded by the camera, which includes IBIS and OIS data. Therefore, you **can record with IBIS and OIS enabled.** The **Active** and **Dynamic Active** modes are supported as well (Dynamic Active since Gyroflow 1.7.0).

The best option is to use **Standard** stabilization in camera (if your model has IBIS) and add Gyroflow on top of that, because Active and Dynamic Active also crop the image in camera.

All known issues with Sony metadata are fixed since Gyroflow 1.7.0. If your file still doesn't work properly, but does work in Catalyst Browse, submit it in [this GitHub issue](https://github.com/gyroflow/gyroflow/issues/849).

### Supported OSS Lenses

The list of supported lenses with OSS enabled is available on the [Sony website](https://support.d-imaging.sony.co.jp/www/cscs/function/compatibility.php?fnc=1002\&area=gb\&lang=en\&ref=1). If the link ever stops working, here's the current list as of Oct 2025:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F8gx6UX5ZF0nLclUw5xTz%2Fsony%20lenses.jpg?alt=media&amp;token=dc3f02a1-4340-4646-ad68-d5cc21976662" alt=""><figcaption></figcaption></figure>

## Zoom lenses

Zoom lenses are supported automatically, and you can zoom in and out throughout the video.

* If you want to smooth out fast zooms, enable **Stabilize focal length** in the Stabilization panel.
* Some lenses report the focal length a few frames late (e.g. some Tamron zooms). If the picture jumps or wobbles during zooms, set **Lens metadata delay** in `Lens profile -> Advanced`, or click **Analyze** next to it to measure it from the zooms in the clip.

Learn more in [🔭 **Advanced usage -> Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#zoom-lenses).

## Lens breathing compensation

Many lenses change the field of view slightly when focusing (this is called focus breathing). Since Gyroflow 1.7.0, Gyroflow can keep the field of view constant while focusing, using the lens breathing data recorded by the camera. That's the case for supported Sony lenses on cameras like the α7 IV, α7C II, α7R V, α6700 and ZV-E1.

When the file contains this data, **Lens breathing compensation** shows up in the Lens profile panel, and it's enabled by default.

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).


# Canon

Newer Canon mirrorless cameras are supported out of the box.

## Supported models

<table><thead><tr><th width="289">Model</th><th width="174">Gyro data</th><th width="320">Lens profile</th></tr></thead><tbody><tr><td>EOS C50<br>EOS C80<br>EOS C400</td><td>✅</td><td>✅ Automatic <sup><sub>(see</sub></sup> <a href="#supported-lenses-for-automatic-lens-profile"><sup><sub>Supported Lenses</sub></sup></a><sup><sub>)</sub></sup></td></tr><tr><td>EOS R6 Mark II<br>EOS R6 Mark III</td><td>❌<br>✅</td><td>❌<br>✅ Automatic <sup><sub>(see</sub></sup> <a href="#supported-lenses-for-automatic-lens-profile"><sup><sub>Supported Lenses</sub></sup></a><sup><sub>)</sub></sup></td></tr><tr><td>EOS R6 V</td><td>✅</td><td>✅ Automatic <sup><sub>(see</sub></sup> <a href="#supported-lenses-for-automatic-lens-profile"><sup><sub>Supported Lenses</sub></sup></a><sup><sub>)</sub></sup></td></tr><tr><td>EOS R5<br>EOS R5 Mark II</td><td>❌<br>✅</td><td>❌<br>✅ Automatic <sup><sub>(see</sub></sup> <a href="#supported-lenses-for-automatic-lens-profile"><sup><sub>Supported Lenses</sub></sup></a><sup><sub>)</sub></sup></td></tr></tbody></table>

That list might not be exhaustive as Canon will probably add the motion data to all their new cameras.

With a supported lens, Gyroflow reads the motion data and the focal length of every frame from the clip, so no lens profile is needed and zooms are followed.

## Supported formats

* **MP4** and **MXF** files play in Gyroflow, and the motion data is read from the same file.
* **Cinema RAW Light** (.crm) files play in Gyroflow since version 1.7.1, and the motion data is read from the same file. They can't be rendered in the app, see [Cinema RAW Light playback](#cinema-raw-light-playback) below.

## Cinema RAW Light playback

Since Gyroflow 1.7.1, Gyroflow opens **.crm** files directly in the main app, so there's no need for transcoding. They're decoded with the Canon RAW SDK, which Gyroflow downloads the first time you open such a file.

It works on Windows and Linux (x64) and on macOS. The Canon SDK processes the frames on the GPU only: with CUDA on NVIDIA GPUs, OpenCL on other GPUs, and Metal on macOS.

On other platforms (Windows on ARM, Android, iOS) and in older versions of Gyroflow, open a playable copy of the clip (e.g. the proxy recorded by the camera, or a transcode) as the video, and then load the original **.crm** file in **Motion data -> Open file**.

### Exporting

Exporting directly from Gyroflow when using a **.crm** file is not supported, like with Blackmagic RAW. Instead, export a project file and use one of the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow) to render out from your video editor. That's the best option anyway, because you keep all RAW color controls.

If you need to render in Gyroflow, open a playable copy of the clip (e.g. a ProRes transcode) as the video, and then load the original **.crm** file in **Motion data -> Open file**.

## Supported modes

In order to stabilize the videos correctly in Gyroflow, all internal stabilization in camera **must be disabled.** This includes Lens IS, Digital IS and IBIS.

At this point, Canon's gyro data timing is not always 100% accurate. You may have to do an [Auto Sync](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization) on some clips.

## Supported Lenses for automatic lens profile

The list of supported lenses which work automatically in Gyroflow:

#### RF Lenses

* RF 14mm F1.4L VCM
* RF 20mm F1.4L VCM
* RF 24mm F1.4L VCM
* RF 35mm F1.4L VCM
* RF 50mm F1.4L VCM
* RF 85mm F1.4L VCM
* RF 45mm F1.2 STM
* RF 20-50mm F4L IS USM PZ
* RF 24-105mm F2.8L IS USM Z <sup>(RF 1.4x or 2x Extender are also compatible)</sup>
* RF 70-200mm F2.8L IS USM Z <sup>(RF 1.4x or 2x Extender are also compatible)</sup>

#### RF Cinema Lenses

* RF CN30x40 IAS J/R1
* RF CN7x17 KAS T/R1
* RF CN5x11 IAS T/R1
* RF CN-R 14mm T3.1L F
* RF CN-R 20mm T1.5L F
* RF CN-R 24mm T1.5L F
* RF CN-R 35mm T1.5L F
* RF CN-R 50mm T1.3L F
* RF CN-R 85mm T1.3L F
* RF CN-R 135mm T2.2L F

#### EF Mount: (Requires an EF to EOS R Mount Adapter)

* EF CN8x15 IAS S/E1
* EF CN-E 20-50mm T2.4L F
* EF CN-E 45-135mm T2.4L F
* EF CN-E 14-35mm T1.7L F
* EF CN-E 31.5-95mm T1.7L F

{% hint style="warning" %}
Make sure your camera and the lens are updated to latest firmware version.
{% endhint %}

## Zoom lenses

Zoom lenses are supported automatically, and you can zoom in and out throughout the video, if your lens is on the list provided above.

If you want to smooth out fast zooms, enable **Stabilize focal length** in the Stabilization panel. Learn more in [🔭 **Advanced usage -> Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#zoom-lenses).

## My lens is not on that list

If your lens is not supported, you have to provide a lens profile manually. You can either find it in the list of community-provided lens profiles, or calibrate yourself by following [🏁this guide](https://docs.gyroflow.xyz/app/getting-started/lens-calibration).

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).


# Insta360

Most Insta360 action cameras are supported.

Insta360 has two types of cameras: action cameras and 360° cameras. Action cameras are supported out of the box in Gyroflow, but 360° cameras [are not](https://docs.gyroflow.xyz/app/advanced-usage/360-cameras).

## Supported models

<table><thead><tr><th width="197">Model</th><th width="83">Type</th><th width="174">Support</th><th width="158">Synchronization</th></tr></thead><tbody><tr><td>Insta360 GO</td><td>Action</td><td>✅ Supported</td><td>❗Needed</td></tr><tr><td>Insta360 GO 2<br>Caddx Peanut</td><td>Action</td><td>✅ Supported</td><td>✅ Not needed</td></tr><tr><td>Insta360 GO 3<br>Insta360 GO 3S<br>Insta360 GO Ultra</td><td>Action</td><td>✅ Supported</td><td>✅ Not needed</td></tr><tr><td>Insta360 ONE R<br>Insta360 SMO 4k</td><td>Action</td><td>✅ Supported</td><td>✅ Not needed</td></tr><tr><td>Insta360 ONE RS</td><td>Action</td><td>✅ Supported</td><td>✅ Not needed</td></tr><tr><td>Insta360 Ace<br>Insta360 Ace Pro<br>Insta360 Ace Pro 2</td><td>Action</td><td>✅ Supported</td><td>✅ Not needed</td></tr><tr><td>Insta360 ONE RS 1-Inch 360</td><td>360°</td><td>❌ Not supported</td><td>❌</td></tr><tr><td>Insta360 ONE X2</td><td>360°</td><td>❌ Not supported</td><td>❌</td></tr><tr><td>Insta360 X1-X6</td><td>360°</td><td>❌ Not supported</td><td>❌</td></tr><tr><td>Antigravity A1</td><td>360°</td><td>❌ Not supported</td><td>❌</td></tr></tbody></table>

Most supported cameras have official lens profiles built-in, except for the older *Insta360 Go*

Some of the cameras require use of FreeFrame video mode, for motion data to be saved.

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).


# Blackmagic

Some Blackmagic cameras record internal gyro data in .braw files

Blackmagic has added recording of internal motion data with the firmware **v7.9** available for Blackmagic Pocket Cinema Camera 4k and 6k

## Supported models

<table><thead><tr><th width="283">Model</th><th width="110">Gyro data</th><th width="129">Lens profile</th><th width="166">Synchronization</th></tr></thead><tbody><tr><td>Pocket Cinema Camera 4K</td><td>✅</td><td><mark style="color:yellow;">⚠️</mark> By users</td><td>✅ Not needed</td></tr><tr><td>Pocket Cinema Camera 6K<br>Pocket Cinema Camera 6K G2<br>Pocket Cinema Camera 6K Pro</td><td>✅</td><td><mark style="color:yellow;">⚠️</mark> By users</td><td>✅ Not needed</td></tr><tr><td>Micro Studio G2</td><td>✅</td><td><mark style="color:yellow;">⚠️</mark> By users</td><td>❗<a data-footnote-ref href="#user-content-fn-1">Needed</a></td></tr></tbody></table>

{% hint style="info" %}
Gyro data is recorded only in the **.braw** file format.

ProRes (.mov) doesn't include the gyro data.
{% endhint %}

## BRAW playback

Gyroflow supports loading **.braw** files directly in the main app, so there's no need for transcoding. That feature was kindly sponsored by the community. Since Gyroflow 1.7.0, it also works on Windows on ARM.

## Project frame rate

If you shoot in a VFR mode (e.g. 120 fps stored as 30 fps file, slowed down), then Gyroflow will detect that and the load correct frame rate from the metadata automatically.

## Zoom lenses

Blackmagic metadata contains lens focal length per frame, and since Gyroflow 1.7.0 the lens profile follows it. However, it only contains whole numbers like 14mm, 15mm etc., without e.g. 14.2mm.

This means a lens profile for a zoom lens works for different zoom levels, but changing zoom throughout the video can create "steps", because we don't have the exact focal length information. It works best for scenarios where you use the zoom lens for different scenes, but the zoom is not changing throughout the shot.

Learn more about zoom lens profiles in the [🔭 **Advanced usage -> Lens profile**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles) section.

## Naked BMPCC

A common thing in the FPV community is to decase the BMPCC in order to reduce the weight. This separates the sensor and lens from the main board and makes the gyro data rotated in relation to the pixels captured by the sensor, because the IMU chip is on the main board.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FMKldG7Oyc0aMasDnQZTT%2F%5Bremoval.ai%5D_tmp-63eff408df9bd_5DJJZH.png?alt=media&amp;token=76c707c3-f22b-48dd-a8a2-071d1d634d67" alt=""><figcaption><p>Naked BMPCC 6K from HaloRC</p></figcaption></figure>

In order to use naked BMPCC with internal gyro data in Gyroflow you have to

1. Change IMU orientation to **`zyx`**
2. Enter gyro rotation, mainly the Pitch (uptilt) angle in degrees

You can determine the rotation angles in Gyroflow using charts and optical flow data - see [🔀 **IMU orientation and rotation**](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation) for a detailed guide how to do that.

## Exporting

Exporting directly from Gyroflow when using a **.braw** file is not supported at the moment. Instead, you should use one of the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow) to render out from your video editor.

The reason is that the encoding pipeline in Gyroflow is tightly tied to *ffmpeg*, and BRAW format uses an external SDK instead.

There are plans to rewrite the rendering pipeline to allow exporting ProRes directly from .braw in Gyroflow, but it will take at least several months.

Using the plugin is the best option anyway because you then have all RAW color controls without compromises. Learn more here:

{% content-ref url="/pages/CbozEJNjsF6laIy4ZbSl" %}
[General Plugin Workflow](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow)
{% endcontent-ref %}

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording if you want to stabilize in post, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).

[^1]: Until it's fixed in the firmware update


# RED

There are currently 2 RED cameras which record gyro data internally: V-Raptor and KOMODO

RED cameras record motion data internally in the **.R3D** files and Gyroflow supports these files directly.

## Supported models

<table><thead><tr><th width="208">Model</th><th width="110">Gyro data</th><th width="129">Lens profile</th><th width="166">Synchronization</th></tr></thead><tbody><tr><td>RED V-Raptor</td><td>✅</td><td><mark style="color:yellow;">⚠️</mark> By users</td><td>✅ Not needed</td></tr><tr><td>RED KOMODO</td><td>✅</td><td><mark style="color:yellow;">⚠️</mark> By users</td><td>✅ Not needed</td></tr></tbody></table>

Since Gyroflow 1.7.0, the RED gyro data is accurately timed, so synchronization (autosync) is no longer needed.

{% hint style="info" %}
Gyro data is recorded only in the **.R3D** file format.

ProRes (.mov) doesn't include the gyro data.
{% endhint %}

## RED RAW playback

Gyroflow supports loading **.R3D** files directly in the main app, so there's no need for transcoding. That feature was kindly sponsored by the community. Since Gyroflow 1.7.0, it also works on Windows on ARM.

## Project frame rate

If you shoot in a VFR mode (e.g. 120 fps stored as 30 fps file, slowed down), then Gyroflow will detect that and the load correct frame rate from the metadata automatically.

## Exporting

Exporting directly from Gyroflow when using an **.R3D** file is supported, but it uses an intermediate conversion step and needs *REDline* (available with the REDCINE-X installation) to convert R3D to ProRes before stabilizing.

Basically when you click **Export** Gyroflow will call *REDline* program to convert R3D to ProRes behind the scenes and then it will use that converted ProRes to actually perform the stabilization and final export to desired output format. This also works in the render queue.

You can control the format of that intermedia file in the Advanced tab:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FCAQmLoGScSuw0YDVgGmu%2Fimage.png?alt=media&amp;token=1c507850-6d5c-4031-8d48-0a2e0bd7c0a6" alt=""><figcaption><p>You need REDCINE-X installed to see these settings</p></figcaption></figure>

{% hint style="info" %}
The ProRes format used for the conversion is not related to the actual Export settings.

For example if you use ProRes proxy for the intermediate file and then set ProRes 4444 in the main export settings, your quality will be ruined, because it will take pixels from that Proxy file.

Make sure you have set both ProRes formats correctly. You can also export H.264, H.265 or any other format for the stabilized file, but the intermediate file can only be ProRes.
{% endhint %}

The ProRes file is always created next to the original .**R3D** file with the **.mov** extension. If that file already exists, the conversion step is skipped. This is convenient when trying different stabilization settings or different trim range exports, but keep in mind that if you want to change colors (e.g. you converted once with [LOG colors](#user-content-fn-1)[^1] and then want to switch to fully graded, you'll have to delete that **.mov** file and let Gyroflow convert it again with your new settings. If that file is corrupted it will also show an error so keep that in mind.

{% hint style="warning" %}
Remember to delete the intermediate .mov file when you change the conversion format settings.
{% endhint %}

While that works, it is recommended to use one of the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow) to render out from your video editor.

There are plans to rewrite the rendering pipeline to allow exporting ProRes directly from .R3D in Gyroflow, but it will take at least several months.

Using the plugin is the best option anyway because you then have all RAW color controls without compromises. Learn more here:

{% content-ref url="/pages/CbozEJNjsF6laIy4ZbSl" %}
[General Plugin Workflow](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow)
{% endcontent-ref %}

## Lens metadata

Gyroflow will also read lens name and focal length from the **.R3D** file if it's provided by the camera. This allows it to autofill all the needed settings in the lens calibrator and to uniquely identify the lens profile to load it automatically.

If the lens name is not provided by the camera, you can edit the metadata in REDCINE-X and Gyroflow will also read it from there (it is stored in the .RMD file).

## Zoom lenses

Since Gyroflow 1.7.0, the lens profile follows the focal length recorded for every frame, so you can zoom during the shot. If you want to smooth out fast zooms, enable **Stabilize focal length** in the Stabilization panel. Learn more in [🔭 **Advanced usage -> Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#zoom-lenses).

## Gyro bias

Estimating gyro bias can help achieve better stabilization results. To estimate the bias, you'll need to have a moment in your video where the camera is not moving at all. In the FPV case it can be before take off.

To estimate gyro bias, go to the moment where the camera is not moving, right click on the timeline and select **Estimate gyro bias here**. Then remove all sync points and do the synchronization again.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FPmilXgfcMcpjn2S1CLuq%2F20230218023727_1.gif?alt=media&amp;token=e577a467-2871-495d-8721-7a18bc164b26" alt=""><figcaption><p>Gyro bias estimation</p></figcaption></figure>

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording if you want to stabilize in post, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).

[^1]: Primary development only


# Z CAM

Z CAM Mark II cameras record motion data and lens metadata internally.

Since Gyroflow 1.7.0, Z CAM Mark II cameras are supported. They record the motion data, the lens focal length and the frame readout time in the video file.

## Supported models

<table><thead><tr><th width="208">Model</th><th width="110">Gyro data</th><th width="160">Lens profile</th><th width="166">Synchronization</th></tr></thead><tbody><tr><td>E2-M4 Mark II<br>E2-S6 Mark II<br>E2-F6 Mark II<br>E2-F8 Mark II<br>E2-M4G Mark II<br>E2-S6G Mark II<br>E2N Mark II</td><td>✅</td><td><mark style="color:yellow;">⚠️</mark> <a href="#lens-profile">From the focal length</a></td><td>✅ Not needed</td></tr></tbody></table>

## Supported formats

* **MP4** and **MOV** files play in Gyroflow, and the motion data is read from the same file.
* **ZRAW** (.zraw) - Gyroflow can't play these files, but it can read their motion data. Open a playable copy of the clip (e.g. a transcode or a proxy) as the video, and then load the original **.zraw** file in **Motion data -> Open file**.

## Lens profile

Gyroflow creates the lens profile from the focal length and the sensor area recorded by the camera. That lens profile has no lens distortion, so it works well for rectilinear lenses with little distortion. For wide or fisheye lenses, load a calibrated lens profile instead, or calibrate your lens by following [🏁 this guide](https://docs.gyroflow.xyz/app/getting-started/lens-calibration).

If your lens doesn't report its focal length to the camera (e.g. a manual lens), you also have to provide a lens profile.

## Zoom lenses

The camera records the focal length of every frame, so Gyroflow follows the zoom automatically. If you want to smooth out fast zooms, enable **Stabilize focal length** in the Stabilization panel. Learn more in [🔭 **Advanced usage -> Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#zoom-lenses).

## Rolling shutter correction

The frame readout time is read from the file, so you don't need to set it.

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).


# Xtra

Xtra cameras contain the gyro data embedded in the video file.

{% hint style="warning" %}
**Important!** In-camera stabilization (EIS/MotionMaster) needs to be **disabled**, and FOV needs to be set to **Wide.** Otherwise your camera **will not** record gyro data and won't be usable in Gyroflow.\
\
Ultrawide, Normal or "Natural Wide" lens modes are **not supported.**
{% endhint %}

## Supported models

<table><thead><tr><th width="142">Model</th><th width="119.5714111328125">Gyro data</th><th width="124">Lens profile</th><th width="159">Synchronization</th><th>Remarks</th></tr></thead><tbody><tr><td>Edge<br>Edge Pro</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td></td></tr><tr><td>Muse</td><td>❌</td><td>❌</td><td>❌</td><td></td></tr><tr><td>Sphra360</td><td>-</td><td>-</td><td>-</td><td>360 cameras are not supported</td></tr></tbody></table>

## Split recording

Xtra cameras have a file size limit of 4 GB. If the recording is longer, it will be split into multiple parts. If you want to stabilize such split video, you'll have to merge the parts before stabilization.

Gyroflow can do that for you. Just drag & drop all your files in the sequence to Gyroflow to merge.

You can find more information on the [**🎞 File joiner**](https://docs.gyroflow.xyz/app/getting-started/file-joiner) page.

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).


# Flight controllers

The gyro data logged by a drone's flight controller can stabilize the video of any camera on that drone. You'll have to synchronize the log with the video, see [⌛ Synchronization](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization#synchronizing-external-gyro-source).

## Betaflight

Gyroflow reads Betaflight blackbox logs (`.bbl`, `.bfl`, or `.csv` exported from Blackbox Explorer). INAV, Emuflight and other forks use the same format.

* Set up the logging with the Gyroflow logger presets, see [Flight controller](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/flight-controller#gyroflow-logger-preset).
* Enter the camera uptilt in `Motion data -> Rotation -> Pitch`, see [Camera angle](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/flight-controller#camera-angle).
* If the log file contains several flights, choose yours in **Select log**, see [Multiple logs in one file](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/flight-controller#multiple-logs).

## ArduPilot

Gyroflow reads ArduPilot logs (`.bin` or `.log`) directly, there's no need to convert them.

Set up the logging as described in ArduPilot's [Video Stabilization Using IMU data and Gyroflow](https://ardupilot.org/copter/docs/common-gyroflow.html):

* enable the video stabilization bit in `LOG_BITMASK` (bit 20 for Copter and Rover, bit 21 for Plane),
* set `SCHED_LOOP_RATE` to 300 Hz or higher (Plane and Rover default to 50 Hz),
* optionally, set `LOG_FILE_DSRMROT` to 1, to get one log per flight.

Enter the camera angle in `Motion data -> Rotation -> Pitch`: positive when the camera is tilted up, negative when it's tilted down (on planes, often around -10° to -20°).

### Wobble in planes

Jello or wobble that Gyroflow doesn't remove often comes from a soft-mounted camera: it moves differently than the autopilot, whose IMU recorded the motion. ArduPilot suggests hard mounting the camera to the airframe, but warns that it can also make the results worse, so test both.

Since Gyroflow 1.7.0, you can also use [Optical correction](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction) with **Correction** set to **Per row**. It corrects the motion data wherever the image disagrees with it, and removes the jello.


# RunCam

RunCam cameras save the gyro data in the .gcsv format next to the video files

{% hint style="warning" %}
**Important!** Make sure you have the latest firmware installed in your camera.

You can download it from [here](https://www.runcam.com/download/actioncameras).
{% endhint %}

## Supported models

<table><thead><tr><th width="167">Model</th><th width="111">Gyro data</th><th width="126">Lens profile</th><th width="159">Synchronization</th><th>Quality</th></tr></thead><tbody><tr><td>5 Orange</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>✅ Decent</td></tr><tr><td>Thumb</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>❌ Bad</td></tr><tr><td>Thumb Pro</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>✅ Decent</td></tr><tr><td>Thumb Pro-W</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>✅ Decent</td></tr><tr><td>Thumb 2</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>✅ Good</td></tr></tbody></table>

## Caveats

While RunCam cameras save the gyro information, it can be very tricky to stabilize the footage accurately, especially on an FPV drone.

RunCam cameras have an issue with duplicated or dropped frames, and this causes synchronization issues.

Moreover because they are very lightweight, they are prone to receive a lot of vibrations from the motors. You may have to try different mounts to get acceptable results.

## Synchronization

It may be difficult to correctly sync the RunCam cameras. By default Gyroflow uses a special sync points pattern to try to sync the video when the frames are duplicated or dropped, thus giving you the best chance of correct synchronization.

With some videos this may not work by default so you'll need to adjust these sync points, deleting some and adding new ones in different places. Make sure to learn how to use Gyroflow by reading the [🔧 **Basic usage**](https://docs.gyroflow.xyz/app/getting-started/basic-usage), [📈**Timeline and gyro chart**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/timeline-and-gyro-chart) and [⌛ **Synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization) sections.

Correct synchronization of RunCam cameras can be a pain sometimes so if you want to save yourself trouble and frustration, avoid RunCam cameras and get something else instead.

{% hint style="info" %}
Ignore sync point colors with RunCam cameras, some will be red and some will be green, but because of the duplicated/dropped frames, the color indicator is useless. Make sure your video is stabilized by playing it.
{% endhint %}

## Recommended camera settings

* Video quality: High
* Resolution: Either 4K\@30FPS(XV) or 1440p\@60fps.
  * The XV resolution is actually the full 4:3 sensor stretched to a 16:9 image. This gives the highest resolution and FOV.
  * Note that the stretching itself looks bad, so if used without additional processing, linearly squeeze the width to 75% in the video editor to get a 4:3 image.
  * The 1440p option is natively 4:3, so if you want 60fps use this one.
  * You can also use one of the 16:9 resolutions, but this significantly reduces the available FOV for stabilization.
* Shutter: Aim for 45° to 90° shutter. For 30 fps it will be 1/240 to 1/120 and for 60 fps - 1/480 to 1/240.
* ISO: As low as possible. There seems to be some auto gain regardless of settings.
* Color style: Normal (Flat squeezes the range and doesn’t actually provide more dynamic range)
* Distortion correction: Disabled
* Electronic Image Stabilization: Disabled
* General settings (these were just found to work decently well, but do some testing yourself)
  * Saturation: Medium
  * Exposure compensation: 0
  * Contrast: Low
  * Sharpness: Low
  * Metering: Average
  * White balance: Sunny (change depending on scenario, *don’t* use auto)
  * Low light enhancement: you decide.


# Caddx

## Supported models

<table><thead><tr><th width="122">Model</th><th width="114">Gyro data</th><th width="127">Lens profile</th><th width="160">Synchronization</th><th>Remarks</th></tr></thead><tbody><tr><td>Peanut</td><td>✅</td><td>✅ Official</td><td>✅ Not needed</td><td>It's <a href="https://docs.gyroflow.xyz/app/getting-started/supported-cameras/insta360">Insta360 GO 2</a></td></tr><tr><td>Walnut</td><td>✅</td><td>✅ Official</td><td>❗Needed</td><td>Uses .gcsv</td></tr></tbody></table>

{% hint style="info" %}
Disable the internal Lens Distortion Correction. Stabilization doesn't work properly when that mode is enabled.
{% endhint %}


# Hawkeye

## Supported models

| Model          | Gyro data | Lens profile | Synchronization |
| -------------- | --------- | ------------ | --------------- |
| Firefly X-Lite | ✅         | ✅ Official   | ❗Needed         |
| Naked/Split    | ✅         | ✅ Official   | ❗Needed         |


# Nikon

Gyroflow plays Nikon RAW video files, but Nikon cameras don't record gyro data.

Nikon cameras don't record gyro data, so they need an [external gyro source](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source), or the motion measured from the video with [Optical correction](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).

Since Gyroflow 1.7.0, Gyroflow can open Nikon's RAW video files directly: **N-RAW** (.nev) and **R3D NE** (.r3d), recorded for example by the Nikon ZR. It also reads their recording metadata, like the lens focal length and the shooting settings.

## RAW playback

Gyroflow opens **.nev** and **.r3d** files directly, so there's no need for transcoding. Like R3D files from RED cameras, they're decoded with the RED SDK, which Gyroflow downloads the first time you open such a file.

## Lens profile

The camera doesn't record the lens distortion, so you have to provide a lens profile. You can either find it in the list of community-provided lens profiles, or calibrate your lens by following [🏁 this guide](https://docs.gyroflow.xyz/app/getting-started/lens-calibration).

## Zoom lenses

The camera records the focal length of every frame, and Gyroflow follows it, so you can zoom during the shot. If you want to smooth out fast zooms, enable **Stabilize focal length** in the Stabilization panel. Learn more in [🔭 **Advanced usage -> Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#zoom-lenses).

## Rolling shutter correction

The frame readout time isn't recorded in the file, so you have to set it in the Stabilization panel. Read more in [🔥 **Stabilization -> Rolling shutter correction**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization#rolling-shutter-correction). It's best to save it in your lens profile.

## Exporting

Exporting these files works the same way as with RED files: Gyroflow first converts them to ProRes with *REDline* (available with the REDCINE-X installation). Read more on the [RED](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/red#exporting) page.

It's recommended to use one of the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow) instead, to keep all RAW color controls.

## Shutter speed, ND filters and motion blur

You should avoid motion blur when recording if you want to stabilize in post, read more why in the [📸 **Common filming tips and issues**](https://docs.gyroflow.xyz/app/getting-started/common-filming-tips-and-issues).


# Mobile Phones

You can also use your **iPhone** or **Android** phone to capture gyroscope data.

### Apple iPhone

* [Sensor Logger](https://apps.apple.com/us/app/sensor-logger/id1531582925)
* [G-Field Recorder](https://apps.apple.com/at/app/g-field-recorder/id1154585693)
* [Gyro](https://apps.apple.com/us/app/gyro-record-device-motion-data/id1161532981)
* [GyLog](https://apps.apple.com/app/id6759689665)
* [GyLog Cam](https://apps.apple.com/app/id6830048109)

### Android

* [Sensor Logger](https://play.google.com/store/apps/details?id=com.kelvin.sensorapp\&hl=de_AT\&gl=US)
* [Sensor Record](https://play.google.com/store/apps/details?id=de.martingolpashin.sensor_record)
* [Open Camera Sensors](https://github.com/MobileRoboticsSkoltech/OpenCamera-Sensors)
* [MotionCam Pro](https://play.google.com/store/apps/details?id=com.motioncam.pro)
* [Film it](https://play.google.com/store/apps/details?id=com.software.illusions.unlimited.filmit\&hl=en_US)
* [GyLog](https://play.google.com/store/apps/details?id=com.kumoinc.gylogrecorder)

### Using as a camera

If you're filming on your phone, it's best to use an app that records the video and the gyro at the same time (e.g. MotionCam Pro, Film it or Open Camera Sensors), it will be easier to synchronize.

If your phone has OIS (Optical image Stabilization) and it's not possible to disable it - it will interfere with stabilization results.

Gyroflow will not work if you had any internal stabilization enabled on your phone.

### MotionCam Pro RAW video

Since Gyroflow 1.7.0, Gyroflow reads the motion data and the lens calibration from MotionCam Pro RAW video files (.mcraw), but it can't play these files. Open a playable copy of the clip (e.g. a transcode or a proxy) as the video, and then load the original **.mcraw** file in **Motion data -> Open file**.

### Using as external gyro logger

If you want to record gyro data for use with an external camera, you'll have to figure out the [**🔀 IMU Orientation**](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation), depending on the way you mounted the phone.


# Other Cameras

## HOVERAir

Since Gyroflow 1.7.0, Gyroflow reads the motion data that HOVERAir cameras record in the video file. Its timing isn't exact, so make sure the clip is synchronized, see [⌛ Synchronization](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization).

## Gyroflow Protobuf

Cameras and apps can embed the motion data, lens and IBIS/OIS information in the video file, or in a .jsonl sidecar file, using the open [Gyroflow Protobuf](https://docs.gyroflow.xyz/app/technical-details/gyroflow-protobuf) format. Gyroflow supports it since version 1.7.0.

## WitMotion

Gyroflow supports motion data recorded with [WT901 ](https://www.wit-motion.com/BLE/52.html)device from WitMotion. While it works, users reported some inaccuracies when recording with faster sample rate, so that device is generally not recommended

## VuzeXR

VuzeXR is a 360° camera, and while stabilizing 360° cameras is not supported, Gyroflow can read gyro data recorded by this camera.

## KanDao

Gyroflow can read gyro data from KanDao Obsidian Pro camera, but similarly to VuzeXR - can't stabilize 360° videos

## CAMM format

Lenovo VR180 camera records gyro data in the [CAMM ](https://developers.google.com/streetview/publish/camm-spec)format, and Gyroflow supports reading that format.

## XTU

Some XTU action cameras record gyro data in .gcsv files and the videos can be stabilized in Gyroflow


# Basic Usage

## How does it work?

Gyroflow works by using motion data recorded by the camera to recreate camera motion in real world and compensate for the camera movements, therefore creating a new, stabilized world view.

If your video has no motion data, or the motion data is bad (e.g. because of vibrations), Gyroflow can also measure the camera motion from the video itself. Read more in [**Optical correction**](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).

In order to do that, Gyroflow must know exactly how the camera was oriented in space when the video frame was captured. It is **very important** for the motion data to be accurately representing the video frames.

Most cameras record the motion data outside of the video pipeline and this causes time difference between capturing actual pixels and capturing camera position. In order to compensate for that, we have to figure out that time offset so Gyroflow can know exactly where the camera was at a particular pixel of the video.

This is done by the **Synchronization** step in Gyroflow and it's very important to do it accurately. Otherwise Gyroflow can't know how the camera was moving and will create bad results.

{% hint style="warning" %}
**Remember!** If you're not getting a good stabilization, the most important questions you should ask yourself are:\
1\. Is my synchronization (time offset) accurate?\
2\. Is my lens profile accurate?\
3\. Is my [rolling shutter correction](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization#rolling-shutter-correction) value accurate?
{% endhint %}

In order to move the video around for stabilization, we also have to remove the lens from the equation. All camera lenses create some distortions and when we attempt to move the view, we'll move it with these distortions and it will look bad.

Gyroflow needs to know the real world view that is not skewed by the lens distortions, so we can move sort of a "flat" plane around and avoid warping caused by the lens optics.

This is done by calibrating the camera lens and using the lens profile in Gyroflow.

Once you have accurate lens profile and accurate motion data, Gyroflow can take your video, undistort the lens optics, move the world view around according to the motion data, and then optionally add the lens distortion back. If your synchronization or lens profile is not accurate, that whole process falls apart and produces bad results.

Some cameras (e.g. GoPro 8+, DJI) have official lens profile and accurate timing data built-in, so they just work out of the box. All other cameras need the lens profile and synchronization done by the user.

## General UI overview

Gyroflow's user interface is divided into 3 sections:

1. **Left:** Inputs - all input files and input parameters are on the left side
2. **Center:** Timeline and gyro data - below the video you have the main timeline with the gyro data. This is a very important tool, so make sure you learn how to use it.
3. **Right:** Stabilization parameters and outputs

All sliders in Gyroflow can be reset to the default value by double clicking on the label, or right clicking and selecting **Reset value**.

All sliders also have [**🔑 Keyframing**](https://docs.gyroflow.xyz/app/advanced-usage/keyframes) available when you right click and select **Enable keyframing.**

All value fields can be adjusted by using *Up* and *Down* keys on your keyboard, with Ctrl/Alt/Shift modifiers for different step amount.

### Video information

This section contains the input file and the detected information about it.

You can see the detected camera and lens info, resolution, duration, frame rate, codec, pixel format, audio, rotation and whether the gyro data was detected in that video file. If the camera records them, it also shows the shooting settings, like shutter speed, ISO, white balance, iris and focal length.

There are 2 editable fields here: Frame rate and rotation

1. Frame rate - this is the frame rate used for the **motion data** and this should be the real-time frame rate. For most videos, you don't need to change it. However if you record in a VFR mode, where the video is captured at e.g. 120 fps but the file is slowed down to 30 fps - this is where you should edit that field and enter **119.88 fps** (remember to put exact frame rate, for NTSC it's 23.976, 29.97, 47.952, 59.94, 119.88 etc. For PAL it's 25, 50, 100 etc.)
2. Rotation - if you captured the video on the side or upside down, you can edit that field and enter rotation in degrees.

### Lens profile

This section contains the lens profile for your video. Lens profile is very important as it's the base for the stabilization algorithm. You can either pick one of built-in lens profiles, or create your own. In general [fps ](#user-content-fn-1)[^1]doesn't matter for lens profile, as long as it uses the same sensor area.

Some cameras have the lens profile built-in and loaded automatically.

If your video is already undistorted (it was recorded with a rectilinear lens, or the distortion was corrected in camera) and there's no lens profile for it, you can check **No distortion, focal length only** and enter the 35 mm equivalent focal length instead of loading a lens profile.

You can also mark lens profile as a favorite by clicking the star icon.

Lens profiles can be scaled, i.e. it's OK to load a lens profile created for 4k video, to a 1080p video, as long as the aspect ratio is the same and the camera uses the same sensor area.

For this reason, search box validates the aspect ratio and fades out lens profiles which don't match the aspect ratio of your video.

In some cameras (like RED), different resolutions always use different part of the sensor, so the lens profile can't be scaled and you need to use one created for the same exact resolution. Have this in mind when troubleshooting stabilization issues.

The search box here can also hold your [⚙ **settings presets**](https://docs.gyroflow.xyz/app/advanced-usage/settings-presets), if you save them with **Save to lens profile directory**. Presets can also be favorited and are searchable.

The search box also understands shortcuts for some common camera names: `bmpcc4k, bmpcc6k, bmpcc, gopro5, gopro6, gopro7, gopro8, gopro9, gopro10, gopro11, gopro12, gopro13, session5, a73, a74, a75, a7r3, a7r4, a7r5, a7s2, a7s3`

To learn how to calibrate your own lens, go to [🏁 **Lens calibration**](https://docs.gyroflow.xyz/app/getting-started/lens-calibration)

To learn more about advanced lens profile features, like the output projection for very wide lenses, lens breathing compensation and zoom lenses, see [🔭 **Advanced usage -> Lens profile**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles).

### Motion data

This section contains the motion data for the actual stabilization. For most common use cases, it will be automatically loaded from the video file. If you want to use a different motion data source (like external gyro logger, drone blackbox or a different camera), you can load the motion data file here.

For more details about using external motion data file, go to [🌀 **Using external gyro source**](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source).

If your video has no motion data, or the motion data is bad, enable **Optical correction** and click **Analyze**, to measure the camera motion from the video. Read more in [🎬 **Advanced usage -> Input data**](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).

### Once you have all the input files loaded, proceed to the [📈 Timeline and gyro chart](https://docs.gyroflow.xyz/app/getting-started/basic-usage/timeline-and-gyro-chart)

[^1]: frames per second


# Timeline & Gyro Chart

The main tool to determine correct synchronization is the timeline with motion data chart.

In the bottom section of Gyroflow, you can see the timeline, which shows the loaded motion data. This is a very important tool to determine correct synchronization, so make sure you learn how to use it.

It contains 4 layers of data:

1. Darker lines, filling entire chart - this is the motion data as recorded by the camera.
2. Lighter lines, they show up only after running autosync, and only at specified points - this is the motion data calculated from optical flow by analyzing the video pixels visually. This data always corresponds to the video and is not affected by sync points.
3. Sync points - vertical lines with time values below them. This is the time offset by which the motion data is shifted to match the video movement.
4. Dynamic zooming percentage - the bottom half of the chart shows a very light, filled overlay - this is the amount of zoom at a particular video time.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FRGqCIRmm4UiMeY3dAP7H%2Ftimeline3.png?alt=media&amp;token=51de373f-eaa9-47bc-b708-ad281f160a3c" alt=""><figcaption><p>Timeline elements overview</p></figcaption></figure>

{% hint style="info" %}
When using **sync-less video files (GoPro Hero 8+, DJI, Sony, Blackmagic RAW, RED, Z CAM, Xtra & Insta360)** you can skip this part entirely, as the synchronization is already correct and accurate, and no additional sync points should be added.
{% endhint %}

**The goal is to have the lighter lines lined up with the darker lines.**

In order to do that, synchronization points need to be added, which shift the darker lines in time (left or right on the chart).

## Zooming and panning

To see what's actually going on on the chart, you'll need to zoom it in. Use:

* **mouse wheel** to zoom in and out horizontally
* **Alt + mouse wheel** (on macOS: Option + scroll) to zoom in and out vertically
* **middle mouse button** drag or **Ctrl + mouse wheel** (on macOS: scroll sideways, e.g. with two fingers on the trackpad) - to pan the view left and right
* **double click** to reset the zoom

{% embed url="<https://gyroflow.xyz/demo/docs/?v=timeline-zoom-pan>" %}
Example of zooming in to inspect the sync points
{% endembed %}

{% hint style="info" %}
If you see minor shift of the lighter lines, but it roughly matches (like on the above example), this is usually fine and expected - trying to align it manually to perfectly cover the lines may actually make it worse. You should mostly rely on the autosync.

Because of rolling shutter effects, the lines won't be perfectly aligned on chart when the sync is perfect, so first of all you should check if your video is stabilized by playing it, instead of aligning the lines with each other at all costs.
{% endhint %}

## Context menu

#### Auto sync here

Analyze the video visually here and produce optical flow motion data and a sync point. The amount of time to analyze is specified by *Synchronization -> Advanced -> Time to analyze per sync point*.

This option will run the optical flow algorithm and show the resulting motion data as lighter lines on the chart. It will then try to calculate the correct sync point using that data. You will usually use this option to add new optical flow data to the chart and produce a new sync point.

This may also produce a bad sync point. You can then remove the bad sync point and use other techniques to align the chart or assess the correctness of the sync using the produced lighter lines, which will remain on the chart.

{% hint style="info" %}
The main **Auto sync** button in the Synchronization section (on the right) just picks a few points in the video and calls "Auto sync here" at these points, so these functions are equivalent.
{% endhint %}

Keyboard shortcut: `a`

#### Add manual sync point here

This option can be used to add a new sync point without running autosync or optical analysis - it can be used to shift the motion data manually by using the slider below the sync point. It's usually not recommended to use this option.

Keyboard shortcut: `p`

#### Guess IMU orientation here

If your motion data is facing a different direction than the video and lines on the chart don't align (or have different colors when aligned) - you'll need to determine correct IMU orientation. You can use this option to attempt to guess the correct IMU orientation. Read [**🔀 IMU orientation and rotation**](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation) to learn the exact process. After changing IMU orientation, remove all sync points and do the synchronization again.

#### Estimate gyro bias here

Estimating gyro bias can help achieve better stabilization results. To estimate the bias, you'll need to have a moment in your video where the camera is not moving at all. In the FPV case it can be before take off. After estimating bias, remove all sync points and do the synchronization again.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FPmilXgfcMcpjn2S1CLuq%2F20230218023727_1.gif?alt=media&amp;token=e577a467-2871-495d-8721-7a18bc164b26" alt=""><figcaption><p>Gyro bias estimation</p></figcaption></figure>

#### Estimate rolling shutter here

This function was created to help estimating the rolling shutter value, but in practice it's rarely accurate and its use is discouraged. Read more about figuring out the rolling shutter time on the [**🔥Stabilization -> Rolling shutter correction**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization#rolling-shutter-correction) page.

#### Delete all sync points

Removes all sync points, e.g. before syncing again after changing the settings listed in [Settings that affect the synchronization algorithm](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization#settings-that-affect-the-synchronization-algorithm).

#### Trim range

**Add new range** adds another trim range here, **Delete this range** removes the one under the playhead, and **Clear all** removes all of them. **Restrict playback to trim range** (on by default) keeps the playback within the trim range.

#### Chart display mode

The motion data chart can show 4 different data sources: Gyroscope, Accelerometer, Magnetometer and Quaternions

Quaternions are always available because they are either provided by the camera, or created from Gyroscope and Accelerometer by using a *sensor fusion* algorithm. For example most DJI cameras contain only Quaternions without gyro data, because the *sensor fusion* is ran inside the camera.

Gyroscope readings represent a speed of rotation (rotating up/down/right/left) and Accelerometer readings represent acceleration, including gravity (so they show which way is down). By using these values over time, we can calculate the quaternion - a 3d camera orientation in space, and that is used for all stabilization algorithms in Gyroflow.

{% hint style="info" %}
In the quaternion chart mode, lighter lines represent **smoothed orientation**, instead of optical flow data.
{% endhint %}

Buttons on the left and right can be used to show or hide the display of axis or zooming data. This does not affect any stabilization settings.

### Sync points debug layer

The fourth button on the right \[`S`] can be used to show the sync points line fit that is used to calculate sync point colors. It will also show the offset value visually on the chart. It can be useful for debugging the synchronization.

## Zooming information

The bottom half of the chart contains dynamic zooming information - it's the light filled overlay on the chart, and it indicates how much a video is zoomed in at that time. It can be enabled or disabled by clicking the "Z" button on the left side of the chart.

If you increase FOV value to more than 1 or disable dynamic zooming, the chart will also show a red overlay. This indicates that the video is showing the background at that time, i.e. source video pixels don't cover the entire output frame at that time.

## Focal length

If the file records the focal length of every frame (e.g. a zoom lens on Sony, Canon, Blackmagic, RED, Nikon or Z CAM), there's also an **FL** button on the left side of the chart. It shows the original focal length and the smoothed one (when **Stabilize focal length** is enabled in the Stabilization panel).

## Sync points

Read about sync points on the [**⌛ Synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization) page.


# Synchronization

Accurate synchronization is the most important step in Gyroflow to get good results.

## What is synchronization?

Synchronization in Gyroflow is the process of adding sync points - the time offset between motion data and video data.

Most cameras record the motion data outside of the video pipeline and this causes time difference between capturing actual pixels and capturing camera position. In order to compensate for that, we have to figure out that time offset so Gyroflow can know exactly where the camera was at a particular pixel of the video.

{% hint style="info" %}
Synchronization is needed for all cameras except **GoPro Hero 8+, DJI, Insta360, Sony, Blackmagic RAW, RED, Z CAM and Xtra**.
{% endhint %}

{% hint style="info" %}
If the video has no motion data at all, there's nothing to synchronize. Since Gyroflow 1.7.0, **Auto sync** on such a file runs the optical analysis instead, which measures the camera motion from the video. Read more in [**Optical correction**](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction).
{% endhint %}

{% hint style="warning" %}
When using internal gyro data, the time offset will never be larger than 1 second (1000 ms). Usually even less than ±200 ms.

When using external gyro data, the offset can be arbitrary and it's the time between starting recording of the motion data and video file.
{% endhint %}

Synchronization works by analyzing the video visually, using an optical flow algorithm to recreate the camera motion from pixels. Once that motion is calculated, it tries to match the motion data from file with the motion data from optical flow. It then adds a sync point with the value (time offset) that makes these two motions overlap.

Estimating motion from optical flow is not accurate and depends on a lot of factors, so sometimes this algorithm will fail and produce bad sync point. It is therefore important for you to learn how to detect that and correct it.

Before you attempt to sync, you also need to have proper [**🔀 IMU orientation and rotation**](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation) set. It is usually correct by default, but keep that in mind. Autosync can't work if your motion data doesn't correspond to the video motion. Sometimes you can determine the IMU orientation during the syncing (an example of that is in the Examples section on this page).

## Sync points

A sync point is a time offset by which the motion data should be shifted in either positive or negative direction, to align properly with the video data. Each sync point has a value (time offset in milliseconds). If you have multiple sync points on the timeline, the time offset is interpolated between them.

{% hint style="danger" %}
**Very important!** All sync points should have similar values. Sometimes the values will be linearly increasing or decreasing, and sometimes they will be very similar, but in general you can't have multiple sync points with contradicting values. For example, 3 sync points with values 10, -50, 70 is definitely wrong, but 3 sync points with values 10, 12, 16 is plausible. 10.5, 11, 10.7 is also plausible because they are very close to each other.

More examples:\
\
**BAD:** 0.5ms, -100ms, -150ms, 20ms\
**BAD:** -120ms, -130ms, 25ms, -150ms *(the 25ms is the contradicting one)*\
**BAD:** 1500ms, 120ms, 45ms, 5ms\
\
**GOOD:** -1400ms, -1405ms, -1407ms, -1408ms\
**GOOD:** 49.5ms, 50ms, 50.5ms, 51ms\
**GOOD:** 20.4ms, 20.4ms, 20.2ms, 20.0ms
{% endhint %}

### Sync point colors

All sync points have a color ranging from green to red. In general, green means a good sync point, and red means bad sync point. If you have multiple green points and one red - delete the red one.

It may also happen that the red sync point is actually correct, because you have one correct point and 4 bad points.

The color is based on line fit on the time offsets, so it indicates how linear all the points are.

**This is not a definitive indicator!** It may help troubleshoot but if your video plays correctly, even red sync point can be actually fine. This is especially important with RunCam cameras where this indicator doesn't work at all and should be ignored.

The most common usage will be to use "**Auto sync here**" to create a sync point, and right click + "**Delete sync point**" to remove it. Adjusting sync point value manually can be done by clicking on it and using the slider that appears below it (or the value field next to the slider), but should generally be avoided and autosync should be used instead.

You can also right click on the sync point and choose "Zoom in and loop", to create a trim range around the sync point and zoom in the chart. You can then adjust its value and watch the video until it's synchronized correctly.

## Getting good sync points

The synchronization algorithm works best in places where there is significant motion in all directions. If you have these places in the video, they are preferred to pick.

The algorithm doesn't work in places where there is no motion, or very little, because it doesn't have enough information to estimate camera movement visually at these places.

If you're not getting good sync points, make sure the **Sync search size** parameter covers possible offset range. Like mentioned before for internal gyro data it should be within 1s, and for external gyro data it will be the time you waited between recording gyro and video.

Usually 2-3 sync points are enough and the recommended amount for good quality cameras is 3. In certain challenging situations you will need more sync points, maybe 10 or even more.

## How to check if my synchronization is accurate?

The best way to check if a sync point is accurate it to just play the video at that time. You can create a trim range around the sync point to loop the video on it. If the video is stabilized then you're good. If not, then zoom in on the chart and make sure the lighter lines overlap the darker lines. If they don't, remove that sync point. If you don't see lighter lines, right click there and choose "Auto sync here".

Keep in mind that other sync points can affect this sync point. For example, if your video is 10s long and you have a correct sync point of 5 ms in the middle, but then have a sync point with -7000 ms, then the entire data will be stretched and won't be correct even at that one 5 ms sync point.

If you want to rely on the sync point colors, you'll need to have more than 2, because 2 sync points are always linear, and the colors show how linear all the offsets are.

## Examples

**`TODO:`**` `` ``Add examples `

## Figuring out the offset manually

If everything else fails, there's also an option to figure out the offset manually. You can right click on the timeline and **Add manual sync point here**, and then you can click on the point and adjust the value using the slider below it, or the value field on the right of the slider.

By moving the slider or entering a different value, you'll see the gyro data moving left or right on the chart. You can then try to match it with the optical flow, or (if optical flow failed) you can change the value in intervals and observe the video visually until it's stable.

The slider covers the current value plus or minus that value (but at least ±15 ms), so the larger the time offset, the larger the range of the slider. You can enter any value in the value field, and the range of the slider will adjust.

**`TODO:`**` `` ``example with optical flow `

**`TODO:`**` `` ``example video without optical flow `

## Settings that affect the synchronization algorithm

If you edit any of the following settings, you have to run the autosync again, because it depends on these values: **Motion data low pass filter, rotation, bias, IMU orientation, integration method and rolling shutter correction**.

Remove all sync points after changing these settings and run the autosync again.

## Synchronizing external gyro source

When using external gyro source, the most important parameter is the **Sync search size.** It is the possible range of a sync point, i.e. no sync point can be larger than this value.

The second parameter is **Rough gyro offset.** It's an initial guess (by you) of the offset. For example, if you know that you started recording gyro data, waited 30 seconds and then you started recording video, the rough gyro offset would be 30s.

If you know that you started recording both at the same time, leave **Rough gyro offset** at 0s.

These two parameters work together. The scanned range is from `rough_offset - search_size` to `rough_offset + search_size`. For example:

| Rough gyro offset | Sync search size | Scanned range |
| ----------------- | ---------------- | ------------- |
| 0s                | 5s               | -5s to 5s     |
| 15s               | 2s               | 13s to 17s    |
| -30s              | 10s              | -40s to -20s  |

Read more on the [**🌀 Using external gyro source**](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source) page.


# Stabilization

In the Stabilization tab, you can control all parameters related to the stabilization and zooming.

## FOV

Field Of View - this value can be though of as a zoom slider. For most use cases, it should stay at 1.0. With Dynamic Zooming enabled, the value of 1.0 will ensure that the stabilization uses the maximum possible pixels while not showing any black bars/sides.

If you increase it over 1, you'll zoom out the video and show the outer frame, you can use that to see what stabilization is doing.

If you decrease it below 1, you'll zoom in the footage.

## Smoothing algorithm

Gyroflow ships with 4 smoothing algorithms (**No smoothing**, **Default**, **Plain 3D** and **Fixed camera**), but for 99.5% use cases the **Default** algorithm should be used.

There are two common issues related to the selected algorithm:

1. Video turns black when stabilization is enabled - most likely you have **Fixed camera** selected. Change to **Default**.
2. Video zooms in too much - most likely you have **Plain 3D** selected. Change to **Default**.

You can learn more about other algorithms and when they are useful in the [**🔥Advanced usage -> Stabilization**](https://docs.gyroflow.xyz/app/advanced-usage/stabilization) section.

## Smoothness amount

This is the main slider to control amount of camera movement smoothing, from 0 to 1. Values close to 0 keep almost all of the camera movement, and higher values make your footage more smooth.

Remember that more smoothing requires more zooming, so you have to find a good balance between smoothness and zooming. The default of **0.5** works well for most cases.

## Horizon Lock

You can activate the horizon locking function here. The resulting video will keep the horizon level, while stabilizing other axes. This will cause the video to zoom in more, because Gyroflow will have less pixels to work with when the frame is rotated to keep the horizon level.

The effectiveness of this function is depending on the camera motion data. Some cameras have accurate orientation information, and some have worse. It will also depend on the selected **Integration method**, so if you're not getting good results, you can try to change the **Integration method** to something else. Note that in some cases, accurate horizon lock will not work, due to not enough, or bad data provided by the camera.

In some cases, you will be able to adjust the roll value using **Roll angle correction** slider to keep your horizon levelled, and if you're still not getting good results, you can also [**🔑 keyframe**](https://docs.gyroflow.xyz/app/advanced-usage/keyframes) the roll adjustment over time.

Some cameras also contain gravity vectors, which is additional data useful to lock the horizon. In that case there will be a checkbox to **Use gravity vectors**. Note that this will not always be better option, so you have to test your case.

Since Gyroflow 1.7.0, there are two more options:

* **Lock pitch angle** - also holds the camera tilt (up/down) at a fixed angle, which you can adjust with **Pitch angle correction**. It's not available when using gravity vectors.
* **Automatic lock** - lets the horizon lean into turns when the camera rolls faster than a threshold, like in a banked turn. Read more in [**🔥Advanced usage -> Stabilization**](https://docs.gyroflow.xyz/app/advanced-usage/stabilization#automatic-horizon-lock).

Some people like to keyframe the horizon locking amount to only apply to some parts of the video, so you can use keyframes to do that too. Read more about keyframes in the [🔑 **Advanced -> Keyframes**](https://docs.gyroflow.xyz/app/advanced-usage/keyframes) section.

## Zooming

With post-stabilization, we only have as much information as the sensor captured. If we move these pixels around, we'll end up missing some information on the sides. Because of that, applying the stabilization only will result in moving empty sides around the video.

To compensate for that, we need to zoom in the image to show the available pixels only. This is also referred to as cropping.

Gyroflow has 3 available zooming modes:

1. **No zooming** - This mode simply disables all zooming and applies only the stabilization.
2. **Dynamic zooming** - In this mode, the zoom amount will be dynamically changing throughout the video to use as much pixels as we have available. Some parts of the video will need to be zoomed in more and some less, and this mode creates smooth transition between these zoom levels.
3. **Static zoom** - this mode will apply one, static crop for the entire duration of the video. This will remove the zooming in-and-out effect. With **Zoom level** set to **Automatic**, it uses the maximum needed zoom level (up to the zoom limit), thus cropping the video a lot. It may work in some cases if there is not much movement, but it's generally recommended the use the *Dynamic zooming* mode instead (and if you want to avoid the visible zooming in-and-out effect, use high zooming speed, like 20-30s).

### Fixed zoom level

Since Gyroflow 1.7.0, you can set **Zoom level** to **Manual** in the **Static zoom** mode. Every video is then zoomed in by exactly the amount you set in **Zoom**, like in-camera stabilization, so you know the framing while shooting. The smoothing is lowered only where the frame wouldn't fit otherwise. If even that isn't enough, the video is zoomed in further and a warning is shown.

### Zoom limit

With the **Default** and **Plain 3D** smoothing algorithms, **Zoom limit** sets the maximum zoom. Where the stabilized frame would need more zoom, the smoothing is lowered instead.

Since Gyroflow 1.7.0, with **Static zoom**, the smoothing is lowered only around the moments that don't fit, instead of in the whole clip. The old behavior is available in `Stabilization -> Advanced -> Zoom limit lowers the smoothing of the whole clip`, and projects from older versions open with it enabled, so they look the same.

### Zooming speed

This is the amount of time it takes to transition from one zoom level to another, meaning the the shorter the time, the faster the zooming will be. You can see that by setting this value to 0.1s.

The usual values are ranging from 2s to 5s. Setting longer value will make your zooming changes throughout the video slower, but that also means it will stay zoomed in for longer period of time. Adjust this value to your taste.

You can also switch the zooming method from **Envelope follower** (default) to **Gaussian filter** in `Stabilization -> Advanced -> Zooming method`. It may look more natural in some cases, but you'll have to test for yourself. You can see how the zooming level changes on the chart by observing the zooming level graph (light overlay as described in the [📈 **Timeline and gyro chart**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/timeline-and-gyro-chart) section).

Read more about advanced zooming options in [**🔥Advanced -> Stabilization**](https://docs.gyroflow.xyz/app/advanced-usage/stabilization).

## Stabilize focal length

If the file records the focal length of every frame (e.g. a zoom lens on Sony, Canon, Blackmagic, RED, Nikon or Z CAM), you can enable **Stabilize focal length** to smooth out fast zooms and zoom "pumping". Fast zooms are spread out by cropping, while zooms slower than **Max zoom speed** pass through unchanged. Lower values give a smoother zoom and more crop.

You can see the original and the smoothed focal length on the chart, by clicking the **FL** button on the left side of the timeline.

## Rolling shutter correction

Rolling shutter correction is a very important part of accurate stabilization process. Most digital cameras have rolling shutter sensors, meaning that the image is not captured all at once, but it is read sequentially from top to bottom. This makes the captured video prone to skews and wobbles when the side-to-side motion is significant. You can observe this effect by quickly panning left-right with your camera and looking at straight lines - they will be bent. You can learn more about rolling shutter [here](https://en.wikipedia.org/wiki/Rolling_shutter).

To compensate for that, Gyroflow needs to know the **Frame readout time** which is the time it took the sensor to capture the entire image. Some cameras have this value built-in, and some cameras have rolling shutter already corrected in the camera (e.g. GoPro). There are also cameras with global shutter which don't create this effect, but they are rare (one example is RED KOMODO).

All other cameras need to have this option enabled and the **Frame readout time** correctly filled in.

#### Example of rolling shutter distortions

**`TODO:`**` `` ``add video `

#### How to determine the frame readout time?

It's best to determine the value when doing lens calibration and save that value with the lens profile. You can read how to do that on the [🏁 **Lens Calibration**](https://docs.gyroflow.xyz/app/getting-started/lens-calibration) page.

Otherwise, you can google the camera lab test, which usually have the frame readout time tested and provided. It is sometimes (but rarely) also provided by the camera manufacturer.

You can also try to simply eyeball it. Due to it's nature, the value can only have limited range, so you can move the slider from 0 to max and see if your footage looks better. It's best to have the footage synchronized already (more or less) to observe just the rolling shutter correction.

{% hint style="warning" %}
Frame readout time affects synchronization, so make sure you synchronize your footage again if you change this value.
{% endhint %}

Frame readout time will also be different depending on the camera shooting mode (e.g. in 4k vs 1080p).

{% hint style="info" %}
If you're using **Sony, GoPro, Insta360, DJI, Canon, Z CAM or Blackmagic RAW**, then you don't have to worry about it as it's handled automatically.
{% endhint %}

### For more control over stabilization settings, see the Advanced section:

{% content-ref url="/pages/gicbKPwWT1dNQ45A32Yt" %}
[Stabilization](https://docs.gyroflow.xyz/app/advanced-usage/stabilization)
{% endcontent-ref %}


# Exporting

Once you have stabilization working well and you're satisfied with the results, you can proceed to export the stabilized video file.

## Render range

You can set the desired section of your video to be rendered by setting the Trim range on the timeline. You can use `[` and `]` buttons or `i` and `o` keys to set the start and end of the range you want to export.

You can also add more trim ranges with `Ctrl+[` and `Ctrl+]` (or `Ctrl+I` and `Ctrl+O`), or by right-clicking on the timeline and choosing `Trim range -> Add new range`. They're exported as one video, or as separate videos with **Export trim ranges as separate videos** in `Export settings -> Advanced`.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FEyxhQtjYMmHnu77LtWuf%2Fimage.png?alt=media&amp;token=dcc73503-f4c4-4c2d-bd17-ccfd279111f4" alt=""><figcaption><p>Trim range</p></figcaption></figure>

## Output path

You can enter the desired location and file name for the output file at the bottom of Gyroflow, in the `Output path` area

## Export codec

<table><thead><tr><th width="176">Codec</th><th>Description</th></tr></thead><tbody><tr><td><strong>H.264/AVC</strong></td><td>Most widely supported codec. It should work on all computers, mobile phones and on the web. Faster to render than H.265 but less efficient.<br><br>Hardware accelerated encoder supports only 8-bit files with this codec. When you open a 10-bit video, Gyroflow switches to H.265 by default.</td></tr><tr><td><strong>H.265/HEVC</strong></td><td>Newer and more efficient codec than H.264/AVC. Requires more processing power to encode and to decode. If you have older hardware, it's possible HEVC file will be hard to playback. In this case choose H.264.<br>If your hardware supports it well, you can prefer it over H.264, as it delivers better quality at the same bitrate.<br><br>Supports 10-bit encoding with hardware (depending on the GPU).</td></tr><tr><td><strong>AV1</strong></td><td>Newer and more efficient than H.265/HEVC (available since Gyroflow 1.7.0).<br><br>It can only be encoded on the GPU, so it needs an NVIDIA GeForce RTX 40, AMD Radeon RX 7000, Intel Arc or newer GPU (Windows and Linux), or a phone that can encode AV1 (Android). It's not available on macOS and iOS. If your GPU can't encode AV1, Gyroflow tells you when you select it.</td></tr><tr><td><strong>ProRes</strong></td><td>Professional video codec, especially good for working on the files later in a video editor (it's fast to decode). Good for maintaining maximum video quality.<br><br>Hardware acceleration for ProRes is available only on macOS with M1 Pro/Max/Ultra (but not the base M1) and M2 or newer chips (including the base M2).</td></tr><tr><td><strong>DNxHD</strong></td><td>Similar to ProRes. No hardware acceleration is available.</td></tr><tr><td><strong>CineForm</strong></td><td>Similar to ProRes and DNxHD. No hardware acceleration is available.</td></tr><tr><td><strong>EXR sequence</strong></td><td>Image sequence in the <code>.exr</code> format. Data is stored as 32-bit float. Compression is lossless.</td></tr><tr><td><strong>PNG sequence</strong></td><td>Image sequence in the <code>.png</code> format. Data is stored either as 8-bit or 16-bit. Compression is lossless.</td></tr></tbody></table>

## Output size

You can control the exported resolution here. If you want to output a different size or aspect ratio, you can enter it here.

The settings icon next to the size opens the output size presets, grouped by aspect ratio. **Proportional** is the largest size of that aspect ratio that fits in the original video, and **Based on "Max zoom"** is that size reduced by the current maximum zoom, so the stabilized video isn't upscaled. You can change the list with **Edit sizes**.

If you want to change the aspect ratio (e.g. 4:3 source rendered as 16:9 video), you can also do that here. The resulting resolution is the rectangle that the stabilized video can move around in. Therefore it also affects the stabilization, it's not a static crop.\
\
If you have a horizontal video and want to output 9:16 for social media, you can set 9:16 resolution here. It's also common to keyframe the yaw of the additional rotation (`Stabilization -> Advanced -> Additional 3D rotation`) and move the video right-left to keep the subject in frame.

## Bitrate

Bitrate is the amount of data stored in a second of the video. Bigger bitrate will produce better quality and bigger file size. By default Gyroflow sets the same bitrate as the input file.

## GPU encoding

Video encoding is a very compute-intensive task. Rendering on the CPU[^1] is very slow.

Modern graphic cards implement hardware accelerated video encoders and is generally preferrable to have GPU encoding enabled.

Support for codecs and modes varies greatly between GPU brands and models, for more information refer to specific guides for [NVIDIA](https://docs.gyroflow.xyz/app/hardware-acceleration/nvidia), [AMD](https://docs.gyroflow.xyz/app/hardware-acceleration/amd), [Intel](https://docs.gyroflow.xyz/app/hardware-acceleration/intel), [macOS ](https://docs.gyroflow.xyz/app/hardware-acceleration/apple-macos)or [Android](https://docs.gyroflow.xyz/app/hardware-acceleration/android). If you don't know what GPU you have, refer to your computer specifications.

If your computer is older than 2016, chances are H.265/HEVC will not be available, and if it's older than 2012, H.264 may also not be available.

If you want maximum possible encoding quality and don't mind waiting, you can disable GPU encoding. Rendering on the CPU in general provides better results, but it's much slower.\
For most use cases the difference will be negligible and enabling GPU encoding is preferred.

## Audio

Audio can be exported as well, and it will be transcoded to AAC or PCM format. You can choose the format in `Export settings -> Advanced -> Audio codec`.

Since Gyroflow 1.7.0, you can also choose **Copy** there, to keep the original audio without re-encoding it. If the output format can't store the original audio codec, AAC is used.

## Advanced

For advanced options, see the `Advanced usage -> Exporting` section

{% content-ref url="/pages/RGwJ8fOjtBqItbUdPR2n" %}
[Exporting](https://docs.gyroflow.xyz/app/advanced-usage/exporting)
{% endcontent-ref %}

## Exporting

Once you have all settings dialed in, you can proceed to render by just clicking the blue `Export` button.

Render queue is available by clicking the icon on the right of the `Export` button. You can add your render task to the queue by clicking the arrow on the `Export` button and choosing `Add to render queue`

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FFIxuuB30esLCGyZTd7kp%2Fimage.png?alt=media&amp;token=2d61f3e9-48b1-48fa-9d41-2deaf2110616" alt=""><figcaption><p>Render queue icon</p></figcaption></figure>

For more information about the render queue, see the `Advanced usage -> Render queue` section

{% content-ref url="/pages/LEO7IIHCWGekERTsj1ML" %}
[Render Queue](https://docs.gyroflow.xyz/app/advanced-usage/render-queue)
{% endcontent-ref %}

## Saving the project file

You can export a project file which will contain all your settings, lens profile and optionally the gyro data. You can then load that project file later if you want to adjust any settings and re-render.

There's a `Ctrl + S` keyboard shortcut available to quickly save the project file with gyro data included. The resulting file also works with the video editor plugins.

## Exporting data for the plugins

You don't have to render out the file from Gyroflow, you can also use the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow) and apply the stabilization directly in your video editor. For more information see the `Video editor plugins` section

{% content-ref url="/pages/CbozEJNjsF6laIy4ZbSl" %}
[General Plugin Workflow](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow)
{% endcontent-ref %}

[^1]: computer processor


# Common Filming Tips & Issues

## Shutter speed, ND filters and motion blur

For any electronic stabilization it's best to avoid motion blur. This means that you have to use high shutter speed and avoid ND filters if the lighting conditions allow it.

Motion blur can't be removed in post, so if you capture it in camera, then you stabilize it later, that "motion" will remain in the original direction, while your video will have a different (stabilized) motion. This creates an ugly-looking effect and in some cases ruins the footage. This also applies to the internal Hypersmooth stabilization.

Here's an example of bad motion blur after stabilization:

{% embed url="<https://youtu.be/0Clu7SaMTZw>" %}

You might not notice this effect in your original footage, because motion blur follows the motion you're seeing so it looks natural. Once you stabilize the footage, the frame motion is changed (stabilized) but the motion blur remains in the original direction, and this creates a dissonance in your brain (because it no longer matches the motion)

If you use high shutter speed to capture sharp frames, you can the freely move them around to stabilize without risking these artifacts. You can then add motion blur in post, after stabilization, in your video editor. A great plugin for motion blur is [ReelSmart Motion Blur](https://revisionfx.com/products/rsmb/). You can also use built-in tools eg. in DaVinci Resolve or in Adobe After Effects (Pixel Motion Blur)

### 180° shutter speed rule

A common rule in filmmaking is to use 180° shutter speed (i.e. twice the frame rate, e.g. 1/60 when shooting 30 fps). However **that rule doesn't work when using any kind of digital stabilization.**

Shooting with 180° shutter speed is good when your camera is physically stabilized, on a 3-axis gimbal, a crane, slider etc. This is commonly used in filmmaking because movie sets do have the cameras physically stabilized, the shots are planned and the camera motion is predictable.

This rule doesn't work for scenarios like FPV drones, mountain biking, running or basically any action-camera type of shots, where the camera is shaking a lot. It can only work if you fly very smoothly and the stabilization is needed only to correct minor movements and not big shakes. A great example of an FPV video with motion blur where strong stabilization is not needed is [here](https://www.youtube.com/watch?v=VjvmY-0mk5s).

Using 90° or even 45° shutter will be much better choice if you want to use any post-stabilization.


# Lens Calibration

Lens calibration is a very important piece of the stabilization algorithm and it's very important to use accurate lens profile when stabilizing a video in Gyroflow.

The purpose of the lens calibration process is to accurately determine the *intrinsic* parameters of a camera system. This consists of:

* focal length
* lens distortions
* other misalignments during the imaging process.

The lens calibration process is divided into 2 steps:

## 1. Recording the calibration footage

1. Open Gyroflow, go to **Lens profile** -> **Create new -> Open calibration target**
2. Display the calibration pattern on a **flat** computer monitor (a curved display will **not** work), in full screen. In general, larger calibration patterns are preferred since focus will be closer to the focus during actual use, so use your largest screen/monitor. If you have a large flatscreen TV, it's preferred to display it on the TV (you can use HDMI, or the TV browser to open this page). A bright screen with a slightly darkened room works well.
3. Select the desired camera settings to calibrate for. Most importantly the field of view/focal length and aspect ratio, if applicable. Framerate and resolution doesn't matter, only if the resolution changes the field of view. Use high shutter speed to avoid motion blur, and make sure the calibration target stays in focus.
4. Record the pattern while slowly moving around to different angles and distances in one clip. 60 seconds is typically enough. Try to avoid motion blur and rolling shutter distortion with slow and steady movements, and make sure the full chessboard is in view. The following angles are recommended for getting distortion information from the full frame:
   * Chessboard filling whole frame
   * Chessboard seen from distance.
   * Chessboard seen at an angle.
   * Each edge of video frame aligned with edge of chessboard.
   * Corner of chessboard aligned with corner of video.
5. Finally, get fast motion for rolling shutter reference/estimation by doing a fast side-to-side yaw motions with the camera. This will produce rolling shutter effect where the lines will be bent, instead of straight.

Here's an example of a calibration footage that covers all needed angles:

{% embed url="<https://drive.google.com/file/d/1IplUxul0piiqeX90CsrWrquwKGVMLSNv/view>" %}

The calibration pattern can be displayed from the calibration utility. Alternatively, the default (14x8 radon) calibration pattern is available here:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fis3YxgukkDaS5XCGhENi%2Fcalibration_pattern_radon_14x8.png?alt=media&amp;token=b43d0ab3-c24c-4bfa-b19e-08beebf71283" alt=""><figcaption></figcaption></figure>

## Rolling shutter correction

Related to lens calibration is estimating the rolling shutter frame readout time. Most DSLR's and consumer-grade video cameras use a [rolling shutter](https://en.wikipedia.org/wiki/Rolling_shutter) sensors, which introduce warps and distortions in moving footage. It is highly recommended to get an accurate estimate of the rolling shutter *before* lens calibration and fill in the value in the calibration utility, but it can be done afterwards as well.

Please have a look at [gyroflow/rollingshutter](https://github.com/gyroflow/rollingshutter) for an accurate method of measuring rolling shutter or below for an estimated approach.

### A simple method of determining rolling shutter value

If your calibration video has matching gyro data, the following approach can be used to check the stabilization and estimate the rolling shutter visually. This method only works if the calibration clip had matching gyro data.

1. Load the same clip in main window, load the lens profile you just calibrated, sync the gyro with video.
2. Focus on that fast sideways motion part, go to **Stabilization** -> **Rolling shutter correction**, and move the slider until the rolling shutter effect is fixed, ie. the lines become straight and are not bent anymore. You may need to reverse the rolling shutter direction.
3. Edit your created lens profile json with notepad, and replace `"frame_readout_time": null,`, to e.g. `"frame_readout_time": 15.5,` (15.5ms is an example value). This value will automatically be applied when using this preset.

**`TODO:`**` `` ``add a video sample `

An alternative and much more accurate method doesn't require gyro data, but instead requires an Arduino+LED or similar to generate a precise blinking frequency at e.g. 1 KHz. If you have the hardware, this is recommended over the visual method since it's an order of magnitude more accurate. Read more at [gyroflow/rollingshutter](https://github.com/gyroflow/rollingshutter).

## 2. Analyzing the recorded calibration footage

1. Open Gyroflow, go to **Lens profile** -> **Create new.**
2. Open the previously recorded calibration video file.
3. Either begin auto calibration or manually add frames using `Add calibration point` from the timeline context menu. Note: **Skip the final fast side-to-side motion during this step, by setting the end of trim range just before it.**
4. After all required frames are added and processed, the straight lines should be straight in the undistorted video. `Reprojection error` should typically be under 5 (pixels) with excellent calibrations giving values below 1. The larger the video resolution the bigger this error can be.
5. Fill in the preset information and export the lens profile. Try to add all relevant information about the camera/lens combination including field of view setting and lens focal length if applicable.
6. If rolling shutter information is known in advance, fill in the frame readout time. For a global shutter camera, check **Sensor is global shutter** instead.
7. If a successful calibration was achieved with a low reprojection error and no obvious artefacts, the profile can be submitted with the `Upload lens profile to the database` checkbox.
8. You're now ready to use the new lens preset. These are stored as `.json` files.

## Distortion model and calibration method

Since Gyroflow 1.7.0, you can choose the **Distortion model** the lens profile is fitted to:

* **OpenCV fisheye** (default) - fisheye model (Kannala-Brandt). Right for action cameras, drones and any wide lens.
* **OpenCV standard** - pinhole with radial and tangential distortion. For rectilinear lenses with little distortion: it can't describe anything 90° or more from the center.
* **Generic polynomial** - fisheye model with both odd and even powers of the angle, for lenses the fisheye model doesn't fit well. It's always calibrated with Gyroflow's method.

You can also choose the **Calibration method**:

* **OpenCV** (default) - OpenCV's own calibration of the model, on random sets of frames. Its fisheye calibration can't calibrate a lens that sees more than 180°, and often fails close to it.
* **Gyroflow** - Gyroflow's own calibration, on all frames at once. With a fisheye model it also calibrates lenses that see more than 180°, and it leaves out frames that don't agree with the rest, like ones bent by the rolling shutter of a fast move.

Changing the model or the method fits the patterns already found again, without analyzing the video again, so you can quickly compare the results.

{% hint style="info" %}
To view the whole picture of a lens that sees more than 180°, change the **Output projection** in the main window. Read more in [🔭 **Advanced usage -> Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#output-projection).
{% endhint %}

## What about anamorphic lenses? <a href="#what-about-anamorphic-lenses" id="what-about-anamorphic-lenses"></a>

Refer to [Input stretch](#input-stretch)

## Video Guide <a href="#video-guide" id="video-guide"></a>

Nurk FPV's tutorial contains a calibration example:

{% embed url="<https://www.youtube.com/watch?t=453&v=QAds3x8UU1w>" %}

## Additional calibration options <a href="#additional-calibration-options" id="additional-calibration-options"></a>

### Default output size <a href="#default-output-size" id="default-output-size"></a>

Radial lens undistortion typically results in the image being stretched more in the horizontal axis (use the FOV slider to see this). For instance, undistorted 4:3 GoPro video:

![](https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FbpldJIprcw5VWg3Eqs0Q%2Fimage.png?alt=media\&token=760f356b-2050-48af-96a2-ce4440053156)

Notice that the area of the valid rectangle is close to a 16:9 aspect ratio as opposed to 4:3. In these cases, the default output size can be modified to a 16:9 one.

For cameras with minimal fisheye distortion, or even with pincushion distortion, the resulting valid aspect ratio is close to the original one. For these cameras, just use the input resolution for the default output size.

### Sharpness limit <a href="#sharpness-limit" id="sharpness-limit"></a>

Sets the minimum required sharpness for the calibration pattern (default 8 px, the width of the blurred edges). If the pattern failed to detect due to focus or blurriness, try increasing this limit.

### Input stretch

If the video file is not exact representation of a real world viewed through a physical, spherical lens, the calibration will not work. To fix that, we need to reverse any additional distortions or in-camera digital processing.

A common example of that is an anamorphic lens. In this case, you need to set the `Input horizontal stretch` to the squeeze factor of the anamorphic lens, to stretch the video horizontally and reverse the anamorphic distortion. This needs to be set before starting autocalibration process.

Another example is a digital processing in camera, like Superview/Hyperview in GoPro cameras, or XV mode in RunCam cameras.

In case of GoPro, the stretch is a custom equation and you can set `Digital lens` to `GoPro Superview`

In case of RunCam, the XV mode is a simple linear stretch, so to reverse its effect, enter `1.3333` in the `Input vertical stretch` field.

### Focal length and crop factor

If you know the focal length of the lens you're calibrating (most DSLR lenses), you should enter the focal length in that field in Advanced.

If you also know the crop factor (a factor that describes sensor size relation to full frame size), you can also enter it here


# Keyboard Shortcuts

on macOS, Ctrl in this table corresponds to the Command key

<table><thead><tr><th width="198">Shortcut</th><th>Action</th></tr></thead><tbody><tr><td><strong>Space</strong><br><strong>F3</strong></td><td>Play / Pause</td></tr><tr><td><strong>Left</strong><br><strong>Page Up</strong><br><strong>,</strong><br><strong>F2</strong></td><td>Previous frame</td></tr><tr><td><strong>Ctrl+Left</strong><br><strong>Ctrl+Page Up</strong><br><strong>Ctrl+,</strong><br><strong>F5</strong></td><td>Previous 10 frames</td></tr><tr><td><strong>Right</strong><br><strong>Page Down</strong><br><strong>.</strong><br><strong>F4</strong></td><td>Next frame</td></tr><tr><td><strong>Ctrl+Right</strong><br><strong>Ctrl+Page Down</strong><br><strong>Ctrl+.</strong><br><strong>F6</strong></td><td>Next 10 frames</td></tr><tr><td><strong>Home</strong><br><strong>H</strong></td><td>Go to trim start</td></tr><tr><td><strong>End</strong><br><strong>;</strong></td><td>Go to trim end</td></tr><tr><td><strong>I</strong><br><strong>[</strong></td><td>Set trim start here</td></tr><tr><td><strong>O</strong><br><strong>]</strong></td><td>Set trim end here</td></tr><tr><td><strong>Ctrl+I</strong><br><strong>Ctrl+[</strong></td><td>Add new trim range starting here</td></tr><tr><td><strong>Ctrl+O</strong><br><strong>Ctrl+]</strong></td><td>Add new trim range ending here</td></tr><tr><td><strong>C</strong></td><td>Clear trim range</td></tr><tr><td><strong>J</strong></td><td>Seek back 500 frames and play</td></tr><tr><td><strong>K</strong></td><td>Play/Pause and reset playback rate</td></tr><tr><td><strong>L</strong></td><td>Play forward, press multiple times to increase playback rate</td></tr><tr><td><strong>M</strong></td><td>Toggle mute</td></tr><tr><td><strong>S</strong></td><td>Toggle stabilization</td></tr><tr><td><strong>D</strong></td><td>Toggle stabilization overview</td></tr><tr><td><strong>V</strong></td><td>Toggle stabilization overview <strong>split view</strong></td></tr><tr><td><strong>A</strong></td><td>Auto sync here</td></tr><tr><td><strong>P</strong></td><td>Add manual sync point here</td></tr><tr><td><strong>Q</strong></td><td>Toggle render queue</td></tr><tr><td><strong>G</strong></td><td>Toggle grid guide</td></tr><tr><td><strong>Ctrl+G</strong></td><td>Toggle grid color (white/black)</td></tr><tr><td><strong>F11</strong><br><strong>F</strong></td><td>Enter full screen mode. Press twice for a different mode</td></tr><tr><td><strong>Ctrl+Q</strong></td><td>Add to render queue</td></tr><tr><td><strong>Ctrl+W</strong></td><td>Render now</td></tr><tr><td><strong>Esc</strong></td><td>Exit full screen mode</td></tr><tr><td><strong>Ctrl+S</strong></td><td>Save project file (with gyro data)</td></tr><tr><td><strong>Shift+Right</strong><br><strong>Shift+Page Down</strong></td><td>Next keyframe</td></tr><tr><td><strong>Shift+Left</strong><br><strong>Shift+Page Up</strong></td><td>Previous keyframe</td></tr><tr><td><strong>X</strong></td><td>Hide chart axis X</td></tr><tr><td><strong>Y</strong></td><td>Hide chart axis Y</td></tr><tr><td><strong>Z</strong></td><td>Hide chart axis Z</td></tr><tr><td><strong>W</strong></td><td>Hide chart axis W</td></tr><tr><td><strong>Shift+X</strong></td><td>Show chart axis X</td></tr><tr><td><strong>Shift+Y</strong></td><td>Show chart axis Y</td></tr><tr><td><strong>Shift+Z</strong></td><td>Show chart axis Z</td></tr><tr><td><strong>Shift+W</strong></td><td>Show chart axis W</td></tr><tr><td><strong>Shift+G</strong></td><td>Chart display mode: Gyroscope</td></tr><tr><td><strong>Shift+A</strong></td><td>Chart display mode: Accelerometer</td></tr><tr><td><strong>Shift+M</strong></td><td>Chart display mode: Magnetometer</td></tr><tr><td><strong>Shift+Q</strong></td><td>Chart display mode: Quaternions</td></tr><tr><td><strong>Ctrl+D</strong></td><td>Load next file in folder</td></tr><tr><td><strong>Ctrl+A</strong></td><td>Load previous file in folder</td></tr><tr><td><strong>Ctrl+Shift+D</strong></td><td>Save and open next item from render queue</td></tr><tr><td><strong>Ctrl+Shift+A</strong></td><td>Save and open previous item from render queue</td></tr><tr><td><strong>E</strong><br><strong>Ctrl+E</strong><br><strong>Alt+E</strong><br><strong>Shift+E</strong></td><td>Horizon lock roll adjustment +</td></tr><tr><td><strong>R</strong><br><strong>Ctrl+R</strong><br><strong>Alt+R</strong><br><strong>Shift+R</strong></td><td>Horizon lock roll adjustment -</td></tr><tr><td><strong>Ctrl+drag</strong> in render queue</td><td>Reorder items in the render queue</td></tr><tr><td><strong>Ctrl +</strong> click on the stabilization overview icon</td><td>Toggle stabilization overview <strong>split view</strong></td></tr><tr><td><strong>Ctrl +</strong> click on the previous/next frame buttons</td><td>Move by 10 frames</td></tr><tr><td><strong>Shift +</strong> click on the previous/next frame buttons</td><td>Go to previous/next keyframe</td></tr></tbody></table>

Shortcuts are defined in this file: <https://github.com/gyroflow/gyroflow/blob/master/src/ui/Shortcuts.qml>

## Tracked points editor

These shortcuts work when **Show/edit tracked points** is enabled in [Optical correction](https://docs.gyroflow.xyz/app/advanced-usage/input-data#tracked-points-editor):

<table><thead><tr><th width="198">Shortcut</th><th>Action</th></tr></thead><tbody><tr><td><strong>Delete</strong><br><strong>Backspace</strong></td><td>Remove the selected tracks</td></tr><tr><td><strong>Ctrl+Z</strong></td><td>Undo</td></tr><tr><td><strong>Ctrl+A</strong></td><td>Select all points in the frame</td></tr><tr><td><strong>Esc</strong></td><td>Clear the selection</td></tr><tr><td><strong>Shift +</strong> click or drag</td><td>Add to the selection</td></tr><tr><td><strong>Ctrl +</strong> drag</td><td>Select that part of the camera frame through the whole clip</td></tr></tbody></table>


# File Joiner

Most consumer cameras have a file size limit of 4 GB. If the recording is longer, it will be split into multiple parts. If you want to stabilize such split video, you'll have to merge the parts before stabilization.\
\
Gyroflow has a built-in tool to do that for you.

### GoPro

In case of GoPro files, it should detect the sequence automatically and ask you to merge the videos, when you load the first file from the sequence:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FUtrMXRUbSAVuVJII3d6o%2Fjoin1.png?alt=media&amp;token=0d953653-2b9e-4727-86df-26bf63d13da6" alt=""><figcaption></figcaption></figure>

You can also use [**ReelSteady-Joiner**](https://github.com/rubegartor/ReelSteady-Joiner) to merge GoPro files, or follow the guide [here](https://gopro.github.io/labs/control/chapters/).

You can prevent this from happening by using [GoPro Labs](https://gopro.github.io/labs/). It has a feature called [Large Chapters](https://gopro.github.io/labs/control/chapters/), and enabling it will make the camera record big video files over 4 GB, up to 12 GB.

### All other cameras

In case of all other cameras, you can simply drag & drop all files in your sequence to Gyroflow, and it will ask you if you want to merge them:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FSW9naBI6I4bze3KYZruD%2Fjoin2.png?alt=media&amp;token=2052b9f1-52d8-4900-b331-fb6c927658af" alt=""><figcaption></figcaption></figure>

When joining video files from RunCam cameras, which have corresponding `.gcsv` files, the `.gcsv` files with gyro data will also be automatically merged.

### Standalone tool

The Gyroflow file merger is also available as a standalone CLI tool: [**mp4-merge**](https://github.com/gyroflow/mp4-merge)


# FAQ

Frequently Asked Questions

{% hint style="info" %}
Most issues with settings can be solved by resetting them to defaults. Go to **Advanced** on bottom right and click <mark style="color:red;">**Reset all settings to default.**</mark>
{% endhint %}

## Where can I ask questions?

You can get support and ask all questions on [**Discord**](https://discord.gg/YaUtNpWTUh).

## Forcefully Reset Settings

Because Gyroflow development moves fast, and the software is constantly being updated and improved, it's possible that your Settings files can get corrupted, or contain bad data between updates. If Gyroflow fails to open, or you're having crashes on launch, you can try forcefully trashing your settings, to give Gyroflow a fresh slate:

{% tabs %}
{% tab title="Mac" %}
Open the `Terminal.app` and enter the following command:

`rm -f "$HOME/Library/Application Support/Gyroflow/settings.json"`
{% endtab %}

{% tab title="Windows" %}

1. Open file explorer and enter this address: `%localappdata%/Gyroflow`
2. Delete the `settings.json` file
   {% endtab %}

{% tab title="Linux" %}
Open Terminal and enter:

`rm -f $HOME/.local/share/Gyroflow/settings.json`

With the Flatpak, the file is `~/.var/app/xyz.gyroflow.Gyroflow/data/Gyroflow/settings.json`.
{% endtab %}
{% endtabs %}

## GPU encoding is not available or not working

Support for codecs and modes varies greatly between GPU brands and models, for more information refer to specific guides for [NVIDIA](https://docs.gyroflow.xyz/app/hardware-acceleration/nvidia), [AMD](https://docs.gyroflow.xyz/app/hardware-acceleration/amd), [Intel](https://docs.gyroflow.xyz/app/hardware-acceleration/intel), [macOS ](https://docs.gyroflow.xyz/app/hardware-acceleration/apple-macos)or [Android](https://docs.gyroflow.xyz/app/hardware-acceleration/android). If you don't know what GPU you have, refer to your computer specifications.

**Always make sure you have the latest GPU driver.**

If your computer is older than 2016, chances are H.265/HEVC will not be available, and if it's older than 2012, H.264 may also not be available.

H.264 doesn't support 10-bit GPU encoding, and ProRes is accelerated only on Macs with M1 Pro/Max/Ultra, or M2 and newer.

## I'm using O3/O4 Air Unit and I have a lot of vibrations after stabilizing

Try to reduce the vibrations in hardware first (e.g. soft mount the camera). If you can't, enable **Optical correction** in the Motion data panel and click **Analyze** (since Gyroflow 1.7.0). Read more [**in the DJI section**](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/dji#dji-o3-o4-air-unit-vibration-issues).

## I see only black screen when stabilization is enabled.

Most likely you have **Fixed camera** method selected in the Stabilization section. Change to **Default** or use **Advanced -> Reset all settings to default** (on the bottom right)**.**

## I'm getting a crash when trying to export and I'm using macOS with Intel processor

Go to **Advanced -> Device for video processing** and select one starting with **\[wgpu]**

## **I'm having trouble stabilizing a RunCam camera**

Refer to the [**RunCam section**](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/runcam). Make sure to learn the synchronization process by reading [**🔧 Basic usage**](https://docs.gyroflow.xyz/app/getting-started/basic-usage), [**📈 Timeline and gyro chart**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/timeline-and-gyro-chart) and [**⌛ Synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization).

## Colors are changed after exporting from Gyroflow

Read about this issue on the [**🎨 Color differences**](https://docs.gyroflow.xyz/app/advanced-usage/color-differences) page.

## My video is zoomed in too much

Make sure to use **Default** algorithm in the Stabilization section. Read more on the [**🔥 Stabilization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization) page.

## I'm seeing black bars around my video

Enable **Dynamic zooming** in the Stabilization section.

## How to export vertical video?

Go to **Export settings**, uncheck the lock icon and enter 9:16 resolution there, e.g. 1080x1920. Read more on the [**🎬 Exporting**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/exporting#output-size) page.

## When I run the program on Windows, there's an icon on taskbar but no window appears

Most likely the window is shown outside of your monitor. You can Shift+Right click on the taskbar icon, and select **Maximize** to bring the window back to the visible area.

## What logging rate should I use?

**50Hz** is the absolute minimum.

For reference:

* GoPro uses **200Hz**
* DJI & Insta360 uses **1000Hz**
* Sony uses **2000Hz**

## Is there a way to rotate video in Gyroflow?

Yes, you can rotate in the **Video Information** panel. There's an editable field called **Rotation**.

Simply click the little blue pencil icon, then adjust the rotation value as required.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FzYmLvkoWlcj6pLOKgjTt%2Fvideo-information.png?alt=media&amp;token=d9e86f1d-9c5b-416c-8161-917a53410b13" alt=""><figcaption></figcaption></figure>


# Troubleshooting

This page contains troubleshooting steps when you run into an error in Gyroflow.

## Failed to start on Windows

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F8BDW7xDmz1ainGmXW83A%2Fimage.png?alt=media&amp;token=69058501-832d-4d17-9168-aed06fd63bbd" alt=""><figcaption></figcaption></figure>

If you see the following message or similar mentioning `VCRUNTIME140.dll`, install [**VC redist**](https://aka.ms/vs/17/release/vc_redist.x64.exe)

## Failed to export HEVC

If you see an error message like this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F3GZLsMN4JthqKgsky74l%2Fffmpeg-error-558323010.png?alt=media&amp;token=a4366897-abbb-42c2-ae8e-664743c509fc" alt=""><figcaption></figcaption></figure>

...then:

* If you're on Windows or Linux, make sure you're using the latest drivers for your GPU.
* If you're using an older GPU, it may not support hardware HEVC encoding, in which case, you should try H.264 instead.
* If H.264 also fails, try disable GPU encoding completely.

## Application failed to start

If you see an error message like this on Windows:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F3Yuobisn6Pj1Z1UW7NRC%2Fapp-failed-to-start.png?alt=media&amp;token=ee952624-8e3b-434d-a7f4-dbee7a02e61a" alt=""><figcaption></figcaption></figure>

Please try downloading Gyroflow again. Everything you need is in the ZIP file that you download - you don't need to install any other dependancies manually.

## No space left on device

If you see an error message like this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FfEqMw18QBLiHmckOn5Bb%2Fno-space.png?alt=media&amp;token=f8e11088-6125-4486-89f3-03e5971d5846" alt=""><figcaption></figcaption></figure>

It means your hard drive doesn't have enough space for `ffmpeg` to render to. Please make some room and try again.

## Doesn't support this pixel format

If you see an popup like this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F6iTsUIFmvpWnRvysm0p4%2Fgpu-not-supported.png?alt=media&amp;token=e695919c-243d-4eac-a3ed-a3823d4cc004" alt=""><figcaption></figcaption></figure>

It means your physical GPU hardware doesn't support the pixel format you're attempting to render to (i.e. normally it means your GPU hardware doesn't support 4:2:2 10-bit).

You can click **Render using CPU**, to render using the CPU instead of the GPU to maintain full quality, or you can pick another pixel format.

## Unknown Error Occurred

If you see an error message like this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FXVDRPlBYYzF8XNPfPjSq%2Fffmpeg-error.jpg?alt=media&amp;token=1c749c6a-e08a-445d-8e96-9de2aab93896" alt=""><figcaption></figcaption></figure>

...then:

* If you're on Windows or Linux, make sure you're using the latest drivers for your GPU.
* If you're using an older GPU, it may not support hardware HEVC encoding, in which case, you should try H.264 instead.
* If H.264 also fails, try disable GPU encoding completely.

## Read Only File System

If you see an error message like this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FHUOFyNBLxui0vUJZQKZy%2Fdont-run-from-bundle.png?alt=media&amp;token=33ca1f96-9550-4408-a22c-0c20e9eb9bd4" alt=""><figcaption></figcaption></figure>

...and you're on Mac, make sure you install **Gyroflow** in your **Applications** folder and do NOT run it from the downloaded DMG package. Due to macOS sandboxing, Gyroflow isn't allowed to write to inside the package.

## Invalid data found when processing input

If you see an error message like this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FcA5I3TTmN9u4NmmocyPm%2Fexisting-red-transcode.png?alt=media&amp;token=f2aea2c2-872e-44b1-bf13-b8cf16e62bf7" alt=""><figcaption></figcaption></figure>

...and you're working with RED `R3D` files, try deleting the `MOV` file that Gyroflow created next to the `R3D` file, and try again.


# Input Data

## Video information

### Video frame rate

If you have your video recorded in VFR mode (project fps different than real-time recording fps, e.g. 120 fps recorded as 30 fps slowed down), then the video playback will not match your motion data, as motion data is always recorded in real time.

You can let Gyroflow know what was the real-time frame rate used (e.g. 120fps) and it will stretch the motion data to match the playback rate of the video. In some cases, this value will be read from the file metadata, but if it's not, you can click on the ✏️**Edit** icon and enter the **real time fps** in **Video information -> Frame rate** field.

This value only affects the motion data, so it will not make the video playback faster.

{% hint style="warning" %}
Remember to put exact frame rate, for NTSC it's 23.976, 29.97, 47.952, 59.94, 119.88 etc. For PAL it's 25, 50, 100 etc.)
{% endhint %}

### Video rotation

If you captured the video on the side or upside down, you can edit that field and enter rotation in degrees.

## Motion data

### Low pass filter

Low pass filter is useful to filter out high frequency vibrations or oscillations picked up by the IMU sensor. If you're using the camera on a drone, and the camera mount is not filtering the vibrations from the motors, then your motion data can be noisy and it will affect the stabilization. In this case, you can apply Low pass filter to filter out the high frequency vibrations while keeping the lower frequency camera motion intact.

The usual values range from 30 Hz to 70 Hz.

In some extreme cases, very low low pass filter can be useful if the motion data is very bad (e.g. GoPro Hero 7), but it will not magically fix all issues. You have to play with this value and find one that works for your case. Try to find a value which filters out the vibrations but doesn't filter the general motion too much.

The low pass filter is applied to gyroscope and accelerometer readings. If the Integration method is None, then it applies it to the Quaternions as well.

**`TODO:`**` `` ``example video of this in action `

### Median filter

**Median filter** replaces every gyroscope and accelerometer reading with the median of this many neighbouring samples (default 5). It removes single spikes in the motion data, which a low pass filter would only smear out.

### Motion data from another file

When you load the motion data from a different file than the video (e.g. a gyro log or a second camera), two more options show up:

* **Load all metadata** - also uses the other metadata of that file, like the lens profile, frame rate and rolling shutter information, as if it was the video file.
* **Frame offset** - shifts the video by whole frames against the motion data, for files where the motion data is stored per frame.

### Optical correction

Since Gyroflow 1.7.0, Gyroflow can measure the camera motion directly from the video. This lets you:

* stabilize footage that has no motion data at all,
* correct bad motion data wherever the image disagrees with it, like vibrations picked up by a hard-mounted FPV camera.

To use it, enable **Optical correction** in the Motion data panel and click **Analyze**. Only the trim range is analyzed. When it's done, Gyroflow shows in how many frames it measured the motion, and how large the correction is.

On a file without motion data, **Auto sync** runs this analysis as well.

The options are:

* **Tracking** - **KLT (corners)** is the most accurate where the image has detail. **DIS (dense flow)** also follows weak detail like sky, water or fog, but it's slower and loses fast motion more easily.
* **Correction** - **Per row** also removes vibration within a frame (jello). **Per frame** suits global shutter cameras, frames with large areas without detail, or an unknown rolling shutter time.
* **Strength** - Low values only correct small, fast errors like vibration. High values also correct large and long errors like gyro glitches, but follow moving objects in the image more. It's shown only when there's motion data to correct.
* **Ignore motion data from the file** - measures all of the motion from the video, instead of correcting the motion data. Use it when the motion data is too broken to correct.

After changing **Tracking** or **Correction**, click **Analyze** again to apply them. If you change the motion data, synchronization, lens profile or frame timing after the analysis, the correction is out of date and isn't applied until you analyze again.

You can also use the optical correction in the [🏗️ **CLI**](https://docs.gyroflow.xyz/app/advanced-usage/command-line-cli), with the `--optical-correction` option.

#### Tracked points editor

If the analysis picked up things that move on their own, like cars, people, water, propellers or on-screen graphics, they can pull the stabilization with them. You can remove them directly on the preview:

1. Check **Show/edit tracked points** under **Optical correction**. The points are green when they're used, yellow when they're counted less, and red when they're rejected.
2. Click or drag on the preview to select tracks. Hold **Shift** to add to the selection. **Ctrl+drag** selects that part of the camera frame through the whole clip, which is useful for propellers or a car's hood.
3. Press **Delete** to remove the selected tracks. The clip is re-stabilized immediately.

**Ctrl+Z** brings the removed tracks back, **Ctrl+A** selects all points in the current frame, and **Esc** clears the selection. More options are available when you right-click on the preview. **Restore all** brings back all removed tracks.

{% hint style="info" %}
The tracked points are available only after an analysis in the current session. A project file keeps the correction and which tracks were removed, but not the tracked points themselves.
{% endhint %}

### Gyro rotation

To achieve correct stabilization, the rotation of the motion data needs to match the video. If the IMU sensor is not pointing in the same direction as the camera sensor, then you'll have to rotate the motion data to match. All cameras with internal gyro data already have the correct rotation, but when using external gyro source, chances are you may have to enter the rotation values here.

A common example is using [blackbox gyro data](#user-content-fn-1)[^1] with camera tilted upwards, or a naked BMPCC, where the IMU sensor is on the main board, and the camera sensor is separated.

You can use optical flow data to determine the rotation values. When you change the rotation here, the lines on chart will move as well. Optical flow never moves, so you can change the rotation values by a few degrees and observe how it's changing on the chart, and when they match/align with the optical flow lines.

**`TODO:`**` `` ``Video example of that `

### Accelerometer rotation

In some rare cases, the gyroscope and accelerometer are actually two separate chips, in two different places. If you **right click on the Rotation label** you'll be able to enable **Separate accelerometer rotation.** You can then control gyroscope and accelerometer rotation separately. One example of such setup is the naked GoPro in [Umma95](https://ummagawd.com/products/umma95-beta95x-naked-gopro-cinewhoop-kit) design (you can try accelerometer pitch: 90°).

### IMU orientation

Similar to **gyro rotation**, the IMU orientation field describes the direction of the IMU chip. IMU orientation however, describes the general direction of the IMU chip.

The default value, indicating no direction changes is `XYZ`. This means that the X, Y and Z axes correspond directly to the expected X, Y and Z axes.

If we need to invert an axis, the letter will be lowercased, so `xYZ` will mean the X axis corresponds to the inverted expected X axis, and Y and Z are not changed.

If we need to swap the axes, we can put another axis on the expected position, for example `ZYX` will mean that the X axis corresponds to the Z axis, and Z axis corresponds to the X axis, and Y axis is not changed.

The first letter describes what axis is expected at the X axis, the second letter at the Y axis, and third at the Z axis.

You can use the same technique as described in the **Gyro rotation** section to determine the IMU orientation: Adjust the value and observe the lines on the chart until the light lines (optical flow) and dark lines (motion data) align up.

You can also right click on the timeline and choose **Guess IMU orientation here** to attempt to determine the IMU orientation automatically. Note that this function needs large enough **Sync search size**, same as used for the [**⌛Synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization).

**`TODO:`**` `` ``add video example `

### Gyro bias

A gyroscope often reads a small rotation even when the camera isn't moving. This offset is the gyro bias, and it makes the motion data slowly drift. **Gyro bias** in the Motion data panel subtracts a fixed value (in °/s) from the **X**, **Y** and **Z** gyroscope readings.

The easiest way to set it is to find a moment where the camera doesn't move at all (e.g. before take off), right-click on the timeline there and choose **Estimate gyro bias here**. Gyroflow averages the gyroscope readings over 400 ms around that point and fills in the values. After changing the bias, remove all sync points and do the synchronization again.

Since Gyroflow 1.7.0, the bias is applied only to the gyroscope. Before, it was wrongly applied to the accelerometer data as well.

### Integration method

IMU integration (or sensor fusion) is the process of calculating the final camera orientation in space, using readings from the gyroscope and an accelerometer. The gyroscope reads the speed of rotation, and the accelerometer reads acceleration (including gravity), not the actual orientation of the device.

Gyroflow needs to know the actual orientation in space, so it needs to convert these raw readings to the final orientation. It does that by using the integration algorithm. There are a few IMU integration algorithms available in Gyroflow:

* **None** - This option is available when the camera already has the actual device position in the metadata, because it calculated it on-board. For example GoPro and DJI cameras calculate it in-camera, so Gyroflow doesn't have to do that. When using this option, Gyroflow will simply use the integrated quaternions provided by the camera.
* **VQF** - modern and robust integration algorithm. It is the default algorithm and works well for most cases. It's based on [this paper](https://arxiv.org/pdf/2203.17024.pdf) if you want to read more about it. Since Gyroflow 1.7.0, it's used for all clips. Before, clips shorter than 10 seconds switched to the Complementary method.
* **Complementary** - a very good integration algorithm, works well in most cases. You can try this one when the VQF doesn't deliver good results. It's based on [this paper](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4570372/pdf/sensors-15-19302.pdf) if you want to read more about it.
* **Simple gyro** - simplest gyroscope integration method. This is a very simple algorithm without using the accelerometer or any bias estimations. Therefore horizon lock won't work with this method. In practice, it's rarely useful, unless you have somehow damaged accelerometer data and want to skip it.
* **Simple gyro + accel** - Similar to the previous one, but also includes accelerometer, so the horizon lock can work. In practice, it's rarely useful.
* **Madgwick** - An integration algorithm based on [this paper](https://courses.cs.washington.edu/courses/cse466/14au/labs/l4/madgwick_internal_report.pdf). Works well in most cases.
* **Mahony** - An integration algorithm based on [this paper](https://hal.science/hal-00488376/document).

[^1]: from your drone flight controller


# Lens Profiles

## Output projection

Since Gyroflow 1.7.0, you can choose how the stabilized image is projected. Click the value of **Output projection** in the lens information table, in the **Lens profile** panel:

* **Rectilinear** (default) - straight lines stay straight. A lens that sees more than 180° can't be shown whole, so its edges are cropped.
* **Stereographic** - fisheye that keeps shapes natural but bends straight lines. Shows the whole picture of a lens wider than 180°.
* **Equidistant** - fisheye where the distance from the center is proportional to the angle. Shows the whole picture of a lens wider than 180°.
* **Equisolid angle** - fisheye that keeps areas in proportion. Shows the whole picture of a lens wider than 180°.
* **Orthographic** - fisheye that compresses the edges strongly. Shows at most 180°.
* **Automatic** - rectilinear, or stereographic when the lens sees more than 180°.

The fisheye projections are useful for very wide lenses, like the Insta360 X4/X5 lenses or fisheye adapters, where a rectilinear image would have to crop a lot of the picture.

## No distortion, focal length only

If your video is already undistorted (it was recorded with a rectilinear lens, or the distortion was corrected in camera), you don't need a lens profile. Check **No distortion, focal length only** in the **Lens profile** panel and enter the **Focal length (35 mm equiv.)**. That's the focal length with the same field of view on a full frame (36x24 mm) sensor, so the focal length of the lens multiplied by the crop factor of the sensor. Gyroflow then uses a lens without any distortion, of that focal length.

This option is shown when the file doesn't have a lens profile, and in `Lens profile -> Advanced` when the loaded lens profile is unofficial. Unchecking it puts back the previous lens profile.

Files that record the focal length of every frame already work this way without a lens profile, so the option isn't shown for them.

## Zoom lenses

If the file records the focal length of every frame, Gyroflow follows it, so you can zoom during the shot. That's the case for Sony, and since Gyroflow 1.7.0 also for Canon (with supported lenses), Blackmagic, RED, Nikon and Z CAM. Since 1.7.0, the focal length is also interpolated between frames, so zooming clips may be framed slightly differently than in older versions.

### Stabilize focal length

You can enable **Stabilize focal length** in the Stabilization panel to smooth out fast zooms and zoom "pumping". Fast zooms are spread out by cropping ahead of a zoom-in and after a zoom-out, while zooms slower than **Max zoom speed** pass through unchanged. Lower values give a smoother zoom and more crop.

The **FL** button on the left side of the timeline chart shows the original and the smoothed focal length.

### Lens metadata delay

Some lenses report the focal length a few frames later than the picture (e.g. some Tamron zooms on Sony). It depends on the lens, not on the frame rate. If the picture jumps or wobbles during zooms, set **Lens metadata delay** in `Lens profile -> Advanced`, or click **Analyze** next to it to measure it from the zooms in the clip. The clip needs a zoom recorded in the lens metadata for the analysis to work.

This option is available for Sony files.

## Lens breathing compensation

Many lenses change the field of view slightly when focusing (this is called focus breathing). Since Gyroflow 1.7.0, Gyroflow can keep the field of view constant while focusing, using the lens breathing data recorded by the camera. That's the case for supported Sony lenses on cameras like the α7 IV, α7C II, α7R V, α6700 and ZV-E1.

When the file contains this data, **Lens breathing compensation** shows up in the **Lens profile** panel, and it's enabled by default.

## Lens is under water

Water bends the light at the lens port, so a lens has a narrower field of view under water. Enable `Lens profile -> Advanced -> Lens is under water` for footage filmed under water, and the lens profile is adjusted for it (refraction coefficient 1.33). Since Gyroflow 1.7.0, the adjustment is exact across the whole frame.

You can [🔑 keyframe](https://docs.gyroflow.xyz/app/advanced-usage/keyframes) it (right-click the checkbox), for clips that go in and out of the water.

## Asymmetrical lens

By default, Gyroflow assumes the optical center of the lens is in the middle of the frame. If it isn't (e.g. a lens that isn't centered on the sensor), enable **Lens is asymmetrical** in the [🏁 Lens calibrator](https://docs.gyroflow.xyz/app/getting-started/lens-calibration) before calibrating. The lens profile then keeps the calibrated optical center (`"asymmetrical": true` in the file).

## Lens parameters

`Lens profile -> Advanced` shows the parameters of the loaded lens profile: **Pixel focal length**, **Focal center** and **Distortion coefficients**. You can edit them to fine-tune a profile without calibrating again.

## Export STMap

**Export STMap** in `Lens profile -> Advanced` writes the lens undistortion and redistortion as STMaps (`-undistort-` and `-redistort-` `.exr` files) to the selected folder, for use in compositing apps like Nuke or Fusion. If the file records lens data for every frame (e.g. a zoom lens), you can export one STMap per frame. The [CLI](https://docs.gyroflow.xyz/app/advanced-usage/command-line-cli) can do the same with `--export-stmap`.

## Lens profile file

Lens profiles are `.json` files. Most fields are filled in by the [🏁 Lens calibrator](https://docs.gyroflow.xyz/app/getting-started/lens-calibration), but some features are only available by editing the file by hand. The examples below come from profiles in the lens profile database.

### Synchronization settings

`sync_settings` stores the synchronization settings for the camera. They're applied when the lens profile is loaded. With `"do_autosync": true`, **Auto sync** runs automatically when the video, the motion data and the lens profile are loaded, if the file has no sync points yet and its motion data isn't accurately timed. It also runs in the [⏩ Render queue](https://docs.gyroflow.xyz/app/advanced-usage/render-queue).

```json
"sync_settings": {
    "do_autosync": true,
    "initial_offset": 0,
    "initial_offset_inv": false,
    "search_size": 0.5,
    "max_sync_points": 5,
    "every_nth_frame": 1,
    "time_per_syncpoint": 0.5
}
```

The keys match the [⌛ Synchronization](https://docs.gyroflow.xyz/app/advanced-usage/synchronization) options. `initial_offset` (rough gyro offset), `search_size` and `time_per_syncpoint` are in seconds. `of_method`, `offset_method` and `pose_method` are the index of the option in the list, starting from 0.

### Custom sync point timestamps

By default, **Auto sync** spreads the sync points evenly. `custom_sync_pattern` in `sync_settings` places them at specific times instead. It's one pattern, or a list of them:

```json
"custom_sync_pattern": [
    { "start": "899", "interval": "1001", "gap": "0.6s" },
    { "start": "450", "interval": "1001" }
]
```

* `start` - the first sync point.
* `interval` - the distance between the sync points (default: the whole clip, so only one point).
* `gap` - adds two sync points instead of one, this far apart, centered on each position.

Plain numbers are frames, and you can also use seconds (`"0.6s"`) or milliseconds (`"600ms"`).

### Compatible settings

One calibration can be shared by several camera modes. `compatible_settings` lists them, and Gyroflow creates a copy of the lens profile for each:

```json
"compatible_settings": [
    { "width": 1920, "height": 1440, "fps": 23.976, "identifier": "gopro-hero10black-narrow-1920x1440@23976-no-eis" },
    { "width": 1920, "height": 1440, "fps": 25.0,   "identifier": "gopro-hero10black-narrow-1920x1440@25000-no-eis" }
]
```

If `width` and `height` have the same aspect ratio as the calibration, the calibration is scaled to them. If the aspect ratio is different, it's treated as a sensor crop. Each entry can also override other fields, like `frame_readout_time`, `crop`, `digital_lens`, `focal_length`, `output_dimension` or `sync_settings`.

### Crop

For a camera mode that uses only part of the calibrated image and scales it to the same resolution, set `crop` to that part, e.g. `"crop": 0.8` for 80% of the width. The focal length of the calibration is divided by it.

### Interpolations

A zoom lens changes its distortion along the zoom. `interpolations` holds calibrations at several focal lengths, and Gyroflow blends between them using the focal length recorded in the video file:

```json
"interpolations": {
    "14": { "camera_matrix": [[1541.53, 0, 1942.44], [0, 1542.31, 1087.03], [0, 0, 1]], "distortion_coeffs": [0.312, 0.109, -0.034, 0.092], "focal_length": 14 },
    "16": { "camera_matrix": [[1710.70, 0, 1927.51], [0, 1712.35, 1088.55], [0, 0, 1]], "distortion_coeffs": [0.318, 0.127, -0.048, 0.113], "focal_length": 16 }
}
```

The keys are focal lengths in millimetres. Instead of `camera_matrix` and `distortion_coeffs`, an entry can also point to another lens profile from the database with `"identifier"`.

Without `interpolations`, on cameras that record the focal length in millimetres (Blackmagic, RED, Nikon, Z CAM), a single calibration follows the zoom by scaling its focal length, and keeps the distortion of the calibration.

### Other fields

* `frame_readout_time` (ms) and `frame_readout_direction` - the [rolling shutter correction](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization#rolling-shutter-correction) applied with the profile.
* `global_shutter` - `true` for global shutter cameras, which need no rolling shutter correction.
* `gyro_lpf` - the motion data low-pass filter (Hz) applied with the profile.
* `input_horizontal_stretch` and `input_vertical_stretch` - the [input stretch](https://docs.gyroflow.xyz/app/getting-started/lens-calibration#input-stretch), e.g. for anamorphic lenses.
* `focal_length` (mm) and `crop_factor` - the lens focal length and the sensor crop factor.
* `output_dimension` - the default output size for this camera.

### Lens models

`distortion_model` is the lens model of the calibration. When it's missing, it's `opencv_fisheye`.

* `opencv_fisheye`, `opencv_standard` and `generic_polynomial` - the models you can choose in the Lens calibrator, see [Distortion model and calibration method](https://docs.gyroflow.xyz/app/getting-started/lens-calibration#distortion-model-and-calibration-method).
* `poly3`, `poly5` and `ptlens` - the lens models used by the lensfun database.
* `sony`, `insta360` and `gopro` - the models of the lens data recorded by these cameras. You don't need to set them yourself.

`digital_lens` describes digital processing done in the camera after the lens, which Gyroflow reverses first: `gopro_superview`, `gopro6_superview` and `gopro_hyperview` for older GoPro cameras (also available as **Digital lens** in the Lens calibrator), and `gopro_warp` for the lens data recorded by GoPro HERO11 and newer.


# Synchronization

This page describes the options of the Synchronization panel. Read [⌛ **Basic usage -> Synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization) first, to learn how the synchronization works and how to check it. Figuring out the offset manually is described there as well.

## Main options

* **Rough gyro offset** - your initial guess of the offset, see [Synchronizing external gyro source](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization#synchronizing-external-gyro-source). The small checkbox next to it also analyzes the negative offset. It doubles the calculation time, so use it only for the first sync point, until you know the offset.
* **Sync search size** - the range around the rough offset that is searched. The small checkbox next to it (shown for the **Visual features** and **rs-sync** offset methods) first estimates the offset with the faster **Essential matrix** method, and then refines it. It's checked automatically when the search size is larger than 10 s.
* **Max sync points** - how many sync points **Auto sync** adds. They're spread evenly over the trim range.

The small checkbox next to the **Auto sync** button enables the experimental automatic sync point selection: instead of spreading the points evenly, Gyroflow picks the moments with the most usable motion in the motion data.

## Advanced

* **Analyze every n-th frame** - analyzes only every n-th frame. It's useful for high frame rate footage (e.g. 240 fps), where consecutive frames barely differ, and it makes the analysis faster. This setting isn't remembered between sessions.
* **Time to analyze per sync point** - how much of the video is analyzed around each sync point (default 1.5 s). Longer gives the algorithm more motion to match, but takes longer.
* **Processing resolution** - the video is scaled down to this height before the analysis (default 720p). Higher resolutions can track finer detail, but are slower.
* **Optical flow method** - how the motion of the pixels between frames is measured:
  * **OpenCV (DIS)** (default) - dense optical flow.
  * **OpenCV (PyrLK)** - tracks individual corner points.
  * **AKAZE** - matches features between frames. It may be more accurate, but it's much slower. Use it only if the OpenCV methods don't give good results.
* **Pose method** - how the camera rotation between frames is calculated from the optical flow: **findEssentialMat** (default), **Almeida**, **EightPoint** or **findHomography**. This rotation is the lighter lines on the chart.
* **Offset method** - how the offset is found:
  * **rs-sync** (default) - a synchronization algorithm that takes the rolling shutter into account. Make sure the [rolling shutter correction](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization#rolling-shutter-correction) is set correctly before syncing.
  * **Visual features** - undistorts the optical flow points with the motion data at each candidate offset, and picks the offset where the video moves the least.
  * **Essential matrix** - compares the camera rotation calculated from the optical flow with the rotation from the motion data.
* **Low pass filter** - filters the motion measured from the video (the lighter lines on the chart), which can help when it's noisy.
* **Show detected features** and **Show optical flow** - draw the tracked points and their motion over the preview, where the video was analyzed.

## Synchronization settings in lens profiles and presets

A lens profile or a [settings preset](https://docs.gyroflow.xyz/app/advanced-usage/settings-presets) can carry its own synchronization settings, and can run **Auto sync** automatically when the file is loaded. This is useful for cameras that always need synchronization, e.g. in the render queue. See [Synchronization settings](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles#synchronization-settings) in the lens profile file reference.


# Stabilization

This page describes the advanced options of the Stabilization panel. For the basics, see [🔥 **Basic usage -> Stabilization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/stabilization).

## Smoothing algorithms

* **No smoothing** - keeps the camera motion as it was recorded. Lens and rolling shutter correction still apply.
* **Default** - smooths the motion depending on its speed: slow motion is smoothed a lot, while fast motion (like a quick pan or a flip) is followed more closely, so the video doesn't have to zoom in as much. Use it for almost everything.
* **Plain 3D** - smooths all motion equally, with the **Smoothness** time in seconds (default 0.25 s). Fast motion makes it zoom in a lot.
* **Fixed camera** - keeps the camera pointed in one fixed direction, set with the **Roll angle**, **Pitch angle** and **Yaw angle**, like on a tripod. When the camera points away from that direction, you'll see the background (black) instead of the video.

### Default algorithm options

**Smoothness** is the main slider. The amount of smoothing also depends on the lens: the same rotation moves the picture more on a narrow lens, so a narrow lens gets less smoothing than a wide one at the same value.

In the **Advanced** section below the slider:

* **Per axis** - separate **Pitch smoothness**, **Yaw smoothness** and **Roll smoothness** instead of one slider.
* **Only within trim range** (on by default) - the motion outside the trim range doesn't affect the smoothing inside it. For example, a crash right after the end of the trim range won't pull the smoothed motion before it.
* **Max smoothness** - the smoothing time for slow motion (default 1 s). Higher values make slow motion smoother.
* **Max smoothness at high velocity** - the smoothing time for fast motion (default 0.1 s).

All of these sliders can be [🔑 keyframed](https://docs.gyroflow.xyz/app/advanced-usage/keyframes).

## Horizon lock

### Lock pitch angle

Since Gyroflow 1.7.0, **Lock horizon** can also hold the camera tilt (up/down) at a fixed angle. Check **Lock pitch angle** and set the angle with **Pitch angle correction**. It can be [🔑 keyframed](https://docs.gyroflow.xyz/app/advanced-usage/keyframes), like the roll angle.

Pitch locking isn't available when **Use gravity vectors** is enabled, because the gravity vectors only level the roll.

### Automatic horizon lock

Since Gyroflow 1.7.0, **Automatic lock** lets the horizon lean into turns, like in a banked turn, instead of keeping it level all the time. When the camera rolls faster than a threshold, the horizon tilts with it, proportionally to the roll speed. Enabling it sets the lock amount to 100%.

* **Turn threshold** - the roll speed (in °/s) above which the horizon starts to tilt.
* **Turn smoothness** - the smoothing time of the turn detection (in ms).
* **Turn multiplier** - how much the horizon tilts: the tilt is the multiplier times the roll speed (°/s → °).
* **Limit tilt acceleration** - limits how fast the tilt can speed up or slow down, with **Tilt acceleration limit** (in °/s²). It prevents jerky horizon movements.

### Gravity vectors

Some cameras (e.g. GoPro) record the direction of gravity, as computed by the camera. In that case, **Use gravity vectors** shows up, and the horizon is levelled using that data instead of Gyroflow's own estimate. It's not always better, so compare both on your footage.

### Integration method

When the motion data uses the camera's built-in orientation (**Integration method** set to **None** in the Motion data panel) and the file also has the raw gyroscope data, the horizon lock has its own **Integration method**. It's used only to keep track of the horizon, while the rest of the stabilization keeps using the camera's orientation.

## Zooming

### Static zoom: zoom level

With **Static zoom**, **Zoom level** can be:

* **Automatic** - as much zoom as the video needs, up to the zoom limit.
* **Manual** - since Gyroflow 1.7.0, exactly the zoom you set in **Zoom**, in every video, like in-camera stabilization, so you know the framing while shooting. The smoothing is lowered only where the frame wouldn't fit otherwise. If even that isn't enough, the video is zoomed in further and a warning is shown. You can then increase **Zoom limit iterations** in `Stabilization -> Advanced`, or the zoom.

### Zoom limit

The zoom limit is calculated approximately. If you need more accuracy, increase **Zoom limit iterations** in `Stabilization -> Advanced`. More iterations give a more accurate limit, but are slower to calculate.

Since Gyroflow 1.7.0, with **Static zoom**, the zoom limit lowers the smoothing only around the moments that don't fit, instead of in the whole clip. The old behavior is available in `Stabilization -> Advanced -> Zoom limit lowers the smoothing of the whole clip`. Projects saved with older versions open with it enabled, so they look the same.

### Advanced -> Zooming method

With **Dynamic zooming**, the zoom follows how much each frame needs, smoothed with the **Zooming speed**:

* **Envelope follower** (default) - never zooms in less than a frame needs, and eases in and out of each zoom with the zooming speed as the time constant.
* **Gaussian filter** - takes the largest zoom needed within the zooming speed window around each frame, and blurs it with a Gaussian curve. When the zooming speed is [🔑 keyframed](https://docs.gyroflow.xyz/app/advanced-usage/keyframes), it may show black borders, so Gyroflow switches to **Envelope follower** then.

### Advanced -> Additional 3D rotation

Rotates the output view by a **Pitch**, **Yaw** and **Roll** angle, after the stabilization. You can use it to reframe the video, e.g. to keep the subject in frame when exporting a vertical video from a horizontal one. It can be [🔑 keyframed](https://docs.gyroflow.xyz/app/advanced-usage/keyframes).

It replaces the older **Zooming center offset**, which is no longer shown.

## Lens correction strength

The **Lens correction** slider controls how much of the lens distortion is removed. At 100%, the lens distortion is fully corrected and straight lines are straight. Lower values add the original lens distortion back, which can be useful to keep the look of a wide lens.

Since Gyroflow 1.7.0, values below 100% are exact and change the image evenly. In older versions, most of the change happened close to 100%, so the same value may look different in older projects.

## Video speed

**Video speed** in `Stabilization -> Advanced` changes the speed of the exported video, from 10% to 1000%. You can [🔑 keyframe](https://docs.gyroflow.xyz/app/advanced-usage/keyframes) it to create speed ramps. The export keeps the frame rate of the original file and skips or repeats frames. Audio isn't exported when the speed is changed.

The three small checkboxes above the slider (all on by default) adapt the stabilization to the new speed:

* **Link with smoothing** - the smoothing is scaled with the speed, so the exported video looks as smooth as at 100%.
* **Link with zooming speed** - the zooming speed is scaled with the speed.
* **Link with zooming limit** - the zoom limit is raised with the speed, by a quarter of the speed change (at most 1.8 times). For example, at 200% speed, a 130% zoom limit becomes 162.5%.


# Keyframes

Gyroflow comes with the ability to keyframe most parameters in order to achieve any look you want.

Most parameters in Gyroflow can be keyframed - meaning their value can be changed in different parts of the video (i.e. you can use a different smoothness at the start of the video, compared to the end).

## How to use?

### Enabling keyframes

Keyframes can be enabled by right-clicking on the slider and choosing **Enable keyframing.**

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F2qZYYYEYlOLp1KOr4WDZ%2Fimage.png?alt=media&amp;token=2ea9c2cb-4e7c-47cd-b94a-bb40bda53258" alt=""><figcaption></figcaption></figure>

Then, go to a time in the video when you want the value to be different and just change the slider value. This will create a keyframe on the timeline chart.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FwqwHMLNSzNDhmD5I9Mlp%2Fimage.png?alt=media&amp;token=46d2863e-a3d5-404a-837f-aa846f29aa4c" alt=""><figcaption><p>Smoothness keyframe</p></figcaption></figure>

### Keyframe easing

You can right-click the keyframe point to change its easing:

* **Smooth** - the value follows a smooth curve through the neighbouring keyframes, without overshooting, instead of slowing to a stop at each keyframe. Since Gyroflow 1.7.0, it's the default for new keyframes.
* **Ease in** and/or **Ease out** - the value slows down when it arrives at the keyframe and/or when it leaves it.
* With none of them checked, the value changes linearly.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FOVppWjcYrGVq88SnKCDC%2Fimage.png?alt=media&amp;token=d590d65c-28a9-400d-82c9-5a7b5da4b416" alt=""><figcaption></figcaption></figure>

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FPrElQZfSezKSjnlo3mD3%2Fimage.png?alt=media&amp;token=54442255-8688-445c-83ca-d6a1b93b90fb" alt=""><figcaption><p>Ease in + out vs. linear keyframe</p></figcaption></figure>

{% hint style="warning" %}
Projects with **Smooth** keyframes will load without any keyframes in Gyroflow 1.6.x and older.
{% endhint %}

You can jump to the previous or next keyframe with **Shift+Page Up** and **Shift+Page Down** (or **Shift+Left** and **Shift+Right**), or by Shift+clicking the previous/next frame buttons below the video.

### Removing/disabling keyframes

You can right-click the keyframe point to delete it, or to disable all keyframing for a slider, right-click on the slider and uncheck **Enable keyframing** - this will clear all keyframes on that slider.

## Keyframeable parameters

* Smoothness
* FOV
* Zooming speed
* Zoom limit
* Horizon lock amount / roll correction
* Horizon lock pitch angle (since Gyroflow 1.7.0)
* Lens correction strength
* Lens is under water
* Additional 3D rotation
* Max smoothness
* Max smoothness at high velocity
* Pitch/Roll/Yaw smoothness
* Video rotation
* Background margin / feather
* Video speed

## Example

{% embed url="<https://gyroflow.xyz/demo/docs/?v=keyframing>" %}

## Caveat

The **Gaussian filter** zooming method may show black borders when the zooming speed is keyframed. When you enable keyframing of the zooming speed, Gyroflow switches the zooming method to **Envelope follower**, and shows a warning if you switch it back.


# Settings Presets

Gyroflow allows you to create a preset with all or some settings you commonly use and then load that preset to videos and in the render queue.

Presets can be used to store your common preferred settings in the UI. You can then have them in the Lens profile search box, or you can drag & drop them in the UI or in the [render queue](https://docs.gyroflow.xyz/app/advanced-usage/render-queue), or use in the [CLI](https://docs.gyroflow.xyz/app/advanced-usage/command-line-cli).

## Creating presets

In order to create a preset, set any settings you want in the UI, then click on the arrow on the **Export** button and choose **Create settings preset.**

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FCQADHyWIk3UZYQEJHZgJ%2Fimage.png?alt=media&amp;token=be05ad90-a4c6-4a6e-9cfb-398ff6be61a8" alt=""><figcaption></figcaption></figure>

Then simply select settings you want to include in the preset:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FeX6JeD2gCRvU12yyO0he%2Fimage.png?alt=media&amp;token=195326c4-31f8-4b11-9e30-7d54d33ec20a" alt=""><figcaption></figcaption></figure>

Since Gyroflow 1.7.0, the preset dialog also has the **Disable lens stretch (for plugins)** option. Use it when your video editor does the anamorphic desqueeze itself: the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow) then don't apply the input stretch from the lens profile again.

At the bottom of the dialog, choose where to save the preset:

* **Save to file** - anywhere you want. You can then drag & drop it in the UI or in the render queue.
* **Save to lens profile directory** - the preset shows up in the Lens profile search box, where it can be favorited and searched.
* **Save as default preset** - see [Default preset](#default-preset).

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FfXyBvARMZGxwaPyrf3em%2Fimage.png?alt=media&amp;token=657b5396-05ac-4ef8-b1c8-bee587ee0a0e" alt=""><figcaption><p>Preset in the lens profile search box</p></figcaption></figure>

{% hint style="info" %}
The lens profile directory is the `lens_profiles` folder in Gyroflow's data folder (`Advanced -> Open data folder`). Presets saved there aren't replaced when Gyroflow is updated.
{% endhint %}

## Default preset

The default preset (`default.gyroflow` in the lens profile directory) is loaded automatically with every video, in the main window, in the render queue and in the video editor plugins.

The old location, `default.gyroflow` in the `camera_presets` folder of the Gyroflow installation, still works, but it's replaced when Gyroflow is updated, and the one in the lens profile directory takes precedence.


# Render Queue

Gyroflow has a built-in render queue which allows to render multiple files in the background.

### Where is render queue?

Render queue can be accessed by clicking the queue icon, next to the **Export** button.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FFIxuuB30esLCGyZTd7kp%2Fimage.png?alt=media&amp;token=2d61f3e9-48b1-48fa-9d41-2deaf2110616" alt=""><figcaption><p>Render queue icon</p></figcaption></figure>

You can also toggle the render queue by using the `q` keyboard shortcut.

### Adding to the render queue

There are 2 ways to add a file to the render queue:

1. Open a video file in Gyroflow, adjust your settings, then click on the arrow icon on the **Export** button and choose **Add to render queue**
2. Drag & drop your video file directly to the render queue.

You can also drag & drop the .gyroflow project file to the render queue.

Since Gyroflow 1.7.0, files added to the render queue together are sorted by name.

{% hint style="info" %}
When you add a video file directly to the render queue, it will use the settings that are currently set in the main window.
{% endhint %}

### Settings presets

Instead of using the current GUI settings, you can also apply your **settings preset** to all items in the render queue. Simply drag & drop the preset (.gyroflow file) into the render queue and it will apply it to all items. Note that the preset is only applied to items in the queue. Once you add new files, you have to use the preset again to apply for new files. You can also use the default preset to automatically apply for all new items. Read more in the [**⚙ Settings presets**](https://docs.gyroflow.xyz/app/advanced-usage/settings-presets) section.

### Automatic synchronization in the render queue

If your file requires [**⌛synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization) (see the list of cameras that don't need it on that page), it can also be done in the render queue. For that, the lens profile needs to have the synchronization parameters included (read more on [**Advanced usage -> 🔭 Lens profiles**](https://docs.gyroflow.xyz/app/advanced-usage/lens-profiles)), or your settings preset needs to have synchronization parameters and **Do autosync** checked.

### Apply specific settings to all items in the queue

If you want to change just one or a few parameters in all items of the queue, you can set the desired values in the main Gyroflow window, and then use the arrow icon on the **Export** button, and choose **Apply selected settings to all items in the render queue**. Then select which setting you want to apply.

### Queue settings

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F2VMH5Ds6m4QF4W1VqPZX%2Fimage.png?alt=media&amp;token=be543a59-6a9f-4cac-8dff-a3e77ffdb221" alt=""><figcaption><p>Render queue settings menu</p></figcaption></figure>

#### Number of parallel renders

You can choose how many files you want to render in parallel. Gyroflow is designed to use maximum possible resources when rendering so rendering just one file at a time should be enough. In some cases, 2 or 3 files in parallel can render faster, but in general anything more than 2 will probably not render any faster.

#### Default overwrite action

You can choose default action to take when the output file already exists on disk.

#### Export mode

Render queue can also be used to export project files, instead of rendering a stabilized video file. This can be useful if you have a lot of videos you want to use with the [**Video editor plugin**](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow). You can add all your video files to the render queue as usual and then click on the **Queue settings -> Export mode -> Project file (including gyro data)**. This mode will create a `.gyroflow` project file for each video in the queue, instead of rendering stabilized video. **Stabilized video + Project file with gyro data** does both.

#### Action when done

Once your render queue is finished, you can choose what Gyroflow should do, by setting **When rendering is finished** option on the left bottom corner of the render queue. Possible actions include: Close the program, shutdown the computer, restart computer, hibernate or put the computer to sleep etc.

### Output directory

Default output directory for files dropped into the render queue is the same folder as the video file. However, if the **Output path** field on the bottom of Gyroflow contains a path, then all files dropped to the render queue will be rendered to that folder.

### Preserving the render queue

If you have some items in the render queue and you close the program (or it crashes), then all items should be restored when you start Gyroflow again.

### Reordering items in the render queue

Items can be reordered by right-clicking an item and choosing "Move up" or "Move down"

Drag & drop is also supported, if you hold Ctrl (Command on Mac) key and drag the item


# Exporting

In some cases, you may want to have more control over the encoding parameters. This section describes the advanced features of the Export settings panel.

### Custom encoder options

Gyroflow uses **ffmpeg** for the rendering process. There are a lot of different encoders, parameters and cases, depending on the file type, operating system and your graphic card. For most cases, the defaults are fine, but if you want to pass an additional setting to the encoder, you can use the **Custom encoder options** field and enter the parameters as you would to the **ffmpeg** command line. For example: `-preset hq -profile rext`.

The list of accepted parameters is available by clicking the **Info** icon (**Show available options**), next to the text field. You can google the parameter names + ffmpeg for specific explanations.

Note that Gyroflow doesn't use the ffmpeg command line (CLI), but rather the C API directly, so not all options that can be passed to the ffmpeg CLI, can be used here. This field is for the **video encoder parameters only**.

Additional supported options are: **-hwaccel\_device**, **-qscale** and **-pix\_fmt**.

### Metadata comment

Text written to the comment field of the exported file's metadata.

### Keyframe distance

When using H.264 or H.265, you can specify the keyframe distance (default 1 s) - it's the interval for every **I-frame** (a fully encoded frame independent of other frames). For detailed explanation what it is read [**this Wikipedia article**](https://en.wikipedia.org/wiki/Video_compression_picture_types). It has nothing to do with parameter keyframing in Gyroflow, it's a video encoder parameter.

### Preserve other tracks

Some video files contain additional tracks, like timecode, subtitles, motion data etc. By default, Gyroflow discards these tracks and only renders one video and one audio track. In order to preserve them and copy directly to the stabilized file, you can check this option.

Since Gyroflow 1.7.0, this option copies the camera's metadata tracks and the file metadata as they are, so apps that read them recognize the exported video. For example, DJI Mimo shows its dashboard overlays (see [DJI](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/dji#exporting-for-dji-mimo)). If some tracks can't be copied, the export finishes with a warning that lists them.

Since 1.7.0, this option also no longer forces the .mov format and copying the audio. The audio uses the selected **Audio codec**, and the output stays .mp4, unless the audio codec is **Copy** (then it's .mov).

You can't use the trim range with this option (i.e. you need to render the full file), because Gyroflow doesn't know how to cut arbitrary binary tracks.

### Use black frames outside trim range and keep original file duration

When using the trim range, the rendered file will only be the selected trim section of the original file. However in some cases, it is desirable to render only a fragment of the file, but retain full original length of the file. A common case is when using a video editor and having the edit already done. If you then replace the clip with a shorter one, the edit will fall apart. But if you replace the clip with one with the exact same duration, everything will work fine.

When you check this option, Gyroflow will render black frames outside the trim range, and actual stabilized video inside the trim range. This allows the video codec to compress the black frames, so the file size will still be small, while retaining the full original video duration. This can also be useful when combined with the **Preserve other tracks** option.

### Export trim ranges as separate videos

With several trim ranges, they're exported as one video by default. With this option, every trim range is exported as a separate video.

### Audio codec

By default, Gyroflow renders the audio as AAC with the same bitrate as the input file (up to 320 kbps). You can choose a different format in **Audio codec**: AAC, PCM (16-bit or 24-bit, little or big endian), or **Copy**.

**Copy** (since Gyroflow 1.7.0) keeps the original audio without re-encoding it. If the output format can't store the original audio codec, AAC is used instead.

### Interpolation method

How the pixels of the source frame are sampled: **Bilinear**, **Bicubic**, **Lanczos4** (default) or one of the **EWA** methods (RobidouxSharp, Robidoux, Mitchell, Catmull-Rom). Bilinear is the fastest and the softest. The EWA methods take into account how much of the source image each output pixel covers, so they avoid aliasing where the image is shrunk (e.g. with a smaller output size), but they're slower.

### Export fps

Gyroflow always exports the video file with the same frame rate as the original video file. There is currently no option to change the frame rate.

### Device for rendering

Some computers or laptops have more than one GPU and usually one is more powerful that the other (e.g. integrated GPU vs. the dedicated GPU). You can choose the preferred device used for **video encoding** here.

There's also a second selector in the **Advanced** section which controls the device used for the **stabilization process** itself. These processes are separate and you can process on one GPU and render on the other GPU.

Some devices support more encoding formats and some devices don't support GPU video encoding at all, so make sure you select the correct (and more powerful) device here.

### Preserve export settings and path

**Preserve export settings** keeps the output size and bitrate for all files you open, instead of taking them from each video. **Preserve export path** does the same for the output folder.

### Experimental encoders

**Use experimental Vulkan encoder** (Windows and Linux, for H.264, H.265 and AV1) and **Use experimental D3D12 encoder** (Windows, for H.265 and AV1) use the GPU's hardware encoder through these generic APIs, instead of the vendor's own API (NVENC, AMF or Quick Sync). Try them if the regular GPU encoding doesn't work on your system.

### Project types

When exporting a project file, you have 3 options:

* **Project file** - This is the smallest project file which can be used when your video file contains internal motion data. The motion data will always be in the original video file, so there's no need to save it separately in the project. This project contains all stabilization parameters and the file path of the video.
* **Project file (including gyro data)** - If your motion data is from external source or is in a separate file (like .gcsv), then this project file will embed the entire motion data inside the project file, so there's no need to keep the separate gyro file around. This can be useful when you're using a GoPro as a logger, or when you want to export a project file for the video editor plugins. The default shortcut to save project file (**Ctrl+S**) is saving with gyro data, as it's the safe default for all cases.
* **Project file (including processed gyro data)** - This option is similar to the previous one, but it also contains additional motion data processed by Gyroflow - it is useful in combination with external scripts like [**Gyroflow-to-CSV**](https://github.com/EmberLightVFX/Gyroflow-to-CSV). Video editor plugins don't need this option, the `(including gyro data)` one is enough.

The first two are in the menu of the arrow on the **Export** button, and the third one in `Motion data -> Export`. All three are also available as the **Export mode** of the [⏩ Render queue](https://docs.gyroflow.xyz/app/advanced-usage/render-queue#export-mode).


# Command Line (CLI)

Gyroflow has a CLI interface for usage in scripts and automating workflows.

You can also use Gyroflow as a command line program, in order to automate some tasks in scripts.

Most common usage will be to provide a video file and render the stabilized video. You can simply call `Gyroflow.exe YOUR_FILE.mp4` to do that in case of sync-less files, or also add `--preset YOUR_PRESET.gyroflow` to apply any settings and/or lens profile you want.

CLI can also render from a project file.

One of more interesting CLI features is a **watch folder**, which can be used to automatically stabilize all new footage copied to that specified folder. You can simply run `Gyroflow.exe --watch C:\MY_FOOTAGE\` and it automatically stabilize any new video files that appear in that folder. Since Gyroflow 1.7.0, files that are still being copied are processed only when they're complete, and one bad file no longer stops the queue.

The output settings are passed with `-p`. Run `Gyroflow.exe --help` to see all the keys and their values. For example, to export AV1 and keep the original audio: `-p "{ 'codec': 'AV1', 'audio_codec': 'Copy' }"`.

{% hint style="info" %}
The examples in the help text show the braces doubled (`{{ }}`), but you have to type them once (`{ }`).
{% endhint %}

### Optical correction

Since Gyroflow 1.7.0, the CLI can also measure the camera motion from the video before rendering, like [**Optical correction**](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction) in the app:

* `--optical-correction 50` - corrects the motion data with the motion measured from the video, with this strength in %. Files without motion data get all of their motion measured from the video.
* `--ignore-file-motion` - ignores the motion data in the files, and measures all of the motion from the video.
* `--optical-per-frame` - corrects the motion data once per frame instead of per band of rows, e.g. for a global shutter camera, or when the rolling shutter time is unknown.
* `--optical-tracking dis` - uses the DIS dense optical flow instead of KLT (the default), for low texture like sky or water. It's slower.

The last three options enable `--optical-correction` as well.

### Exit codes

Since Gyroflow 1.7.0, the CLI returns an exit code you can check in your scripts:

* `0` - success
* `1` - render failure
* `2` - invalid arguments

### All options

```
Usage: gyroflow [<input...>] [-f] [-j <parallel-renders>] [-d <when-done>] [-p <out-params>] [-t <suffix>] [-s <sync-params>] [--stdout-progress] [--optical-correction <optical-correction>] [--ignore-file-motion] [--optical-per-frame] [--optical-tracking <optical-tracking>] [--export-project <export-project>] [--export-metadata <export-metadata>] [--export-metadata-fields <export-metadata-fields>] [--export-stmap <export-stmap>] [--preset <preset>] [--open <open>] [--watch <watch>] [-g <gyro-file>] [-b <processing-device>] [-r <rendering-device>] [--no-gpu-decoding] [--version]

Gyroflow v1.7.0
Video stabilization using gyroscope data
Exit codes: 0 - success, 1 - render failure, 2 - invalid arguments

Positional Arguments:
  input             input files: videos, project files, lens profiles, presets

Options:
  -f, --overwrite   overwrite if output file exists, default: false
  -j, --parallel-renders
                    number of parallel renders, default: 1
  -d, --when-done   when done: 1 - shut down; 2 - reboot; 3 - sleep; 4 -
                    hibernate; 5 - logout
  -p, --out-params  output parameters. Keys: codec ("H.264/AVC", "H.265/HEVC",
                    "ProRes", "DNxHD", "CineForm", "EXR Sequence", "PNG
                    Sequence", "AV1"), codec_options (eg. "ProRes 422 HQ"),
                    output_path (or output_folder + output_filename, both
                    absolute), output_width, output_height, bitrate (Mbps),
                    use_gpu, audio, pixel_format (eg. "P210LE"), audio_codec
                    ("AAC", "PCM (s16le)", "PCM (s16be)", "PCM (s24le)", "PCM
                    (s24be)", "Copy" - keeps the original audio, encodes AAC if
                    the output format can't store it), interpolation
                    ("Bilinear", "Bicubic", "Lanczos4", "EWA: RobidouxSharp",
                    "EWA: Robidoux", "EWA: Mitchell", "EWA: Catmull-Rom"),
                    encoder_options, keyframe_distance, preserve_other_tracks,
                    pad_with_black, export_trims_separately, metadata ({{
                    'comment': "..." }}). Eg. "{{ 'codec': 'ProRes',
                    'codec_options': 'ProRes 422 HQ', 'pixel_format': 'P210LE',
                    'output_path': '/path/out.mov' }}"
  -t, --suffix      default output suffix, eg. "_stabilized"
  -s, --sync-params synchronization parameters, eg. "{{ 'search_size': 3,
                    'processing_resolution': 720 }}"
  --stdout-progress print progress to stdout in addition to progress bars
  --optical-correction
                    analyze the video optically before rendering and correct the
                    motion data with it (Motion data -> Optical correction),
                    with this strength in %, eg. 50. Files without motion data
                    get all of their motion measured from the video
  --ignore-file-motion
                    ignore the motion data in the files and measure all of the
                    motion from the video (implies --optical-correction)
  --optical-per-frame
                    correct the motion data once per frame instead of per band
                    of rows, eg. for a global shutter or a rolling shutter time
                    that's unknown (implies --optical-correction)
  --optical-tracking
                    how the optical analysis follows the points: "klt" (default,
                    corners) or "dis" (dense optical flow, for low texture like
                    sky or water; slower) (implies --optical-correction)
  --export-project  export project file instead of rendering: 1 - default
                    project, 2 - with gyro data, 3 - with processed gyro data, 4
                    - video + project file
  --export-metadata export metadata instead of rendering. <type>:<path>, where
                    type is 1 - full metadata, 2 - parsed metadata, 3 - camera
                    data. Eg. "3:camera.json"
  --export-metadata-fields
                    fields to include in the exported camera metadata file.
                    Defaults to all: "{{ 'original': {{ 'gyroscope': true,
                    'accelerometer': true, 'quaternion': true, 'euler_angles':
                    true }}, 'stabilized': {{ 'quaternion': true,
                    'euler_angles': true }}, 'zooming': {{ 'minimal_fovs': true,
                    'fovs': true, 'focal_length': true }} }}"
  --export-stmap    export STmap instead of rendering. <type>:<folder_path>,
                    where type is 1 - single frame, 2 - all frames. Eg.
                    "1:C:/stmaps/"
  --preset          preset (file or content directly), eg. "{{ 'version': 2,
                    'stabilization': {{ 'fov': 1.5 }} }}"
  --open            open file in the GUI (video or project)
  --watch           watch folder for automated processing
  -g, --gyro-file   gyro file path
  -b, --processing-device
                    processing device index. By default it uses the one set in
                    the GUI
  -r, --rendering-device
                    rendering device, specify the GPU type. Eg. "nvidia",
                    "intel", "amd", "apple m"
  --no-gpu-decoding don't use gpu video decoding, default: false
  --version         print app version
  --help, help      display usage information
```


# Other

## Full screen mode

Press **F** or **F11** to enlarge the video. The first press hides the side panels, the second press switches to a real full screen and also hides the timeline, and the third press goes back. **Esc** exits the full screen mode. Double-clicking the video also toggles the first mode.

## Stabilization overview

The **Toggle stabilization overview** button below the video (or **D**) zooms out the preview, so you can see the whole stabilized frame and what the stabilization is doing. It only affects the preview.

**Ctrl + click** on that button while the overview is on (Command on macOS), or **V**, switches to the **split view**: the overview and the final framing are shown side by side (or one above the other, for vertical videos). The split view is remembered.

## Advanced settings

These settings are in the **Advanced** panel on the right.

* **Preview resolution** - the resolution of the preview. Lower it if the preview isn't smooth. It doesn't affect the export.
* **Background mode** - what's shown where the stabilized frame doesn't cover the output (e.g. with **No zooming**, or FOV over 1):
  * **Solid color** - the **Render background** color.
  * **Repeat edge pixels** and **Mirror edge pixels** - fill the area with the edge of the video.
  * **Margin with feather** - blends the edges of the video into a fill taken from further inside the frame, set with **Margin** and **Feather**. Both can be [🔑 keyframed](https://docs.gyroflow.xyz/app/advanced-usage/keyframes).
* **Render background** - the background color, as `#RRGGBB`, or `#AARRGGBB` with transparency. See [Transparent videos](#transparent-videos).
* **Theme**, **UI scaling** and **Language** - the look of the app.
* **Safe area guide** - when FOV is over 1, shows a rectangle of the area FOV 1 would show. It's only a guide in the preview, it doesn't affect the export.
* **Use GPU decoding** - decodes the video on the GPU (hardware decoding). Disable it if a video doesn't load or shows corrupted frames.
* **Format for R3D conversion**, **Colors for R3D conversion**, **Gamma curve for R3D conversion**, **Color space for R3D conversion** and **Additional REDline params** - the settings of the ProRes file made with *REDline* when exporting R3D files. They show up only when REDCINE-X is installed. See [RED -> Exporting](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/red#exporting).
* **Preview pipeline** - how the preview is processed:
  * **Zero-copy Qt RHI** (default) - the fastest, the video never leaves the GPU.
  * **Zero-copy OpenCL** - like the default, but processed with OpenCL.
  * **OpenCL/wgpu/CPU** - copies the frames between the GPU and the CPU. It's slower, but try it if the preview doesn't work.
* **Device for video processing** - the GPU (or **CPU only**) used for the stabilization, both in the preview and in the export. The GPU used for encoding is set separately in `Export settings -> Advanced -> Device for rendering`.
* **Default file suffix** - added to the name of the exported files (default `_stabilized`).
* **Notification sounds** - plays a sound with success and error messages, e.g. when an export is finished.
* **Reset all settings to default** - clears all settings (your favorite lens profiles are kept). Restart Gyroflow afterwards.
* **Open data folder** - opens the folder with Gyroflow's settings, logs and downloaded lens profiles.

## Transparent videos

Set **Render background** to a color with transparency, e.g. `#00000000`, and export to a format that supports it: **PNG sequence**, **EXR sequence**, or **ProRes 4444** / **4444 XQ** encoded on the CPU. The areas outside the stabilized frame are then transparent.

## Render queue

The render queue is saved automatically. If Gyroflow is closed (or crashes) with unfinished items, they're restored the next time you start it. See [⏩ Render queue](https://docs.gyroflow.xyz/app/advanced-usage/render-queue).

## Sleep while rendering

While exporting or analyzing a video, Gyroflow prevents the computer from going to sleep (on phones and tablets, the screen stays on).


# IMU Orientation and rotation

### Gyro rotation

To achieve correct stabilization, the rotation of the motion data needs to match the video. If the IMU sensor is not pointing in the same direction as the camera sensor, then you'll have to rotate the motion data to match. All cameras with internal gyro data already have the correct rotation, but when using external gyro source, chances are you may have to enter the rotation values here.

A common example is using [blackbox gyro data](#user-content-fn-1)[^1] with camera tilted upwards, or a naked BMPCC, where the IMU sensor is on the main board, and the camera sensor is separated.

You can use optical flow data to determine the rotation values. When you change the rotation here, the lines on chart will move as well. Optical flow never moves, so you can change the rotation values by a few degrees and observe how it's changing on the chart, and when they match/align with the optical flow lines.

**`TODO:`**` `` ``Video example of that `

### Accelerometer rotation

In some rare cases, the gyroscope and accelerometer are actually two separate chips, in two different places. If you **right click on the Rotation label** you'll be able to enable **Separate accelerometer rotation.** You can then control gyroscope and accelerometer rotation separately. One example of such setup is the naked GoPro in [Umma95](https://ummagawd.com/products/umma95-beta95x-naked-gopro-cinewhoop-kit) design (you can try accelerometer pitch: 90°).

### IMU orientation

Similar to **gyro rotation**, the IMU orientation field describes the direction of the IMU chip. IMU orientation however, describes the general direction of the IMU chip.

The default value, indicating no direction changes is `XYZ`. This means that the X, Y and Z axes correspond directly to the expected X, Y and Z axes.

If we need to invert an axis, the letter will be lowercased, so `xYZ` will mean the X axis corresponds to the inverted expected X axis, and Y and Z are not changed.

If we need to swap the axes, we can put another axis on the expected position, for example `ZYX` will mean that the X axis corresponds to the Z axis, and Z axis corresponds to the X axis, and Y axis is not changed.

The first letter describes what axis is expected at the X axis, the second letter at the Y axis, and third at the Z axis.

You can use the same technique as described in the **Gyro rotation** section to determine the IMU orientation: Adjust the value and observe the lines on the chart until the light lines (optical flow) and dark lines (motion data) align up.

You can also right click on the timeline and choose **Guess IMU orientation here** to attempt to determine the IMU orientation automatically. Note that this function needs large enough **Sync search size**, same as used for the [**⌛Synchronization**](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization).

**`TODO:`**` `` ``add video example `

[^1]: from your drone flight controller


# Color Differences

If the colors look different after exporting from Gyroflow, in most cases the pixels didn't change: a player or video editor just interprets the color range or the gamma of the file differently.

## What Gyroflow does

Gyroflow processes the video directly in its original YUV format, without converting the colors. The exported file gets the same color metadata as the original: the color range, the color matrix, the transfer curve (gamma) and the color primaries.

A few encoders don't store all of it:

* GPU encoding on macOS (VideoToolbox) doesn't write the transfer curve.
* ProRes encoded on the GPU on macOS from 8-bit 4:2:0 video is always limited range (Gyroflow converts the pixels to match, to work around an encoder bug).
* The H.264/H.265 GPU encoder on Intel Macs ignores the requested color range.

## Color range

The color range is either **Full** (0-255, also called JPEG or Data levels) or **Limited** (16-235, also called MPEG or Video levels), and it's stored in the file metadata. Players, video editors and websites don't always read it the same way:

* Limited range shown as full looks washed out (grey blacks, dull whites).
* Full range shown as limited looks too contrasty (crushed blacks, clipped whites).

In DaVinci Resolve, you can change it in `Clip Attributes -> Data Levels` (Auto, Video or Full).

## Gamma

The transfer curve (gamma) can also be interpreted differently, for example by QuickTime on macOS, or after uploading to YouTube. This happens with any video, not only with files from Gyroflow.

## How to find the cause

Your file can look the same or different at every stage: the original file, the export from Gyroflow, played in VLC, imported in your video editor, exported from the editor, uploaded to YouTube etc. Compare them in the same player, and change one thing at a time. There's no single rule, so find a workflow that works for your setup.

Read more about color range:

* [Color Space and Color Range](https://cinelerra-gg.org/download/CinelerraGG_Manual/Color_Space_Color_Range_Aff.html) (Cinelerra-GG manual)
* [RGB Full vs. Limited](https://referencehometheater.com/2014/commentary/rgb-full-vs-limited/)
* [Data Levels Settings and Conversions](https://coloraggio.github.io/davinci-resolve-manuals/12.5_Manual/6.pdf) (DaVinci Resolve manual)

## Avoiding it altogether

Use one of the [video editor plugins](https://docs.gyroflow.xyz/app/video-editor-plugins/general-plugin-workflow). The editor then reads the original file and applies the stabilization itself, so there's no extra file whose colors could be interpreted differently.


# Using External Gyro Source

If your camera doesn't record motion data, you can record it with a separate device mounted on the camera, and load it in Gyroflow.

## Devices

* [NiYien-A1](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/niyien-a1) - a logger made for Gyroflow, mounted on the hot shoe.
* [Action camera as a logger](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/action-camera-as-a-logger) - e.g. a GoPro mounted on the camera.
* [Flight controller](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/flight-controller) - the blackbox log of your drone.
* [ESP-gyrologger](https://docs.gyroflow.xyz/app/advanced-usage/using-external-gyro-source/esp-gyrologger) - a small open source logger you can build or order.
* [Flowshutter](https://old-docs.gyroflow.xyz/flowshutter/flowshutter/) - an older camera remote that syncs the recording with a flight controller's blackbox (no longer developed).
* [Mobile phones](https://docs.gyroflow.xyz/app/getting-started/supported-cameras/mobile-phones) - apps that record the phone's gyro.
* Any other logger that writes the [GCSV format](https://docs.gyroflow.xyz/app/technical-details/gcsv-format).

## Workflow

1. Mount the logger rigidly to the camera, ideally facing the same direction. A logger that moves or vibrates on its own records motion the camera didn't do.
2. Open the video and choose the lens profile of your camera.
3. Load the log in `Motion data -> Open file`. If it's named like the video (e.g. `clip.gcsv` next to `clip.mp4`), it's loaded automatically.
4. Set the [IMU orientation and rotation](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation), if the logger isn't aligned with the camera.
5. Synchronize: set **Rough gyro offset** and **Sync search size** to cover the time between starting the logger and the camera, and run **Auto sync**. See [Synchronizing external gyro source](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization#synchronizing-external-gyro-source).

{% hint style="info" %}
Without any logger, you can also measure the camera motion from the video itself, with [Optical correction](https://docs.gyroflow.xyz/app/advanced-usage/input-data#optical-correction) (since Gyroflow 1.7.0).
{% endhint %}


# NiYien-A1

## NiYien A1: Camera Stabilizer Box

*Designed for Gyroflow Video Stabilization*

<div><figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FruzoVS3YiC3zu4WsxUas%2Fniyien_a1.png?alt=media&amp;token=2dcd21cd-42e4-4135-920b-25a40951fe40" alt="" width="375"><figcaption></figcaption></figure> <figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fa32eXu8UFzZEZQG41cPX%2Fniyien_a1_fpv.png?alt=media&amp;token=9906acd4-8ce2-4f56-b364-41a13dc3e24f" alt="" width="375"><figcaption></figcaption></figure></div>

***

### 1. Overview

The NiYien A1 is a dedicated external gyroscope for **Gyroflow** — the open-source video stabilization tool. It captures high-precision real-time motion data, which Gyroflow uses to eliminate camera shake for ultra-smooth footage.

***

### 2. Core Advantages

#### 2.1 Compact & Durable Build

* **Hot & Cold Shoe Compatibility**: Snaps to standard camera hot shoes (no extra adapters).
* **Ultra-Lightweight**: Less than 30g — won’t disrupt camera balance or portability.
* **Long Battery Life**: Over 35 hours of continuous recording.
* **High Sampling Rate**: 1000Hz motion capture for accurate stabilization data.
* **Full-Metal Build**: Resists scratches and impacts for long-term use.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FKHHjP5OiLKpkGgg5ZKov%2Fniyien_advantages.png?alt=media&amp;token=64458f81-a360-4202-a2d1-1782c23de0de" alt=""><figcaption></figcaption></figure>

#### 2.2 Hassle-Free Operation

* One-time synchronization with your camera, then it records **continuously**.
* “Set-and-Forget” workflow: Use your camera as usual — no extra steps during shooting.

#### 2.3 NiYien Tool: Streamline Gyroflow (See screenshot below for full features)

A dedicated desktop tool for batch stabilization:

* Preloaded profiles for **100+ camera models** — skip manual lens file creation.
* Batch-adjust Gyroflow settings (Smoothness, Horizon Lock, Static Zoom).
* **Batch export options**: Export stabilized videos or `.gyroflow` project files for plugins in DaVinci Resolve, Premiere Pro (PR), and other video editors.
* Supports vertical shooting, slow-motion, anamorphic lenses, and RAW videos.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F5KMLqEZTtvfoxGJUkihi%2Fniyien_tool.png?alt=media&amp;token=c9479679-9670-4fa9-a7eb-95bed4937bf6" alt=""><figcaption></figcaption></figure>

***

### 3. Support List

The support list is regularly updated — for the latest version, please refer to the display on the sales platform.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FSBxF9KVCZJ6Ahyyg4YiW%2F%E5%89%AF%E5%9B%BE4-%E6%94%AF%E6%8C%81%E7%9B%B8%E6%9C%BA%E5%9E%8B%E5%8F%B7.png?alt=media&amp;token=c968064a-acdb-4b9e-85ba-29e8c47a836c" alt=""><figcaption></figcaption></figure>

Samples:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Flu0Cs5YDOeebVavP1SyZ%2Fniyien_samples.png?alt=media&amp;token=6acd09ed-300f-4d26-8bea-e19101057fe4" alt=""><figcaption></figcaption></figure>

***

### 4. Tutorials & Gallery

* 📚 **Video Tutorial**: <https://www.niyien.com/NiYien_manual_EN.html>
* 📚 **Text Tutorial**: <https://www.niyien.com/NiYien_txt_manual_EN.html>
* 📚 **Video Gallery**: <https://youtube.com/playlist?list=PLojP8A0Y0pejRVO1qT3Jbav6641m4fg9V&si=grJqOwnqD2Rt7YxX>
* 📚 **Test Files**：<https://drive.google.com/file/d/1Gv2pa0O_0LAM6vweo7HD8dQ8uZKv2r2K/view?usp=sharing>

***

### 5. Purchase

* 📦 **Amazon (US)**: <https://www.amazon.com/dp/B0FPMLBK45>
* 📦 **Amazon (US Prime)**: <https://www.amazon.com/dp/B0FWJRNP3W>
* 📦 **Avito (Russia)**: <https://www.avito.ru/moskva/fototehnika/stabilizator_dlya_lyuboy_kamery_niyien_senseflow_a1_7830074159>
* 📦 **AliExpress：**&#x53;earch "NiYien gyroscope"

***

### 6. Support

* 📧 **Support Email**: Technical help (troubleshooting, setup issues) at <support@niyien.com>.
* 📧 **Sales Email**: Inquiries about bulk orders, partnerships, or purchase quotes at <sales@niyien.com>, <rocky@niyien.com>(US saler)
* 💬 **Discord**: Join for real-time support, user discussions, and product update notifications at <https://discord.gg/dyna2DtqEA>


# Action Camera as a Logger

Due to the flexibility of Gyroflow, the gyro source and the video source can be "mismatched". This means that an action camera with internal gyro logging (e.g. GoPro) can be mounted to a high-end cinema camera acting as a gyro logger. This setup is illustrated below.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FtK0wKKgyVGGR9uLH3pGB%2Fimage.png?alt=media&amp;token=47d9ec9c-21cf-429a-a139-7368f4d58d52" alt=""><figcaption></figcaption></figure>

The advantages of this setup is the availability of GoPros/Insta360 cameras among filmmakers, meaning no additional hardware other than some fasteners.

With this setup, a number of things should be considered:

* The cinema camera and logger camera should be rigidly attached to each other to avoid mismatching motion data.
* The two should ideally be oriented in the same direction to avoid additional angle corrections.
* Starting recording of the two cameras at almost the same time, or with a small fixed offset (e.g. 10 seconds) makes synchronization easier.

This setup has successfully been used with GoPro Hero 6/8/9, the Insta360 OneR/Go 2 among others. In general, any camera with gyro logging should work, assuming the gyro data is clean and correct.

When using a GoPro hero 8 or newer as a gyro logger, the internally computed orientations (`None` integration method) should not be used, since these orientations only correspond to each frame from the GoPro file.

It is important that the gyro rotations correspond to the actual sensor of another camera, so you have to make sure they are aligned. For more information see:

{% content-ref url="/pages/iyIecf2ElAR0hWgBhtym" %}
[IMU Orientation and rotation](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation)
{% endcontent-ref %}


# Flight Controller

Betaflight/Cleanflight/Inav/Emuflight/etc form a popular family of flight control firmware for high-performance multicopters. By using the built-in blackbox logging feature, gyro data for use with Gyroflow video stabilization can be collected. This was in fact one of the initial goals of the project! Betaflight, Cleanflight, Inav, Emuflight etc. all use more or less the same structure for handling blackbox data logging, so this page covers all of these.

### Hardware <a href="#hardware" id="hardware"></a>

As you may already know, the above mentioned flight firmwares can all run on the same type of hardware. A flight controller supporting this family of flight firmwares typically contain:

* STMicroelectronics 32 bit microcontroller (F4, F7, G4, H7)
* MEMS inertial measurement unit (MPU6000, BMI270, ICM2xxxx, ICM4xxxx etc.)

Some flight controllers have an onboard magnetometer. In general, this is not required for video stabilization purposes unless absolute orientation is desired.

Different gyros exhibit different behaviors in terms of data quality, noise, etc. In general, if the IMU is capable of providing clean data for the drone control loop, the same data is suitable for video stabilization purposes.

For blackbox data logging, the hardware typically either contains an onboard SPI Flash chip, or a slot for an SD card. If neither of these are available, additional hardware solutions can be connected to the flight controller in order to enable blackbox logging. This can be using:

* [The Openlager](https://github.com/d-ronin/openlager) - A open source and commercially available board containing an STM32f4 and a MicroSD slot for logging high rate data through a spare serial port.
* [Tiny Blackbox](https://github.com/alexeystn/tiny-blackbox) - An open source ultra-light logger containing a 16 MB flash chip.
* [~~SparkFun OpenLog~~](https://github.com/sparkfun/OpenLog) - A serial-based logger similar to the Openlager. This is no longer officially supported by Betaflight etc. due to data rate limitations.

### Betaflight/(Cleanflight/Emuflight?) <a href="#betaflightcleanflightemuflight" id="betaflightcleanflightemuflight"></a>

Required software:

* Betaflight/Cleanflight/Emuflight configurator
* Betaflight blackbox explorer

The following should be a decent starting point for the blackbox configuration

* 250 Hz logging rate
* Debug mode: `None`

If you're running Betaflight 4.3 or newer, it is possible to deselect specific elements of the data logging in order to save precious recording space.

### Gyroflow logger preset <a href="#gyroflow-logger-preset" id="gyroflow-logger-preset"></a>

We have a gyroflow-betaflight presets source for your convenience. You can easily set it up like the picture shown below:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FTFq2RbEAAvQzNKuA3p8a%2Fimage.png?alt=media&amp;token=a2a792de-b613-4996-85db-ace56095fa97" alt=""><figcaption></figcaption></figure>

Once the gyroflow logger preset is actived, you'll see some special gyroflow presets:

* **Gyroflow minimal settings**: for users who wanna use the blackbox data from main FC as motion data for video stabilization.
* **Sencondary FC as Gyroflow motion logger**: for users who use a secondary FC as a gyroflow motion logger.
* **Gyroflow BMI270 Filter sttings**: for users whose FC has a BMI270 sensor and want to use it as a gyroflow motion logger.
* **Flowbox target settings**: preset for flowbox and flowbox+flowshutter

#### CLI commands <a href="#cli-commands" id="cli-commands"></a>

Or you might prefer the "old fashion", from the CLI:

```
set blackbox_disable_pids = ON
set blackbox_disable_rc = ON
set blackbox_disable_setpoint = ON
set blackbox_disable_bat = ON
set blackbox_disable_mag = ON
set blackbox_disable_alt = ON
set blackbox_disable_rssi = ON
set blackbox_disable_debug = ON
set blackbox_disable_motors = ON
set blackbox_disable_gps = ON
```

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FguJa7yg2mZXwHmqpdmP4%2Fimage.png?alt=media&amp;token=f40c9dd2-c1e1-49ef-9b1b-4548dda1b611" alt=""><figcaption></figcaption></figure>

### Camera angle <a href="#camera-angle" id="camera-angle"></a>

The flight controller is mounted flat, while the camera is usually tilted up. Enter the camera angle in `Motion data -> Rotation -> Pitch`: positive when the camera is tilted up, negative when it's tilted down. For example, for a camera tilted up 30°, enter `30`.

If the stabilization still drifts or wobbles, adjust the angle by a few degrees and compare the lines on the chart, see [🔀 IMU orientation and rotation](https://docs.gyroflow.xyz/app/advanced-usage/imu-orientation-and-rotation).

### Multiple logs in one file <a href="#multiple-logs" id="multiple-logs"></a>

A blackbox file can contain several logs, e.g. one per flight. Gyroflow then shows **Select log** in the Motion data panel, where you can choose the log of your flight, or **All logs combined**.

### Acknowledgements <a href="#acknowledgements" id="acknowledgements"></a>

* [logger-presets](https://github.com/gyroflow/logger-presets): Forked from betaflight/firmware-persets


# ESP-gyrologger

[esp-gyrologger](https://github.com/VladimirP1/esp-gyrologger) is an open source motion data logger by Vladimir Pinchuk. It's a firmware for the ESP32 and ESP32-C3 microcontrollers with a BMI270, BMI160 or MPU6050 gyro. It's small and light, so you can mount it on any camera that doesn't record motion data, and load its logs in Gyroflow.

* It's set up from a web page over its own Wi-Fi network, where you also change the settings and calibrate the accelerometer.
* You can also connect a button and a LED to start and stop the recording.
* You'll have to synchronize the logs with the video, see [Synchronizing external gyro source](https://docs.gyroflow.xyz/app/getting-started/basic-usage/synchronization#synchronizing-external-gyro-source).

## DIY

You can build one from an ESP32 or ESP32-C3 board with 4 MB of flash and a gyro module, connected with 4 wires. The [repository](https://github.com/VladimirP1/esp-gyrologger#how-to-flash-and-get-started-with-the-diy-version) has the wiring, the firmware download, the flashing steps and a video tutorial.

## Ready-made boards (PCBA)

There are PCB designs for a tiny dedicated board (EspLog, 11 x 14 mm) that you can order assembled from a PCB manufacturer:

* the original 4-layer design: [EasyEDA project](https://oshwlab.com/vladimir.pinchuk01/gyro-logger-esp32c3_copy)
* 2-layer designs, including one with a 4.5-30 V input: [esplog-hardware](https://github.com/VladimirP1/esplog-hardware) (KiCad 6)


# Live Feed Stabilization

Stabilization of a live (real-time) feed is something Gyroflow would like to support eventually. It's not available yet, mostly due to lack of standards for sending gyro data.

Some discussion about live stabilization is available at [#dev-live-stabilization](https://discord.com/channels/797044698682228736/1055194134622765077) channel on [Discord](https://discord.com/invite/BBJ2UVAr2D).

1. Currently Gyroflow is not designed to do live stabilization
2. There is no standard IMU data transmission, so that is most important part to figure out or standardize or have any examples if you want to push this topic further
3. For testing, we can try with synthetic "live" data, ie. take a standard GoPro file with gyro data, and stream it from another app, stream the IMU data and pretend it's live. Then work on supporting that in Gyroflow
4. There is no timeline on when that would be supported, mainly due to not enough concrete data. Everyone's setup is different so I don't have anything to work on at this moment. This has to be figured out
5. One potential solution is to create an OBS plugin which does the stabilization using [`gyroflow_core`](https://docs.gyroflow.xyz/app/technical-details/gyroflow-core)
6. Another one is to open RTSP stream in the Gyroflow app (`mdk-sdk` already supports that) and render it in the UI with zero-copy Qt-RHI, and use the true full screen mode (F11 key twice) - this way it could be streamed further over HDMI (acting like a monitor but connected to HDMI capture card)

### Contributions are welcome!


# 360° Cameras

360° cameras are not supported by Gyroflow and adding support is not planned at the moment.

Since Gyroflow 1.7.0, Gyroflow can read the motion data of some 360° cameras: Insta360 X5, Insta360 Antigravity A1, DJI Osmo 360 and DJI Avata 360. It can't play their 360° video files, and stabilizing stitched 360° video is still not supported.


# NVIDIA

NVIDIA graphic cards support hardware accelerated encoding on Windows and Linux

NVIDIA GPUs since GeForce GTX 600 (2012) have the hardware accelerated video encoder called NVENC. At first it was just supporting H.264/AVC, but H.265/HEVC is also supported since the GeForce GTX 900 series (2014).

The NVENC encoder is well supported in Gyroflow and offers fast video render times on Windows and Linux.

{% hint style="warning" %}
**Important!** Always make sure you have the latest driver installed from the official [NVIDIA Drivers](https://www.nvidia.com/download/index.aspx?lang=en-us) page. As long as your GPU has the hardware encoder, most acceleration issues are solved by installing the latest driver.
{% endhint %}

## Supported graphic cards

Refer to the official [Support Matrix](https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new) at nvidia.com.

Make sure you are checking the correct codec (H.264 or H.265) and video bit-depth.

Read more about NVENC on [Wikipedia](https://en.wikipedia.org/wiki/Nvidia_NVENC).

## 10-bit support

H.265 10-bit encoding is supported since the GeForce GTX 10 series (Pascal). AV1 supports 10-bit as well. Refer to the official [Support Matrix](https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new) for your GPU.

## AV1 support

Since Gyroflow 1.7.0, you can export AV1. It's encoded on the GPU only, so it needs a GeForce RTX 40 series or newer card.

## ProRes/DNxHD support

NVIDIA's NVENC supports only H.264, H.265 and AV1. No other codec is hardware accelerated on NVIDIA cards.

## Maximum supported resolution

* H.264 - 4096x4096 on all cards.
* H.265 - 4096x4096 on the GTX 900 series, 8192x8192 since the GTX 10 series.
* AV1 - 8192x8192.

Check the [Wikipedia](https://en.wikipedia.org/wiki/Nvidia_NVENC) article to learn more.


# AMD

AMD graphic cards support hardware accelerated encoding on Windows and Linux

AMD GPUs have the hardware accelerated video encoder called *Advanced Media Framework*.

The AMF[^1] encoder is well supported in Gyroflow and offers fast video render times on Windows and Linux.

{% hint style="warning" %}
**Important!** Always make sure you have the latest driver installed from the official [AMD Drivers](https://www.amd.com/en/support) page. As long as your GPU has the hardware encoder, most acceleration issues are solved by installing the latest driver.

However, someone reported a crash in a certain driver with Rx550, so if you're getting [this issue](https://github.com/gyroflow/gyroflow/issues/677), try a different driver version.
{% endhint %}

## Supported graphic cards

Refer to the official product page on amd.com to find out if it supports hardware video encoding.

For example the [AMD Radeon™ RX 6800](https://www.amd.com/en/products/graphics/amd-radeon-rx-6800) supports both H.264 and H.265 encoding, as per the specification:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fb4AVwwirbtojHp41na7H%2Fimage.png?alt=media&amp;token=2a40cd70-0087-4d36-9f69-c93f1253492c" alt=""><figcaption><p>Look for H264 Encode and HEVC Encode in the specs</p></figcaption></figure>

## 10-bit support

H.265 10-bit encoding is supported since the Radeon RX 5000 series (VCN 2.0), and in Ryzen APUs with VCN 2.0 or newer. H.264 is always 8-bit. AV1 (RX 7000 series and newer) supports 10-bit as well. See the [AMF hardware support table](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/GPU-and-APU-HW-Features-and-Support) for your GPU.

## AV1 support

Since Gyroflow 1.7.0, you can export AV1. It's encoded on the GPU only, so it needs a Radeon RX 7000 series or newer card.

## ProRes/DNxHD support

AMD's AMF encoder supports only H.264, H.265 and AV1. No other codec is hardware accelerated on AMD cards.

## Maximum supported resolution

* H.264 - 4K on all cards.
* H.265 - 4K on the RX 5000 series (VCN 2.0), 8K on the RX 6000 series (VCN 3.0) and newer.
* AV1 - 8K.

Gyroflow itself limits H.264 to 4096x4096, and H.265 and AV1 to 8192x8192. The per-GPU limits are listed in the [AMF hardware support table](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/GPU-and-APU-HW-Features-and-Support).

## Known issues

Some AMD GPU encoders have a bug where it limits the bitrate to 20 Mbps, if the target bitrate is greater than 100 Mbps. Please check the file bitrate after rendering and if you're affected by this bug, you can either:

* Set output bitrate to less than 100 Mbps
* Use **Custom encoder options**: `-rc cqp -qp_i 28 -qp_p 28`

[^1]: Advanced Media Framework


# Intel

Intel graphic cards support hardware accelerated encoding on Windows and Linux

Intel GPUs have the hardware accelerated video encoder called *Intel® Quick Sync Video*.

The QSV[^1] encoder is well supported in Gyroflow and offers fast video render times on Windows and Linux.

{% hint style="warning" %}
**Important!** Always make sure you have the latest driver installed from the official [Intel drivers](https://www.intel.com/content/www/us/en/support/detect.html) page. As long as your GPU has the hardware encoder, most acceleration issues are solved by installing the latest driver.
{% endhint %}

## Supported graphic cards

Refer to the [Wikipedia](https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video) page for a list of supported hardware.

Quick Sync is part of Intel's integrated graphics and of the Intel Arc GPUs. It's available on Intel CPUs with integrated graphics, but not on the ones without it (models ending with F, e.g. Core i5-12400F).

## 10-bit support

Hardware accelerated encoding of 10-bit videos is supported only by the latest hardware. Refer to the [Wikipedia](https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video) page to check if your GPU supports 10-bit video encoding.

## AV1 support

Since Gyroflow 1.7.0, you can export AV1. It's encoded on the GPU only, so it needs an Intel Arc or newer GPU.

## ProRes/DNxHD support

*Intel® Quick Sync Video* supports only H.264, H.265 and AV1. No other codec is hardware accelerated on Intel hardware.

## Maximum supported resolution

* H.264 - 4K on all generations.
* H.265 - 4K on 6th-10th gen Core (Skylake to Comet Lake), 8K on Ice Lake and 11th-14th gen Core, and 16K (16384x12288) on Intel Arc and Core Ultra.
* AV1 - 8K.

Gyroflow itself limits H.264 to 4096x4096, and H.265 and AV1 to 8192x8192. The per-generation limits are listed in [Intel's media driver documentation](https://github.com/intel/media-driver/blob/master/docs/media_features.md#supported-encoding-input-format-and-max-resolution).

[^1]: Intel® Quick Sync Video


# Apple

macOS supports hardware video encoding (H.264/H.265) on most devices, with ProRes acceleration added in the Apple Silicon chips.

Hardware video encoding on macOS uses the *VideoToolbox* framework from Apple. Most devices are supported.

Intel devices support basic H.264 and H.265 modes (8-bit only), while M1 chips and newer added more formats and the ProRes encoder.

{% hint style="info" %}
Apple Silicon (M1-M5) devices are recommended, because they support more video features, including ProRes encoder.
{% endhint %}

It's also highly recommended to update to the newest macOS version, as the video encoding features are evolving pretty quickly.

## Hardware acceleration support

<table><thead><tr><th width="240">Processor</th><th width="85">H.264</th><th width="91">H.265</th><th>ProRes</th></tr></thead><tbody><tr><td>Intel</td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td>M1</td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td>M1 Pro/Max/Ultra</td><td>✅</td><td>✅</td><td>✅</td></tr><tr><td>M2<br>M3<br>M4<br>M5</td><td>✅</td><td>✅</td><td>✅</td></tr></tbody></table>

{% hint style="info" %}
AV1 export (added in Gyroflow 1.7.0) isn't available on macOS and iOS, because VideoToolbox has no AV1 encoder.
{% endhint %}


# Android

On Android, Gyroflow encodes H.264/AVC and H.265/HEVC with the phone's hardware video encoder (MediaCodec).

Since Gyroflow 1.7.0, you can also export AV1 on phones that can encode AV1.


# General Plugin Workflow

Gyroflow plugin for a video editor allows you to stabilize the video directly inside the video editor, where you work with the original video file, instead of rendering a stabilized video in the app and then importing it to the video editor.

If your camera has official lens-profiles and accurate gyro timing (GoPro 8+, Sony, Insta360, DJI, Z CAM), then you should be able to just apply the plugin to your clip. In the Adobe plugin, it should load the gyro data automatically. In Resolve, you should click "Load for current file" or use the "Browse" button to select your video file or the `.gyroflow` project file.

Since Gyroflow supports a lot of different cameras and gyro sources, it's practically impossible to recreate all tools it offers (for example synchronization with optical flow) inside the plugin UI.

If your camera requires synchronization (RunCam, Hawkeye, phone apps, blackbox, etc.) or a lens profile you choose yourself (e.g. Blackmagic or RED), the workflow starts inside the main Gyroflow app, where you load your video, lens profile, gyro data, you do all synchronization and parameters, but **instead of rendering - you export a project file** which includes all your parameters and gyro data. This can be easily done by **Ctrl + S** shortcut, or using **Export -> Export project file (including gyro data)**.

This exported project file is then loaded inside the Gyroflow plugin in your video editor and the plugin will process your pixels directly inside your editor according to the gyro data and all your parameters, but without any transcoding, recompression or additional processing.

This is especially important when working with RAW files (like BRAW, R3D or Canon's CRM), where you retain all your RAW controls like ISO, White Balance etc.

The plugins use the same stabilization engine as the app, so the improvements in Gyroflow 1.7.0 (Sony support, lens breathing compensation and the new lens math) apply in the plugins as well. The **Output projection** and the **Static zoom** zoom level from projects and presets made in the app are used too.

### Installation

The easiest way to install or update the OpenFX and Adobe plugins is the **Video editor plugins** panel in the Gyroflow app, at the bottom of the right side (on Windows and macOS, when a supported video editor is installed). Manual installation is described on the page of each plugin.

### Default settings

The plugin has a **Save as default** button. It saves the current smoothness, zoom limit, lens correction, horizon lock and FOV as the defaults for every newly loaded clip, so you can change e.g. the default 130% zoom limit.

### Vertical video

Vertical footage works correctly on a vertical timeline, when the footage and the timeline have the same aspect ratio.

### Anamorphic lenses

If your lens profile uses **Input stretch** (e.g. for an anamorphic lens) and your video editor already does the desqueeze, enable **Disable lens stretch (for plugins)** when creating a preset in the app, so the plugin doesn't stretch the video again. See [⚙ Settings presets](https://docs.gyroflow.xyz/app/advanced-usage/settings-presets).

### Currently supported video editors:

* [DaVinci Resolve (OpenFX)](https://docs.gyroflow.xyz/app/video-editor-plugins/davinci-resolve-openfx)
* [MAGIX Vegas (OpenFX)](https://docs.gyroflow.xyz/app/video-editor-plugins/davinci-resolve-openfx)
* [The Foundry Nuke (OpenFX)](https://docs.gyroflow.xyz/app/video-editor-plugins/davinci-resolve-openfx)
* [ASSIMILATE Scratch (OpenFX)](https://docs.gyroflow.xyz/app/video-editor-plugins/davinci-resolve-openfx)
* [Adobe Premiere](https://docs.gyroflow.xyz/app/video-editor-plugins/adobe-premiere-after-effects)
* [Adobe After Effects](https://docs.gyroflow.xyz/app/video-editor-plugins/adobe-premiere-after-effects)
* [Kdenlive (frei0r)](https://docs.gyroflow.xyz/app/video-editor-plugins/frei0r)
* [Shotcut (frei0r)](https://docs.gyroflow.xyz/app/video-editor-plugins/frei0r#shotcut)
* [Final Cut Pro X](https://docs.gyroflow.xyz/app/video-editor-plugins/final-cut-pro-x)


# DaVinci Resolve (OpenFX)

Gyroflow engine is also available as an OpenFX plugin to allow you to stabilise videos inside a video editor like DaVinci Resolve.

## Installation

The Gyroflow OpenFX Plugin works on Mac, Windows and Linux.

{% hint style="success" %}
**The easiest way** to install or update the plugin is from the Gyroflow app: in the **Video editor plugins** panel at the bottom of the right side, below **Advanced**, click **Install** (or **Update**) next to **OpenFX**. The panel shows up on Windows and macOS when DaVinci Resolve or another OpenFX host is installed.
{% endhint %}

To install it manually:

{% tabs %}
{% tab title="Mac" %}

### Installing the OpenFX plugin

1. Download the latest version from <https://gyroflow.xyz/download#plugins>
2. Create the OFX folder: `/Library/OFX/Plugins`. You can do that in Finder or in the Terminal: `sudo mkdir -p /Library/OFX/Plugins ; open /Library/OFX/Plugins`.
3. Run `Gyroflow-OpenFX-macos.dmg`
4. Copy `Gyroflow.ofx.bundle` folder to `/Library/OFX/Plugins/`

{% hint style="info" %}
**IMPORTANT:** Make sure the OFX folder is in the root `/Library` folder, not your user `/Users/YOUR-USER-NAME/Library` folder.
{% endhint %}

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FQzbCjOvuYFJ9hZvoIIq2%2FImage%2015-02-2023%20at%2016.44.jpg?alt=media&amp;token=47ac70d7-dcc9-4b5f-9422-0a386d0fd80e" alt=""><figcaption><p>Properly installed plugin on macOS</p></figcaption></figure>

### Hardware Acceleration

Gyroflow OFX plugin supports **Metal** acceleration on Mac.
{% endtab %}

{% tab title="Windows" %}

### Installing the OpenFX plugin

1. Download the latest version from <https://gyroflow.xyz/download#plugins>
2. Extract `Gyroflow-OpenFX-windows.zip` somewhere
3. Create the OFX folder: `C:\Program Files\Common Files\OFX\Plugins`.
4. Copy `Gyroflow.ofx.bundle` folder to `C:\Program Files\Common Files\OFX\Plugins`

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F2uvoD7QCMH2yWJ5KxUOC%2Fimage.png?alt=media&amp;token=7acf3ce6-d454-443b-8d0d-68c7e55a30f9" alt=""><figcaption><p>Properly installed plugin on Windows</p></figcaption></figure>

### Hardware Acceleration

Gyroflow OFX plugin supports **OpenGL**, **OpenCL** and **CUDA** acceleration on Windows
{% endtab %}

{% tab title="Linux" %}

### Installing the OpenFX plugin

1. Download the latest version from <https://gyroflow.xyz/download#plugins>
2. Create the OFX folder: `/usr/OFX/Plugins`.
   1. You can do that in the Terminal: `sudo mkdir -p /usr/OFX/Plugins && sudo chown $USER /usr/OFX/Plugins`.
3. Extract `Gyroflow-OpenFX-linux.zip` to `/usr/OFX/Plugins`

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FObAljZrjz48K2lobIbGU%2Fimage.png?alt=media&amp;token=94d445de-35c2-479f-ac25-f677ceeef331" alt=""><figcaption><p>Properly installed plugin on Linux</p></figcaption></figure>

### Hardware Acceleration

Gyroflow OFX plugin supports **OpenGL**, **OpenCL** and **CUDA** acceleration on Linux
{% endtab %}
{% endtabs %}

## Source Code

You can find the source code for this OpenFX plugin on GitHub [here](https://github.com/gyroflow/gyroflow-plugins).

## Nightly Builds

Development moves fast and there are new features added very often, check them out by downloading the nightly build:

* [Nightly OpenFX Build for Mac](https://nightly.link/gyroflow/gyroflow-plugins/workflows/release/main/Gyroflow-OpenFX-macos.zip)
* [Nightly OpenFX Build for Windows](https://nightly.link/gyroflow/gyroflow-plugins/workflows/release/main/Gyroflow-OpenFX-windows.zip)
* [Nightly OpenFX Build for Linux](https://nightly.link/gyroflow/gyroflow-plugins/workflows/release/main/Gyroflow-OpenFX-linux.zip)
* [Nightly Gyroflow Build](https://gyroflow.xyz/devbuild/?autodownload)

The list of all nightly builds is available on [GitHub actions](https://github.com/gyroflow/gyroflow-plugins/actions).

## Supported Hosts

This **OpenFX** plugin has been primarily built for Blackmagic's **DaVinci Resolve**, however it has also been tested in **MAGIX Vegas** and **ASSIMILATE Scratch**.

It may also work in other OpenFX-compatible hosts, such as **Baselight**, **DVS Clipster**, **Nuke** & **Flame**, however it's currently untested.

If you would like to use this OpenFX Plugin in another application, and it's not working correctly, please [post a GitHub issue](https://github.com/gyroflow/gyroflow-plugins/issues).

## Interface

This section explains the various sections of the OpenFX Plugin Interface.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F9kxhy3GXu5vHnxab8qnB%2Fdavinci-resolve-mac-gyroflow-interface.png?alt=media&amp;token=b5fcccf4-dfeb-49b7-b8a9-74a3550fa22e" alt=""><figcaption></figcaption></figure>

### Gyroflow Project

#### Load for current file

This feature relies on external scripting and is only available in paid DaVinci Resolve Studio.

To use this feature, you also have to allow executing external scripts.

You can do this by going to **Preferences...**

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FdI6hnRpNb4QDqWt8sRoV%2Fdavinci-resolve-mac-preferences.png?alt=media&amp;token=441e34d8-8ab1-49e9-9558-2ab299fc1a68" alt=""><figcaption></figcaption></figure>

Then within the **General** section, make sure **External scripting using** is set to **Local**.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FfJCyywkctJidh1JnKQB4%2Fdavinci-resolve-mac-general.png?alt=media&amp;token=aa772e08-17e5-4d84-ab09-ea6d134c2a11" alt=""><figcaption></figcaption></figure>

For this feature to work, you must have the clip you want to apply Gyroflow to selected in the **Edit** page or in the **Color** page.

It is also impossible to query file path on a **Compound Clip**. In any case, you can just select the video or project file using the **Browse** button, as explained next...

#### Browse

If you're not able to use the **Load for current file** feature, you can manually **Browse** for a Gyroflow Project. Just click the **Browse** button and navigate to wherever your Gyroflow Project is saved.

The OpenFX Plugin will remember the last opened folder.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FaZo8Giu9sHl0vmPI4r7G%2Fdavinci-resolve-mac-gyroflow-browse.png?alt=media&amp;token=7323659a-ea05-423d-ae09-1c1bec25db1d" alt=""><figcaption></figcaption></figure>

#### Load preset/lens profile

Clicking the **Load preset/lens profile** button allows you to select a **Preset** or **Lens Profile**.

Lens calibration is a very important piece of the stabilization algorithm and it's very important to use accurate lens profile when stabilizing a video in Gyroflow. You can learn more [here](https://docs.gyroflow.xyz/app/getting-started/lens-calibration).

The built-in lens profiles are stored in one compressed file, so you can't pick them here directly. You can download a lens profile (`.json`) from the [lens profile database](https://github.com/gyroflow/lens_profiles). Your own lens profiles and presets are in the `lens_profiles` folder in Gyroflow's data folder (`Advanced -> Open data folder` in the app).

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Ftp6JfIdLcFcUtpyv5aOg%2Fdavinci-resolve-mac-gyroflow-load-preset.png?alt=media&amp;token=abe01f02-c001-47d9-8b32-390c83faedd2" alt=""><figcaption></figcaption></figure>

#### Open in Gyroflow

If you already have a Gyroflow Project loaded, pressing **Open in Gyroflow** will open this project in Gyroflow. If you don't already have a Gyroflow Project loaded, this will just open Gyroflow in it's default state.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FN2Z6lETF9PggF9BV5Aeu%2Fdavinci-resolve-mac-gyroflow-open.png?alt=media&amp;token=cd2848f0-af67-4260-a173-b3083e73b967" alt=""><figcaption></figcaption></figure>

#### Reload Project

If you already have a Gyroflow Project loaded, pressing the **Reload Project** button will reload the project from the filesystem. This is useful if you've made changes in the main Gyroflow application, but now want to update the OpenFX Plugin.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FOEfYLlairAoRN0zGsFeX%2Fdavinci-resolve-mac-gyroflow-reload-project.png?alt=media&amp;token=3c3f2f06-e992-4485-934b-2f29a3ff4ce5" alt=""><figcaption></figcaption></figure>

#### Last saved project

This is a convenince function that allows you to load the last saved project in the main Gyroflow application to the OpenFX plugin. This is useful if you're working on the free version of DaVinci Resolve, and you don't have access to the **Load for current file** feature.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F3xUqf7ImiElIOowQwZ7H%2Fdavinci-resolve-mac-gyroflow-last-saved.png?alt=media&amp;token=70381a58-1be9-4a1f-ac71-5dfc43cce136" alt=""><figcaption></figcaption></figure>

#### Status Message

Underneath the **Last saved project** button is a checkbox that displays a status message. This is useful to determine if everything is working correctly, or if there's any issues or problems - for example, a frames per second mismatch:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FTmY1LGSdURPDgA2CyWAc%2Fdavinci-resolve-mac-gyroflow-mismatch.png?alt=media&amp;token=b61c9d6b-79a1-4b6a-b94d-c041ca59be0c" alt=""><figcaption></figcaption></figure>

If everything is correct and working, you'll see this:

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FxI2qyiqDvIOk3pqPEkWM%2Fdavinci-resolve-mac-gyroflow-ok.png?alt=media&amp;token=b78d85c5-25e0-4e06-9ac6-7b6f9ea2d933" alt=""><figcaption></figcaption></figure>

If the file doesn't contain motion data, the status shows **No gyro data in this file**. DaVinci Resolve gives the plugin exact timing at any frame rate, so in Resolve the frame rate mismatch status isn't shown.

### Adjust Parameters

This section allows you to manually adjust several Gyroflow parameters directly within the OpenFX plugin. You can also apply keyframes.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FTcvMlOvWSjlMmQ6ybQG1%2Fdavinci-resolve-mac-gyroflow-adjust-parameters.png?alt=media&amp;token=4b43713c-0260-40a5-a4c8-8d0a3c9965a2" alt=""><figcaption></figcaption></figure>

#### Input & Video Rotation

**Input Rotation** is when the Host (i.e. DaVinci Resolve) rotates the input pixels before feeding to the OpenFX Plugin. For example, if an `.mp4` contains rotation in the metadata, the Host will automatically rotate it. Gyroflow expects raw pixels directly from the source file, so if the Host has already rotated them, it won't match. Given this, the **Input rotation** is the rotation done by the host BEFORE feeding to the OpenFX plugin, whereas **Video rotation** is a rotation by the Gyroflow engine AFTER stabilisation.

#### Video Speed

Use this slider to change video speed or keyframe it, instead of built-in speed changes in the editor.

#### Disable Gyroflow's stretch

If you used Input stretch in the lens profile in Gyroflow, and you de-stretched the video separately in Resolve, check this to disable Gyroflow's internal stretching.

### Keyframes

This section allows you to control how the OpenFX handles keyframes.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2Fr0ueOyRs6EYOB3rxH7g7%2Fdavinci-resolve-mac-gyroflow-keyframes.png?alt=media&amp;token=e66256e0-d327-4bf7-bb1d-e57cf22d5795" alt=""><figcaption></figcaption></figure>

#### Use Gyroflow's keyframes

Ticking this uses Gyroflow's internal keyframes, instead of the ones in your host application (i.e. DaVinci Resolve). This is enabled by default.

#### Recalculate keyframes

This button allows you to recalculate keyframes after adjusting the splines (in Fusion mode).

### Additional Settings

This section covers the additional settings at the bottom of the OpenFX settings.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FBleWhZwmyRSfgTNHRSDV%2Fdavinci-resolve-mac-gyroflow-additional.png?alt=media&amp;token=ad009f44-3d49-40da-8bd9-cc9e54235933" alt=""><figcaption></figcaption></figure>

#### Stabilization overview

This allow you to zoom out the view to see the stabilization results. This is very useful to see if and how Gyroflow is working. You should disable this before rendering.

#### Don't draw outside source clip

When clip and timeline aspect ratio don't match, draw the final image inside the source clip, instead of drawing outside it.

#### Embed .gyroflow data in plugin

If you intend to share the host (i.e. DaVinci Resolve) project to someone else, the plugin can embed the Gyroflow project data including gyro data inside the host project. This way you don't have to share `.gyroflow` project files. Enabling this option will make the project bigger. This option is off by default.

## Workflow

### Vertical Video or different aspect ratio

Vertical footage on a vertical timeline works directly, when the footage and the timeline have the same aspect ratio.

If your timeline has different aspect ratio than your source video (e.g. horizontal footage on a vertical timeline), the first thing you have to do is change your timeline settings -> Mismatched resolution to "**Scale entire image to fit**"

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2F7Fq8SCVpkFsWP53kGtNr%2Fimage.png?alt=media&amp;token=24f19ae0-73f9-45d4-9b93-978aed286e95" alt=""><figcaption></figcaption></figure>

Then you have two options:

1. The preferred option is to add the Gyroflow OpenFX plugin in a Fusion node, then set the target resolution in the **Output size** area in the plugin. Then go to plugin Settings and check **Use plugin RoD for output size** and then you can continue on the vertical timeline in the edit/color pages. For this to work correctly, you have to change **Clip attributes -> Image Orientation** to **0°**, and then in plugin set **Video rotation** to **90** or **-90** and **Input rotation** to **0°.**
2. Alternatively, change your timeline scaling settings to **Scale image to fit** instead of **Scale image with crop** - this is easier method but if you have 16:9 video that you want to export as 9:16, it will negatively affect the quality.

### Frame Rate Mismatch

In DaVinci Resolve, the plugin's timing is exact at any timeline frame rate.

In other OpenFX hosts, if your timeline has different frame rate than the source file, you may experience broken stabilization. The plugin tries its best to adapt to the frame rate differences, but sometimes it's not possible.


# Adobe Premiere / After Effects

Gyroflow engine is also available as an Adobe plugin to allow you to stabilize videos inside Adobe Premiere or Adobe After Effects.

## Installation

The Gyroflow Adobe Plugin works on Mac and Windows.

{% hint style="success" %}
**The easiest way** to install or update the plugin is from the Gyroflow app: in the **Video editor plugins** panel at the bottom of the right side, below **Advanced**, click **Install** (or **Update**) next to **Adobe**. The panel shows up when Adobe Premiere Pro or After Effects is installed.
{% endhint %}

To install it manually:

{% tabs %}
{% tab title="Mac" %}

### Installing the Adobe plugin

1. Download the latest version from <https://gyroflow.xyz/download#plugins>
2. Run `Gyroflow-Adobe-macos.dmg`
3. Copy `Gyroflow.plugin` folder to `/Library/Application Support/Adobe/Common/Plug-ins/7.0/MediaCore/`
   {% endtab %}

{% tab title="Windows" %}

### Installing the Adobe plugin

1. Download the latest version from <https://gyroflow.xyz/download#plugins>
2. Extract `Gyroflow-Adobe-windows.zip` somewhere
3. Copy `Gyroflow-Adobe-windows.aex` file to `C:\Program Files\Adobe\Common\Plug-ins\7.0\MediaCore\`
   {% endtab %}
   {% endtabs %}

## ✨ Features

* Automatic loading of the project file, or gyro data from video file
* Support for speed ramping and time remapping
* Support for different aspect ratios and output sizes
* In After Effects, you can create a 3D camera based on the gyro data
* The plugin uses the clip trim range to calculate stabilization, so it doesn't consider data outside of your clip
* Plugin loads the default preset if you created one in the app
* Pasted or duplicated effects, the pieces of a cut clip and effects applied with a preset each have their own stabilization
* An effect copied to another clip loads that clip's project and keeps your adjustments
* The effect follows relinked or moved media, also when the project is opened on another computer
* Premiere Pro subclips are stabilized with the right part of the motion data
* In After Effects, the stabilization updates when keyframes are moved, eased or removed in the timeline, and after an undo

## Source Code

You can find the source code for this Adobe plugin on GitHub [here](https://github.com/gyroflow/gyroflow-plugins).

## Nightly Builds

Development moves fast and there are new features added very often, check them out by downloading the nightly build:

* [Nightly Adobe Build for Mac](https://nightly.link/gyroflow/gyroflow-plugins/workflows/release/main/Gyroflow-Adobe-macos.zip)
* [Nightly Adobe Build for Windows](https://nightly.link/gyroflow/gyroflow-plugins/workflows/release/main/Gyroflow-Adobe-windows.zip)
* [Nightly Gyroflow Build](https://gyroflow.xyz/devbuild/?autodownload)

The list of all nightly builds is available on [GitHub actions](https://github.com/gyroflow/gyroflow-plugins/actions).


# Final Cut Pro X

Import Gyroflow Projects into Apple's Final Cut Pro.

## About Gyroflow Toolbox

**Gyroflow Toolbox** allows you to import Gyroflow Projects directly into Apple's Final Cut Pro. This allows you to take the stablised data from Gyroflow and use it within Final Cut Pro as an effect, so that you don't have to export a ProRes file (for example), from Gyroflow - avoiding any round-tripping, and unnessary render files.

It also allows you to manipulate and keyframe parameters such as FOV, Smoothness, Lens Correction, Horizon Lock/Roll, Position Offset and Rotation directly within Final Cut Pro.

Gyroflow Toolbox is powered by the same Gyroflow Core Engine that the hero Gyroflow application uses, so you get the same awesome performance in Final Cut Pro as you do in the hero Gyroflow application.

You can even use this in conjunction with [BRAW Toolbox](https://brawtoolbox.io/) (also on the App Store), to stabilise **Blackmagic RAW files**!

To get started, simply drop your video clip from the Final Cut Pro Browser or Finder to the drop zone in the Final Cut Pro Inspector. You can also drop a Gyroflow Project.

**Sony**, **GoPro (Hero 8+)**, **DJI**, **Blackmagic RAW** and **Insta360** will be automatically synced when imported. Other cameras, such as **RED**, will require launching Gyroflow to synchronise.

**GoPro**, **DJI** and **Insta360** will automatically select a Lens Profile. For all other cameras, you may need to manually select a Lens Profile, however, we'll try and GUESS a good match.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FioXld0c93ZFaNgihu99T%2FApp%20Store%20Image%202%20-%20v2.png?alt=media&amp;token=bcec4944-b314-4fbf-8030-52241c02e0bd" alt=""><figcaption></figcaption></figure>

## Download

**Gyroflow Toolbox** is a one-time payment of **USD$9.99**.

There is currently no free trial, and it is only be available on the Mac App Store as a **one-time payment**.

Alternatively, as Gyroflow Toolbox is **open source**, you can also [build it yourself via GitHub](https://github.com/latenitefilms/GyroflowToolbox).\
\
You can learn more and purchase on the Mac App Store [here](https://apps.apple.com/au/app/gyroflow-toolbox/id1667462993?mt=12).

## Limitations

**You should always put the Gyroflow Toolbox effect on a clip inside a Compound Clip.**

This is because you should only ever apply the Gyroflow Toolbox effect to an **entire clip** - the clip cannot be trimmed. Due to limitations in Final Cut Pro's FxPlug4 API - we currently can't determine the source start timecode of a clip. Because of this, the Gyroflow Toolbox effect should only be applied to a clip where the start of the clip hasn't been trimmed in the timeline (i.e. the clip you have in the timeline should show the first frame of the source clip). If you need to trim the start of this clip, you can use the full clip within a Compound Clip, then trim the Compound Clip as required. We have been in contact with the Final Cut Pro team about this, and there's currently no other better workaround or solution. Discussed in [issue 8](https://github.com/latenitefilms/GyroflowToolbox/issues/8).

## Documentation & Support

You can find the official Gyroflow Toolbox website here:

<https://gyroflowtoolbox.io>


# frei0r

Gyroflow frei0r plugin

**frei0r** is an effect framework which is supported in the following applications:

* [MLT](https://www.mltframework.org/)
* [LiquidSoap](https://www.liquidsoap.info/)
* [Kdenlive](https://www.kdenlive.org/)
* [Shotcut](https://www.shotcut.org/)
* [FFMpeg](https://ffmpeg.org/)
* [PureData](https://puredata.info/)
* [Open Movie Editor](http://www.openmovieeditor.org/)
* [Gephex](https://gephex.org/)
* [LiVES](http://lives.sf.net/)
* [FreeJ](https://freej.dyne.org/)
* [VeeJay](http://veejayhq.net/)
* [Flowblade](https://jliljebl.github.io/flowblade/)

This plugin allows you to apply the stabilization right in your frei0r-capable video editor. It uses a project file exported from Gyroflow, including its motion data filters, like the low-pass filter.

### Shotcut

The plugin has its own filter panel in Shotcut, where you can open the Gyroflow project file, change the smoothness, show the stabilization overview, and scale the timestamps for footage whose playback speed has changed. The stabilization stays in sync when you trim or split the clips. The filter panel files are in the `shotcut/gyroflow` folder of the [gyroflow-plugins repository](https://github.com/gyroflow/gyroflow-plugins/tree/main/shotcut/gyroflow).

### More information and download:

## <https://github.com/gyroflow/gyroflow-plugins>


# CSV Export

Gyro data can be exported to multiple formats

### Exporting from the app <a href="#gyroflow-to-csv" id="gyroflow-to-csv"></a>

You can export the gyro data using the **Export** button at the bottom of the **Motion data** panel in the app

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FNXEQzhsQz8PEoXlUp7JM%2Fimage.png?alt=media&amp;token=83a23faa-c06d-4cd4-b6f0-30d95cd7870b" alt=""><figcaption></figcaption></figure>

\- **Camera data** - contains original gyroscope and accelerometer data + integrated quaternions and euler angles, and optionally the focus distance, iris (f/T-stop), zoom and focal length data. It can be exported to CSV, JSON, USD or JSX (which can be imported in Adobe After Effects by using File -> Run Script)\
\- **Full metadata** - contains original metadata as parsed from the source file, without any Gyroflow calculations\
\- **Parsed metadata** - contains metadata which is used by Gyroflow, and is already pre-calculated as needed by Gyroflow stabilization algorithms\
\- **Project file (including processed gyro data) -** is a project file + parsed metadata + synced timing info

When exporting the camera data, you can choose which fields to include. Fields that aren't present in the loaded file are greyed out. You can also choose between **Export all samples** and **Export one sample per frame**. With one sample per frame, it's the sample in the middle of the frame (ignoring the rolling shutter correction), and since Gyroflow 1.7.0 it can include the gyroscope and accelerometer data too, taken from the raw IMU sample closest to that time.

### Gyroflow to CSV python script <a href="#gyroflow-to-csv" id="gyroflow-to-csv"></a>

Gyroflow to CSV by [EmberLightVFX](https://github.com/EmberLightVFX) can convert Gyroflow project files to a CSV format containing the camera motion. This can be imported in software such as Blackmagic Fusion, Nuke and Unreal Engine, and may be used for visual effects work.

You can learn more [here](https://github.com/EmberLightVFX/GyroFlow-to-CSV).


# Used Technologies

## Used languages and technologies

*Gyroflow* is written in [Rust](https://www.rust-lang.org/), with UI written in [QML](https://doc.qt.io/qt-6/qmlfirststeps.html). It uses *Qt*, *ffmpeg*, *OpenCV* and *mdk-sdk* external dependencies for the main program, but the core library is written in pure Rust without any external dependencies.

OpenCV usage is kept to a minimum, used only for lens calibration (`src/core/calibration/`) and for the optical flow and pose estimation of the synchronization and the optical correction (`src/core/synchronization/`). Core algorithms and undistortion don't use OpenCV.

GPU stuff supports *DirectX*, *OpenGL*, *Metal* and *Vulkan* thanks to *Qt RHI* and *wgpu*. For GPU processing we use *OpenCL* or *wgpu*, with highly parallelized CPU implementation as a fallback.

Zero-copy preview in the UI is implemented using Qt RHI and everything from video decoding, through processing to UI display is done on the GPU without the image data ever reaching CPU.

Zero-copy processing for video editor plugins supports: OpenCL buffers, CUDA buffers, Metal buffers and textures, Vulkan textures and DirectX11 textures. The OpenCL and wgpu interop is implemented [here](https://github.com/gyroflow/gyroflow/tree/master/src/core/gpu), was very challenging to do and resulted in multiple contributions to other Rust packages ([#1](https://github.com/cogciprocate/ocl/pull/212), [#2](https://github.com/gfx-rs/wgpu/pull/3338), [#3](https://github.com/gfx-rs/wgpu/pull/3355))

## Why Rust?

Rust is an amazing and performant systems language. Gyroflow's nature requires a language that allows to achieve the most possible performance and use CPU cores and GPU devices to the maximum.\
Rust's *fearless concurrency*, *memory safety* and extremely convenient package system allowed Gyroflow to grow very fast and avoid any memory issues and most crashes. This resulted in Gyroflow being extremely stable while using a lot of threading and supporting all possible graphics APIs.\
Rust's [`wgpu` ](https://github.com/gfx-rs/wgpu)project fits perfectly for Gyroflow's GPU processing requirements.

## Why QML?

Unfortunately most native Rust GUI frameworks are still not mature enough to implement a fairly complex UI like Gyroflow's, while allowing low-level control for zero-copy rendering on various graphics APIs.

QML on the other hand is a very robust and proven UI framework, which provides all necessary features while being implemented in a very efficient way. This ticks all the boxes for Gyroflow's UI requirements and was very easy to work with. It runs natively on DirectX, Vulkan, Metal and OpenGL through Qt RHI.

Rust <-> QML interop is also quite easy through the [`qmetaobject-rs`](https://github.com/woboq/qmetaobject-rs) crate. It required to write some C++ code for some low-level Qt interaction, but even in a complex app like Gyroflow, the amount of C++ needed was very low and acceptable.

QML supports hot-reloading so the UI development is very fast and easy, it has great support for animations and the UI rendering performance is great. The resulting UIs can run everywhere, not only desktop (Windows/Linux/macOS), but also mobile (Android/iOS) and even web browsers with WASM and WebGL.

Other UIs could be written on top of **gyroflow\_core,** but I don't see an use case for that other than for fun.


# Parsing Gyro Data

Parsing of all gyro formats for Gyroflow is done in the [telemetry-parser ](https://github.com/AdrianEddy/telemetry-parser)library. It was created specifically for Gyroflow and aims to implement all possible gyro data parsers **natively.**

This means that the code is pure Rust, without **any** external dependencies, any SDKs or anything else.

This allows it to be extremely portable with the ability to be built as a [python module](https://pypi.org/project/telemetry-parser/), [WASM module](https://github.com/AdrianEddy/telemetry-parser/tree/master/bin/wasm-module), for all mobile platforms and basically everywhere else Rust is supported.

It also doesn't need filesystem access, so the source data bytes can be provided from anywhere.

## CLI tool

telemetry-parser provides a CLI tool called [gyro2bb](https://github.com/AdrianEddy/telemetry-parser/releases), which parses the gyro data and outputs a Betaflight blackbox compatible `.csv` file.

It can also dump (print) all parsed metadata to the terminal.

## Gyroflow's gyro formats

Gyroflow team has designed two formats in an attempt to standardize writing gyro data by the cameras.

1. [GCSV format](https://docs.gyroflow.xyz/app/technical-details/gcsv-format) is a simple CSV-based .gcsv text file
2. [Gyroflow protobuf](https://docs.gyroflow.xyz/app/technical-details/gyroflow-protobuf) is a binary protobuf description covering all possible camera features

Both formats are parsed by the `telemetry-parser` library.


# Gyroflow Core

Gyroflow was designed with modularity in mind. Gyroflow Core is a library that can be used for video editor plugins, main program GUI and potentially in other places where video is processed.

Gyroflow Core is a library that handles all stabilization algorithms and processing of video pixels.

You can find the **source code** on GitHub [here](https://github.com/gyroflow/gyroflow/tree/master/src/core).

Gyroflow Core purposely excludes **ffmpeg** and thus the decoding and encoding of data. This also includes render queue, as render queue without a decoder and encoder doesn't make sense.

Whilst the [Command Line Interface (CLI)](https://docs.gyroflow.xyz/app/advanced-usage/command-line-cli) uses Gyroflow Core, it also includes **Qt** and **ffmpeg.** The Command Line Interface is useful when you need to automate Gyroflow, or do things in a programatic or batch way.

Coding using Gyroflow Core is useful if you're building things like:

* Video Editor Plugins (i.e. OpenFX, FxPlug4)
* OBS Plugin for Real-time Stabilisation
* A web version of Gyroflow (compiled to WASM + processing with browser-provided video/canvas functions)
* A fork of Gyroflow, with the intention to use a different GUI than **Qt**, or different video processing API than **ffmpeg** (for example C# + MFT for a pure Windows use case).

`StabilizationManager` is the core struct of Gyroflow Core - it's the main interface. Whilst there isn't yet any official documentation for this, by referring to the existing OpenFX and FxPlug4 plugins, it should be easy enough to understand - especially if you're familiar with Rust.

Gyroflow Core has been designed with a few assumptions in mind:

### **Portability**

Gyroflow core doesn't make any assumptions about video data source, motion data source, user interface, video decoding, encoding or playback.

It is designed to be free of any large external dependencies and this makes it possible to compile for any system, any environment and any purpose.

It doesn't need **Qt**, **ffmpeg**, **OpenCV** or **mdk-sdk**, and yet it still handles everything needed for video stabilization.

### Comprehensiveness

It handles as much as it can, so the outer layers (e.g. the GUI) can be as thin as possible. This includes parsing of all gyro sources, GPU processing on all graphic APIs, drawing on the pixels, running the optical flow and synchronization algorithms, keyframes, lens profiles and of course the main stabilization algorithms.

### Performance

All hardware accelerated processing is handled inside the core so the outer layers don't need to know anything about it. Calculations of the motion data, stabilization and zooming are also multithreaded inside the core.

## Design

The library is designed to take the following **inputs**:

* Gyro data file path (or the contents in memory)
* Video information like resolution, frame rate, duration
* Either:

  * `.gyroflow` project file, to load all parameters in one go

  or

  * Parameters available in the GUI as function calls (eg. `set_smoothing_param, set_horizon_lock, set_imu_orientation` etc
* Video pixels with a timestamp

And the **output** is stabilized video pixels.

Video pixels can be passed as:

* Byte array in memory `&[u8]`
* OpenCL `cl_mem`
* DirectX11 `ID3D11Texture2D *`
* Vulkan `VkImage`
* Metal texture `MTLTexture`
* Metal buffer `MTLBuffer`
* CUDA buffer `CUdeviceptr`

It's also able to handle hybrid solutions, like providing a Metal texture and returning `&[u8]` array in memory.

Currently there's no documentation of the API, but the entire code is available so you should able to figure out all needed calls by looking at the [current implementations](#examples). Feel free to [contact Adrian](mailto:adrian@gyroflow.xyz) if you have questions about it, or join the [Discord](https://discord.com/invite/BBJ2UVAr2D).

The main app implements GUI in **QML** on top of Gyroflow Core, and uses **ffmpeg** to decode and encode the video files.

The **OpenFX** plugin uses pixels provided by the host (e.g. DaVinci Resolve), and settings loaded from `.gyroflow` project file

**Gyroflow Toolbox**, the **Final Cut Pro X** plugin, uses a `MTLTexture` provided by Final Cut Pro via the [FxPlug4 API](https://developer.apple.com/documentation/professional_video_applications/fxplug). It has the ability to import a `.gyroflow` project file, or it can programatically create a new internal Gyroflow Project if you're using a camera format that doesn't require synchronisation within the main Gyroflow application. Gyroflow Toolbox is primarily written in Objective-C, with a C interface to some Rust functions.

Optionally, **OpenCV** is used in Gyroflow Core for the optical flow (**DIS** and **PyrLK**) and pose estimation used by the synchronization, and for the point tracking of the optical correction. However, if you're just loading a `.gyroflow` project file, then the optical flow is not needed, as it's only used to determine the offsets and measure the motion, not for the actual stabilization process.

Main app also uses **OpenCV** in the lens calibrator.

## Examples

* [The hero Gyroflow Application & GUI (Rust & QML)](https://github.com/gyroflow/gyroflow/blob/master/src/controller.rs)
* [The OpenFX Plugin for DaVinci Resolve (Rust)](https://github.com/gyroflow/gyroflow-plugins/blob/main/openfx/src/gyroflow.rs)
* [Gyroflow Toolbox - FxPlug4 Plugin for Final Cut Pro (Rust & Objective-C)](https://github.com/latenitefilms/GyroflowToolbox/blob/main/Source/Frameworks/gyroflow/src/lib.rs)


# Building from Source

## Dev environment

`Visual Studio Code` with `rust-analyzer` extension.

For working with QML I recommend to use Qt Creator and load all QML files there, as it has auto-complete and syntax highlighting. The project also supports UI live reload, it's a super quick way of working with the UI. Just change `let ui_live_reload = false;` to `true` in `src/gyroflow.rs` and it should work right away. Now every time you change any QML file, the app should reload it immediately.

## Building steps

{% tabs %}
{% tab title="Windows" %}

1. Prerequisites: `git`, `7z` and working `powershell`. If you never ran powershell scripts before, run `set-executionpolicy remotesigned` in powershell as admin
2. Get latest stable Rust language from: <https://rustup.rs/>
   * Please make sure to check the English language pack option when installing the C++ build tools from Visual Studio Installer
3. Install `Just` by running `cargo install --force just`
4. Clone the repo: `git clone https://github.com/gyroflow/gyroflow.git`
5. Enter the project directory and:
   * Install dependencies: `just install-deps`
   * Compile and run: `just run`
     {% endtab %}

{% tab title="macOS" %}

1. Prerequisites: `git`, `brew`
2. Get latest stable Rust language from: <https://rustup.rs/>
3. Install `Just` by running `cargo install --force just`
4. Clone the repo: `git clone https://github.com/gyroflow/gyroflow.git`
5. Enter the project directory and:
   * Install dependencies: `just install-deps`
   * Compile and run: `just run`
   * The first time you run it won't work, run `just deploy` once and then `just run` will work
     {% endtab %}

{% tab title="Linux" %}

1. Prerequisites: `git`, `7z`, `python`, `apt` package manager (or adjust commands inside scripts if on different distro)
2. Get latest stable Rust language from: <https://rustup.rs/>
3. Install `Just` by running `cargo install --force just`
4. Clone the repo: `git clone https://github.com/gyroflow/gyroflow.git`
5. Enter the project directory and:
   * Install dependencies: `just install-deps`
   * Compile and run: `just run`
     {% endtab %}

{% tab title="Android" %}

1. Prerequisites: `git`, `7z`, working `powershell`, Android SDK and NDK. Building is supported only on Windows
2. Get latest stable Rust language from: <https://rustup.rs/>
3. Install `Just` by running `cargo install --force just`
4. Clone the repo: `git clone https://github.com/gyroflow/gyroflow.git`
5. Install Android SDK and NDK r27d and update paths in `_scripts/android.just`
6. Enter the project directory and:
   * Install dependencies: `just android install-deps`
   * Compile the apk and install on device: `just android deploy`
     {% endtab %}

{% tab title="iOS" %}

1. Prerequisites: `git`, `brew`
2. Get latest stable Rust language from: <https://rustup.rs/>
3. Install `Just` by running `cargo install --force just`
4. Clone the repo: `git clone https://github.com/gyroflow/gyroflow.git`
5. Enter the project directory and:
   * Install dependencies: `just ios install-deps`
   * Update Team ID, signing keys and provisioning profiles in `_scripts/ios.just`
   * Compile and run on device: `just ios run`
     {% endtab %}
     {% endtabs %}

## Profiling

{% tabs %}
{% tab title="Windows" %}

1. Install and run `Visual Studio Community Edition`
2. Compile and run Gyroflow with the `profile` profile: `cargo run --profile profile`
3. In Visual Studio, go to `Debug -> Performance Profiler...`
   * Under `Target`, open `Change Target` and select `Running Process...`, select the running `gyroflow.exe` process
     {% endtab %}

{% tab title="QML" %}

1. Uncomment `config.define("QT_QML_DEBUG", None);` in `build.rs`
2. Comment `cli::run()` in `gyroflow.rs`
3. Run in debug mode with QML debugger args: `cargo run -- "-qmljsdebugger=port:1234,block,services:CanvasFrameRate,EngineControl,DebugMessages"`
4. In Qt Creator go to `Analyze` -> `QML Profiler (Attach to Waiting Application)` and enter port 1234
   {% endtab %}
   {% endtabs %}


# GCSV Format

.gcsv gyro log format

What follows is a text-based gyro log format that can be implemented in custom hardware/firmware called `.gcsv` (short for gyro csv or Gyroflow csv). As a text-based format this is meant to be easily implementable and inspectable (compatible with standard CSV reading software) at the cost of space efficiency.

Firstly, for a video file called `videofilename.mp4`, the corresponding gyro log file is `videofilename.gcsv`, this is a case of the `.gcsv` acting as [sidecar files](https://en.wikipedia.org/wiki/Sidecar_file). This allows for automatic log detection.

Since Gyroflow 1.7.0, this also works for image sequences. For `sequence_00001.dng`, `sequence_00002.dng` etc., the log file can be called either `sequence.gcsv` or `sequence_00001.gcsv`.

The `.gcsv` file contains information about the gyro orientation, scaling, and a unique identifier. The following is an example of a .gcsv file from a logger supporting logging of gyro and accelerometer:

```csv
GYROFLOW IMU LOG
version,1.3
id,custom_logger_name
orientation,YxZ
note,development_test
fwversion,FIRMWARE_0.1.0
timestamp,1644159993
vendor,potatocam
videofilename,videofilename.mp4
lensprofile,potatocam/potatocam_mark1_prime_7_5mm_4k
lens_info,wide
frame_readout_time,15.23
frame_readout_direction,0
tscale,0.001
gscale,0.00122173047
ascale,0.00048828125
t,gx,gy,gz,ax,ay,az
0,39,86,183,-1137,-15689,-2986
1,56,100,202,-1179,-15694,-2887
2,63,108,218,-1247,-15702,-2794
3,71,108,243,-1308,-15675,-2727
4,83,101,268,-1420,-15662,-2661
5,101,93,294,-1575,-15661,-2629
6,121,95,319,-1677,-15654,-2639
7,143,97,348,-1709,-15673,-2654
8,163,98,362,-1704,-15691,-2685
9,173,93,371,-1678,-15698,-2736
10,181,98,375,-1623,-15697,-2810
11,173,105,365,-1578,-15693,-2929
12,159,111,363,-1555,-15711,-3057
13,157,113,348,-1540,-15747,-3159
14,157,118,327,-1542,-15780,-3246
15,153,123,310,-1595,-15812,-3319
...
```

If a magnetometer is present, some additional fields are present, e.g.:

```csv
GYROFLOW IMU LOG
version,1.3
id,custom_logger_name
orientation,YxZ
note,development_test
fwversion,FIRMWARE_0.1.0
timestamp,1644159993
vendor,potatocam
videofilename,videofilename.mp4
lensprofile,potatocam_mark1_prime_7_5mm_4k
tscale,0.001
gscale,0.00122173047
ascale,0.00048828125
mscale,0.00059875488
t,gx,gy,gz,ax,ay,az,mx,my,mz
0,39,86,183,-1137,-15689,-2986,123,345,546
1,56,100,202,-1179,-15694,-2887,124,344,560
...
```

### Mandatory fields: <a href="#mandatory-fields" id="mandatory-fields"></a>

1. The very first line identifies the file as an IMU log. This line should either be `GYROFLOW IMU LOG` or the more neutral `CAMERA IMU LOG`.
2. The second line `version,1.3` describes the "version" of the .gcsv file format. This is equal to `1.3` for now. The versions are backwards compatible, but changes with the addition of new metadata fields.
3. The third line contains a unique ID associated with the logger/camera. For instance a high-end camera with internal logging may use `id,potatocam_deluxe_4k_grey_edition`.
4. The fourth line contains the orientation string. This corresponds to the `IMU Orientation` field in Gyroflow (see the implementation notes below for further details).
5. The next few lines contain optional metadata. These are not strictly required, but may improve workflow and stabilization. Developers are thus encouraged to include all known fields.
6. The subsequent lines with `tscale`, `ascale` and `gscale` describe constants used to scale the raw sensor values.
   * Multiplying `tscale` by the raw `t` values should give the time in **seconds**. It can thus be deduced that the file above is logging at 1000 Hz since each line increments by `1*0.001=0.001 s`, corresponding to a frequency of 1 KHz. The resolution of the timestamps should be 1 ms or better.
   * Multiplying `gscale` by the raw `gx/gy/gz` values should give the angular rate in **rad/s**
   * (If accelerometer data present) Multiplying `ascale` by the raw `ax/ay/az` values should give the acceleration in **g**
   * (If magnetometer data present) Multiplying `mscale` by `mx/my/mz` gives the measurements in **gauss** (Note that `1 tesla = 10000 gauss`).
7. The rest of the file simply consists of a standard CSV header and the raw values. The header and data order should be one of the following: `t,gx,gy,gz`, `t,gx,gy,gz,ax,ay,az`, or `t,gx,gy,gz,ax,ay,az,mx,my,mz`. Gyroscope data is the minimum requirement. Acceleration data is required for horizon lock, while magnetometer data improves drift in orientation determination (Not currently of significant importance).
8. For the data itself, fixed-point integers are recommended with a scalar (point 6) in order to avoid excessively large text files. Using floating points here is still valid though.

### Optional fields:

The following are all optional fields for the metadata block, but developers should include as many known fields as possible.

* `note` is for other misc. information.
* `fwversion` is the firmware of the logger/camera.
* `timestamp` is the UNIX timestamp when logging began.
* `vendor` can contain the vendor or developer
* `videofilename` is the name of the corresponding video file. Normally the `.gcsv` file name already matches, but this insures the information is kept if the filename changes.
* `lensprofile` is the unique name of the lens preset and vendor folder. If it matches a lens profile in the [database](https://github.com/gyroflow/lens_profiles) it is automatically selected during loading.
* `lens_info` is additional information about the lens/field of view not available in the metadata. This could be `wide`, `normal`, `narrow` for different FOV settings, `linear` for lens distortion correction. Most relevant for action cameras with different crop settings.
* `frame_readout_time` is the time in milliseconds it takes to capture a full video frame using rolling shutter. This is used for rolling shutter correction.
* `frame_readout_direction` is the direction of the readout. Most cameras with rolling shutter capture the top of the frame first. When it's missing, top to bottom is assumed.
  * 0: Top to bottom
  * 1: Bottom to top
  * 2: Left to right
  * 3: Right to left

### Implementation notes <a href="#implementation-notes" id="implementation-notes"></a>

The required parts of the header of the `.gcsv` file remains static for a given camera/setup, and can thus be written as a constant string to the file.

Raw sensor values are often represented as 16-bit signed integers, meaning a range between of `+/- 2^15`. If the acceleration range is known to be +/- 4 g as was the case in the example above. Then `ascale = 4/2^15 = 0.00012207031`. Refer to the datasheet for conversion information. Similarly, a gyroscope with a range of `+/- 1000 deg/s` gives `gscale = (1000 * pi / 180)/2^15 = 0.00053263221`. Note that even when configured to a setting such as `+/- 1000 deg/s`, the actual calibration of the sensor may lead to a maximum slightly above or below this value. As always, consult the datasheet.

For a logger/camera implementation, some other things to think about:

* For a camera, the timestamps should be based on the same time source as the video capture. This prevents drift between the two.
* Consider using microseconds for the timestamp if a faster sampling rate if the time source allows. This may improve the timing during the sync process.
* Consider using the data ready interrupts of IMU's instead of polling for more consistent timings.
* Ensure proper filtering of the data to meet the Nyquist criteria for the sampling frequency. Even more filtering is usually recommended, e.g. setting the built-in hardware low pass filter cutoff at 50 Hz to 100 Hz is a good starting point, even for higher sampling frequencies.

For the IMU Orientation string, the following figure corresponds to `YxZ`.

<figure><img src="https://957905993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgogMettXiFqbEAwJmvy8%2Fuploads%2FujkewHJe6NljZ28qwBaQ%2Fimage.png?alt=media&amp;token=f54c4947-0ae6-4102-b50e-a0e95e33023c" alt=""><figcaption></figcaption></figure>

* For the gyroscope, data for an axis correspond to the right-handed rotation rate of the camera body about that axis.
* The accelerometer data correspond to linear acceleration applied in the given direction. Due to the nature of gravity, a stationary object will experience an *upwards* acceleration of 9.81 m/s2, while an object in freefall will experience *zero* acceleration.
* The magnetometer data corresponds to the measured magnetic field vector.

In order for orientation determination to work correctly, the data must have the same/aligned coordinate axes. For combined IMU sensors, this is already the case for the raw data. If a rotation is applied to the gyro data before being written, the same rotation should be applied to the accelerometer (and magnetometer). This ensures that the axes stay aligned.

If the gyroscope and accelerometer data come from separate sensors, their axes must similarly be aligned, either physically or by applying a rotation in software.

### Version changelog <a href="#version-changelog" id="version-changelog"></a>

* 1.0: Initial version
* 1.1: Add lens profile field
* 1.2: Add rolling shutter information
* 1.3: Add `lens_info` field


# Gyroflow protobuf

Gyroflow protobuf format is designed to contain even the most advanced and detailed data about the video capture pipeline, that is useful for post-stabilization.

## Download the .proto definition

You can download the latest protobuf definition from telemetry-parser's [git repository](https://github.com/AdrianEddy/telemetry-parser/blob/master/src/gyroflow/gyroflow.proto).

## Supported features

* Camera and lens metadata: Brand, model, focal length, f-number, focus distance etc.
* Lens distortion model and coefficients
* Frame readout time for rolling shutter correction
* Frame capture metadata - ISO, shutter speed, white balance, etc.
* Raw IMU samples - gyroscope, accelerometer, magnetometer readings
* Quaternions - final camera orientation after sensor fusion
* Lens OIS data - detailed information about lens OIS movements, so we can support stabilization when Lens OIS was enabled
* IBIS data - detailed information about the in-body image stabilization, so we can support stabilization when IBIS was enabled
* EIS data - if the camera contains any form of electronic stabilization, the protobuf can contain what exactly it did to the image so we can account for it.
* GPS / GNSS samples - position, altitude, speed and heading, with per-sample fix quality and accuracy estimates

***

## Technical details

This page provides detailed documentation for integrating the Gyroflow Protobuf format natively into camera firmware. By embedding this standardized telemetry directly into video files, cameras can achieve pixel-perfect software stabilization, distortion correction, and rolling shutter compensation in Gyroflow and supported NLEs.

### 1. Binary Protobuf Embedding in ISO Base Media File Format (MP4/MOV)

#### Transport format

The Gyroflow Protobuf data should be stored as binary data in a separate MP4 track of the video file. This makes it easy to read and write and it's the standard way to embed additional data in video files.

The data should be stored per-frame so that each video frame should have corresponding metadata in the metadata MP4 track.

Track Setup:

1. Create a dedicated track with `hdlr` (Handler Reference Box) set to `'meta'` (Metadata).
2. The `stsd` (Sample Description Box) should indicate a binary gyroflow format `'gyrf'`.
3. Maintain a 1:1 Sample-to-Frame relationship. For every encoded video frame in the video track, there must be exactly one corresponding sample in the metadata track.

#### Sample Structure

* First Sample: The very first metadata sample must contain the `Main` message initialized with the `Header` block (camera metadata, clip metadata) AND the first `FrameMetadata`.
* Subsequent Samples: All subsequent samples should contain the `Main` message but omit the `Header` block, including only the `FrameMetadata` for that specific frame.

#### MP4 Track Diagram

```
[ MP4 Container ]
 │
 ├── [ Video Track ] (hdlr = 'vide')
 │    ├── Frame 1 (0 ms)
 │    ├── Frame 2 (16 ms)
 │    └── Frame 3 (33 ms)
 │
 └── [ Metadata Track ] (hdlr = 'meta', stsd = 'gyrf')
      ├── Sample 1 (Syncs with Frame 1)
      │    └── protobuf Main { magic_string: "GyroflowProtobuf", Header: {...}, FrameMetadata: {...} }
      ├── Sample 2 (Syncs with Frame 2)
      │    └── protobuf Main { magic_string: "GyroflowProtobuf", FrameMetadata: {...} }
      └── Sample 3 (Syncs with Frame 3)
           └── protobuf Main { magic_string: "GyroflowProtobuf", FrameMetadata: {...} }
```

***

### 2. General overview of the included fields

The Gyroflow Protobuf schema is designed to encapsulate all the necessary metadata required for advanced video stabilization and lens correction.

#### The Header (Static Metadata)

The `Header` message acts as the foundational context for the entire video clip. It contains information that generally remains constant throughout the recording and is divided into two sub-messages:

* `CameraMetadata`: This defines the physical hardware used to capture the footage.
  * **Identification**: Fields like `camera_brand`, `camera_model`, `lens_brand`, and `lens_model` help identify the exact gear setup.
  * **Sensor & Optics**: Fields like `sensor_pixel_width`, `sensor_pixel_height`, `pixel_pitch_x_nm` and `pixel_pitch_y_nm` define the physical characteristics of the sensor. The `lens_profile` field can be used to embed the lens profile, or the lens distortion metadata can be stored directly using fields in the `LensData`.
  * **Orientation**: `imu_orientation` and the optional `imu_rotation`/`quats_rotation` quaternions allow you to define base offsets for the sensor data, ensuring the software interprets the XYZ axes correctly.
* `ClipMetadata`: This defines the specific parameters of the video file itself.
  * **Dimensions & Timing**: Standard video properties like `frame_width`, `frame_height`, and `duration_us`.
  * **Framerates**: It separates `record_frame_rate`, `sensor_frame_rate`, and `file_frame_rate` to accurately handle variable frame rate (VFR) and slow-motion recording scenarios.

#### FrameMetadata (Dynamic Data)

The `FrameMetadata` message contains the telemetry and camera settings that change continuously during the recording. Because multiple IMU samples usually occur within the span of a single video frame, this message is built to handle arrays of data.

* **Timing & Synchronization**: `start_timestamp_us` and `end_timestamp_us` strictly define the capture window of the frame using the camera's internal clock.

{% hint style="warning" %}
It's crucial to include accurate timestamps for both the sensor readouts and IMU data samples. All the timestamps should come from the same internal monotonic camera clock. The clock doesn't have to be synchronized with wall time.
{% endhint %}

* **Per-Frame Camera Settings**: Exposure and image properties can fluctuate, especially in auto-exposure modes. Fields like `iso`, `exposure_time_us`, and `white_balance_kelvin` track these shifts.
  * Dynamic cropping (`crop_x`, `crop_width`, `digital_zoom_ratio`) allows the metadata to reflect digital zooms or sensor punches that happen mid-recording.
* **LensData**: This field captures dynamic optical changes, such as shifts in `focal_length_mm` or `focus_distance_mm`.
  * It also embeds mathematical distortion models and their corresponding `distortion_coefficients` and `camera_intrinsic_matrix` to accurately map lens warping at that specific moment in time.
* **Motion Data**:
  * `IMUData`: This is the core raw telemetry. It contains arrays of gyroscope (rotation in degrees/sec) and accelerometer (acceleration in m/s²) readings, alongside precise `sample_timestamp_us` markers for each sample.
  * `QuaternionData`: If the camera performs its own sensor fusion, this field provides the calculated orientation as a Hamilton unit quaternion (the `w`, `x`, `y`, `z` components) mapped to a timestamp.

***

### 3. Frame Readout Time and Rolling Shutter Correction

Rolling shutter occurs because CMOS sensors read pixels row-by-row rather than instantly. To correct this, Gyroflow maps *every single pixel row* to an exact IMU timestamp.

#### Timestamps & VSync

Gyroflow requires timestamps to be strictly linked to the internal camera clock, down to the microsecond (`_us`).

* `start_timestamp_us`: The readout instant of the **first-read** row of the crop area - the moment that row finished integrating and was latched out by the readout chain. It is *not* the moment the row started exposing, and *not* the midpoint of its exposure. The exposure midpoint is derived by subtracting `exposure_time_us / 2`.
* `end_timestamp_us`: The readout instant of the **last-read** row of the crop area, under the same convention.

Which row counts as "first-read" follows `frame_readout_direction`: `TopToBottom` → the top row, `BottomToTop` → the bottom row, `LeftToRight` → the left column, `RightToLeft` → the right column. Producers whose hardware reports a different physical event (start of integration, or the exposure midpoint) must shift by ±`exposure_time_us / 2` before writing these fields.

These two timestamps are authoritative for per-row interpolation. `frame_readout_time_us` is a `float` helper while the timestamps are `double`s measured directly on the camera clock, so derive per-row time by interpolating between `start_timestamp_us` and `end_timestamp_us` rather than from `start + frame_readout_time_us`.

The `frame_readout_time_us` in `ClipMetadata` must represent the readout time of the *captured crop* (not the whole physical sensor, unless reading the whole sensor).

#### Readout & IMU Interpolation Diagram

```
camera clock (µs) ─────────────────────────────────────────────────────────────►

IMU samples        |     |     |     |     |     |     |     |     |     |     |
                   (sample_timestamp_us of every IMUData entry)

row 0 (first-read)       [▓▓▓▓ exposure ▓▓▓▓]
                                            ▲ start_timestamp_us
row k                           [▓▓▓▓ exposure ▓▓▓▓]
                                                   ▲ t(k)
row N-1 (last-read)                    [▓▓▓▓ exposure ▓▓▓▓]
                                                          ▲ end_timestamp_us

t(k)        = start_timestamp_us + (end_timestamp_us - start_timestamp_us) * k / (N - 1)
midpoint(k) = t(k) - exposure_time_us / 2   ◄─ the IMU trajectory is interpolated here
                                               to get the orientation of row k
```

{% hint style="info" %}
The `IMUData` array in `FrameMetadata` may include samples from outside that frame's capture window, and adjacent frames may repeat samples - the reader keys every sample by its timestamp, so overlap is harmless and duplicates collapse. What matters is that the IMU sample timestamps and the sensor readout timestamps come from the same clock: the per-row correction looks up the IMU trajectory at the interpolated row time, so a mismatch shifts the entire correction.

Note that every sample you provide is ingested and used - for orientation integration and for smoothing across the whole clip - not only the ones falling inside a frame's readout window.
{% endhint %}

***

### 4. Lens Data and Distortion Models

To accurately stabilize a video, Gyroflow needs to undistort the image before applying the rotation. The `LensData` message defines camera intrinsics and lens distortion parameters.

#### Standard Models

* [OpenCV Fisheye model](https://docs.opencv.org/4.13.0/db/d58/group__calib3d__fisheye.html): Default model used in gyroflow. It also works for non-fisheye lenses. Uses exactly 4 coefficients (`k1, k2, k3, k4`).
* [OpenCV Standard model](https://docs.opencv.org/4.13.0/d9/d0c/group__calib3d.html): Classic polynomial radial/tangential model. Variable length, following OpenCV's own conventions - 4 (`k1,k2,p1,p2`), 5 (`+k3`), 8 (`+k4,k5,k6`), 12 (`+s1..s4`, thin prism) or 14 (`+tx,ty`, tilt) coefficients.
* [Poly3 / Poly5 / PTLens](https://lensfun.github.io/calibration-tutorial/lens-distortion.html): Lensfun models. 1, 2 and 3 coefficients respectively.
* `NoDistortion`: pinhole (rectilinear) projection - the encoded pixels are already linearized so that $$r = f \cdot \tan(\theta)$$. Producers that fully correct lens distortion in-camera should emit this rather than fitting a polynomial to the result. If the in-camera correction is only *partial*, refit `GenericPolynomial` against the post-correction projection instead.

#### Generic Polynomial

For manufacturers using complex custom glass mapping, the `GenericPolynomial` model maps the ray angle $$\theta$$ from the optical axis to a **dimensionless** normalized projected radius:

$$r\_{normalized} = \sum\_i c\_i \cdot \theta^{i+1} = c\_0 \cdot \theta + c\_1 \cdot \theta^2 + c\_2 \cdot \theta^3 + \dots$$

`coefficients[i]` is the coefficient of $$\theta^{i+1}$$, so index 0 is the linear term. Both odd and even powers are allowed - that is the only structural difference from OpenCV Fisheye, which restricts itself to $$\theta^3, \theta^5, \theta^7, \theta^9$$ with an implicit leading coefficient of 1.0 (so OpenCV Fisheye is expressible here as `[1, 0, k1, 0, k2, 0, k3, 0, k4]`). Gyroflow evaluates up to 12 terms; report only as many as your calibration actually fitted, and do not pad with trailing zeros.

Math implementation, for a point $$(X, Y)$$ in normalized image coordinates:

1. Radius: $$r = \sqrt{X^2 + Y^2}$$
2. Angle: $$\theta = \arctan(r)$$
3. Polynomial evaluation:

   $$\theta\_d = \theta \cdot c\_0 + \theta^2 \cdot c\_1 + \theta^3 \cdot c\_2 + \dots + \theta^{12} \cdot c\_{11}$$
4. Scaling factor: $$scale = \theta\_d / r$$ (if $$r=0$$, scale is $$1.0$$)
5. Apply the scale, then convert to pixels using the **per-axis** focal lengths and principal point from `camera_intrinsic_matrix`. Scaling each axis independently is what handles non-square pixels and anamorphic cases where $$f\_x \neq f\_y$$:

   $$u = X \cdot scale \cdot f\_x + c\_x$$

   $$v = Y \cdot scale \cdot f\_y + c\_y$$

There is no separate post-scale coefficient pair - an earlier revision of this model carried one, and it has been removed.

Inverting the model ($$r\_{normalized} \rightarrow \theta$$) requires numerical iteration; Newton's method on the polynomial converges in under 10 iterations for any physically reasonable lens.

**Normalization requirements.** This model uses strict semantics:

* `focal_length_mm` MUST be set on the parent `LensData` entry - the coefficients are normalized assuming a specific physical focal length.
* The polynomial MUST be normalized so that $$c\_0 \approx 1.0$$ for a paraxial ray. If your calibration produces coefficients in meters/radian^n, divide them all by the focal length in meters before writing them here. Consumers may reject a $$c\_0$$ outside roughly $$\[0.8, 1.2]$$ as malformed.
* Reference projections under this normalization: equidistant fisheye $$r = \theta$$ gives `[1, 0, 0, ...]`; rectilinear $$r = \tan(\theta)$$ gives `[1, 0, 1/3, 0, 2/15, ...]`; stereographic $$r = 2\tan(\theta/2)$$ gives `[1, 0, 1/12, 0, 1/120, ...]`.

The coefficients describe the projection of the **encoded pixels as they appear in the recorded image**, not the raw lens optics. If the camera applies any in-camera correction, geometric crop or desqueeze between sensor readout and encoding, the polynomial must be refit against the resulting projection. If it linearizes fully to pinhole, emit `NoDistortion` instead.

Intrinsic Matrix:

The protobuf requires a row-major 3x3 intrinsic matrix. Usually defined as:

```
[[fx,  0, cx],
 [ 0, fy, cy],
 [ 0,  0,  1]]
```

***

### 5. Lens OIS Data (Optical Image Stabilization)

Optical stabilization physically shifts a floating lens element to counteract camera shake. Because the glass moves independently of the camera body, the IMU (which is rigidly attached to the body) records rotation that the *sensor didn't actually see*.

`LensOISData` reports the **effective displacement of the image content on the sensor surface**, in nanometers, at specific timestamps - *not* the mechanical position of the IS lens group. If your IS group has an image-plane magnification β ≠ 1, multiply the actuator displacement by β before writing it here, so the single pixel-conversion formula below applies regardless of lens design.

Gyroflow does not fold this into the IMU or quaternion data. It converts the shift to pixels:

```
shift_px_x = shift_x_nm * frame_width  / (crop_width  * pixel_pitch_x_nm)
shift_px_y = shift_y_nm * frame_height / (crop_height * pixel_pitch_y_nm)
```

and applies it as a per-row offset in the image plane while sampling the source frame:

```
uv_source = uv_output + ois_shift_px + ibis_shift_px
```

The IMU trajectory is left untouched. The offset simply cancels the movement the lens already performed, so Gyroflow's own digital stabilization doesn't correct it a second time.

**Sign convention:** the lens group moves the image, so report what the image did. If the image content shifted by +N nm on the sensor, write +N. Axes are sensor-native - +X right, +Y down, origin at the top-left of the sensor active area - and they do *not* rotate with `rotation_degrees`.

The sampling rate of OIS data can be much lower than the IMU data, because it's a physical element, it will move slowly. Gyroflow will interpolate any gaps. Typically 4-8 samples per frame is enough, plus a guard sample or two on each side for the spline tangents. The samples should at minimum cover the frame's row-exposure-midpoint span, i.e. `[start_timestamp_us - exposure_time_us/2, end_timestamp_us - exposure_time_us/2]` - a single sample per frame degenerates to per-frame correction, with no rolling shutter compensation.

```
scene ──► [ lens ] ──► [ IS group shifts ] ──► image moved on the sensor by (shift_x_nm, shift_y_nm)
                                                (image content, +X right, +Y down, sensor-native axes)
camera body ──► IMU ──► motion data             (the IMU doesn't see the IS group move)

camera clock ─────────────────────────────────────────────────────────────►
row exposure midpoints of frame n:   |◄── start - exp/2 ........ end - exp/2 ──►|
LensOISData samples:              o  o     o     o     o     o     o     o  o
                                  ▲ guard                               guard ▲

Gyroflow, for every output row (at that row's time):
    ois_shift_px = shift_nm * frame_size / (crop_size * pixel_pitch_nm)
    uv_source    = uv_output + ois_shift_px + ibis_shift_px
    (the motion data stays untouched)
```

***

### 6. IBIS Data (In-Body Image Stabilization)

IBIS mechanically shifts and rolls the physical image sensor on its X, Y, and Roll axes.

How it works in the Protobuf:

`IBISData` carries `shift_x_nm`, `shift_y_nm` and `roll_angle_degrees`, plus `sample_timestamp_us` - which may be omitted only in the degenerate single-sample-per-frame case, and is required on every sample otherwise.

**Sign convention:** IBIS moves the *sensor*, but like `LensOISData` it reports the displacement of the **image content**, which is the negative of the sensor's mechanical displacement. If the sensor moved +N nm, write -N. That keeps one consumer formula valid for both stabilizers.

Since the sensor is physically moving inside the camera body during exposure, Gyroflow needs this data for the same reason it needs OIS: the IMU records the camera body moving, but the pixels being recorded are shifting within the body.

The sampling rate of IBIS can be much lower than the IMU data, because it's a physical element, it will move slowly. Gyroflow will interpolate any gaps. Same cadence and coverage requirement as OIS above: typically 4-8 samples per frame plus guards, spanning the frame's row-exposure-midpoint range.

#### IBIS interaction with IMU

If IBIS is active, Gyroflow maps the mechanical sensor position at the exact `row_readout_time`.

* Sensor X/Y Shift: converted from nanometers to pixel offsets using the pixel pitch **and** the per-frame crop - `shift_x_nm * frame_width / (crop_width * pixel_pitch_x_nm)`, and likewise for Y - then added to the sampling coordinate, exactly like the OIS shift.
* Sensor Roll: applied as a 2D rotation of the sampling coordinate in the image plane, after the inverse projection - *not* as a Z rotation folded into the 3x3 orientation matrix. Positive = counterclockwise viewed from the lens toward the sensor, pivoting about the principal point.

The IBIS mechanism has exactly three mechanical degrees of freedom - translation X, translation Y, and roll about the optical axis. The sensor does not pitch or yaw, since physically tilting it would defocus the image. So the X/Y pair captures all linear corrective output, including the correction for camera yaw/pitch shake, which manifests at the sensor as translation by approximately $$f \cdot \tan(\theta)$$.

If IBIS completely countered a bump, Gyroflow relies on the `IBISData` to know that the frame is already stable at that specific timestamp, preventing Gyroflow from digitally correcting a bump that IBIS already fixed (preventing double-correction artifacts).

```
sensor moves (mechanical)          what you write in IBISData (image content)
+N nm right            ──►         shift_x_nm = -N
+N nm down             ──►         shift_y_nm = -N
rolls about the axis   ──►         roll_angle_degrees

Gyroflow, for every output row (at that row's time, interpolated between the samples):
    ibis_shift_px = shift_nm * frame_size / (crop_size * pixel_pitch_nm)
    roll          ──► 2D rotation of the sampling coordinate about the principal point
    uv_source     = uv_output + ois_shift_px + ibis_shift_px
    (the motion data stays untouched)
```

***

### 7. EIS Data (Electronic Image Stabilization)

When the camera applies internal *digital* stabilization (EIS), the pixels stored in the final MP4 are vastly different from the raw sensor readout. To stabilize this in post, Gyroflow needs to know exactly how the camera deformed the original sensor crop.

```
camera:    sensor readout ──► EIS warp ──► encoded video frame
           (crop_x, crop_y,      │
            crop_width/height)   └──► EISData: what the warp did
                                        QUATERNION  - rotation applied to the frame
                                        MESH_WARP   - grid of anchors: sensor position ──► encoded position
                                        MATRIX_4X4  - 3D transform (preliminary)

Gyroflow:  encoded frame ──► undo EISData ──► sensor image ──► own stabilization ──► output
```

There are three options to choose from:

#### A. QUATERNION

The camera encodes a quaternion representing the internal rotation the camera applied to the frame.

Gyroflow applies the inverse of this quaternion to the frame to "un-stabilize" the footage back to raw sensor data, and then applies its own smoother quaternion path.

This method is used by GoPro (internal Hypersmooth)

#### B. MESH\_WARP

The camera describes its warp as a `grid_width` x `grid_height` grid of anchors, uniformly spaced over a `region_width` x `region_height` rectangle in **sensor-pixel coordinates relative to the per-frame `crop_x` / `crop_y` origin** - not over the encoded video frame:

```
anchor(i, j) = ( i * region_width  / (grid_width  - 1),
                 j * region_height / (grid_height - 1) )
```

For each anchor in row-major order (index `k = j * grid_width + i`), the pair `(warped_xy[2k], warped_xy[2k+1])` gives the **absolute position the camera mapped that anchor to** - not a displacement. Typically that is the anchor itself plus a sub-pixel to few-pixel correction. Total length is `2 * grid_width * grid_height`.

The mesh is the **forward** direction: it describes what the camera did, mapping sensor-native positions to encoded-frame positions. Gyroflow interpolates between anchors (cubic spline recommended, bilinear acceptable for low-precision use) and numerically inverts the result to map encoded positions back to sensor positions for sampling.

This allows arbitrary internal frame distortions to be encoded, including internal rolling shutter correction, lens distortion correction, and crop movements natively done by the camera.

This method is used by Sony (Active mode)

#### C. MATRIX\_4X4

A standard 16-float row-major matrix representing an affine/perspective 3D transform applied by the camera to the frame. Works similarly to QUATERNION but allows the camera to pass internal scaling and translations directly.

{% hint style="warning" %}
This variant is preliminary. It is defined in the schema, but there is no grounded producer yet and Gyroflow currently ignores it on read. Use QUATERNION or MESH\_WARP unless you've talked to us first.
{% endhint %}

***

### 8. JSONL - the text representation

Everything above describes the binary protobuf embedded in an MP4 track. The exact same messages can also be written as **JSONL**: one `Main` message per line, each encoded with the protobuf **proto3 canonical JSON mapping**.

The two representations are interchangeable and carry identical data. JSONL exists because writing an MP4 metadata track requires a muxer, while writing a text file does not - so it's a practical output for camera firmware, converters and test rigs, and it can be inspected in any text editor.

Use the `.jsonl` file extension.

#### Format rules

1. One complete `Main` message per line. No pretty-printing - a message may not span multiple lines.
2. The first line carries the `Header`, either together with the first `FrameMetadata` (mirroring the binary form) or on a line of its own. All subsequent lines contain only `FrameMetadata`.
3. Lines are in playback order, one per video frame.
4. Blank lines are ignored, and a UTF-8 BOM at the start of the file is tolerated.

#### Encoding

Any standard protobuf JSON serializer produces the right output - `google.protobuf.util.JsonFormat` (Java), `protojson` (Go), `protobuf.js`, `prost-reflect` (Rust). The mapping means:

* Field names are lowerCamelCase: `startTimestampUs`. The original proto spelling (`start_timestamp_us`) is also accepted.
* Enums are their declared name: `"frameReadoutDirection": "TopToBottom"`. Integers are accepted too.
* `oneof` variants are flattened into the containing message: the distortion model appears directly in the `LensData` object as `"genericPolynomial": { ... }`, not nested under `distortion`.
* Fields holding the proto3 default value are omitted entirely. The reader treats a missing field and an explicitly written default identically, so a producer that writes them out instead is fine too. (Gyroflow's own writer drops nulls, empty arrays and empty strings, but keeps numeric zeros and `false`.)

{% hint style="warning" %}
One deviation from the canonical mapping: numbers must be written as JSON numbers, not as quoted strings. The mapping permits quoting, but this schema has no 64-bit integer fields - the case quoting exists for - so the reader refuses to guess. A line containing a quoted number fails to deserialize: that message is logged and skipped, costing you that one frame, and the rest of the stream is read normally.
{% endhint %}

#### Timing

There is no MP4 track to supply presentation times, so the reader reconstructs each frame's position on the video timeline from `frameNumber` and the clip frame rate. Producers should therefore set:

* `frameNumber` on every frame, with the first frame of the clip set to `1`, and
* one of `fileFrameRate` / `recordFrameRate` / `sensorFrameRate` in `ClipMetadata`.

If no frame rate is present the reader falls back to deriving the timeline from `startTimestampUs` alone, which assumes a constant frame rate. The per-frame difference between `startTimestampUs` and the reconstructed timeline is preserved either way, so camera-clock jitter is not lost.

#### Example

The first line of a clip, abbreviated (real files have every IMU sample and one line per frame):

{% code title="telemetry.jsonl" %}

```json
{"magicString":"GyroflowProtobuf","protocolVersion":1,"header":{"camera":{"cameraBrand":"Sony","cameraModel":"ILCE-7SM3","pixelPitchXNm":8400,"pixelPitchYNm":8400,"sensorPixelWidth":4240,"sensorPixelHeight":2392,"imuOrientation":"YXz"},"clip":{"frameWidth":1920,"frameHeight":1080,"durationUs":18518500.0,"recordFrameRate":59.94006,"sensorFrameRate":59.94006,"fileFrameRate":59.94006,"imuSampleRate":2000,"colorProfile":"CINE4 of EX1/EX3","pixelAspectRatio":1.0,"frameReadoutTimeUs":8852.0,"frameReadoutDirection":"TopToBottom"}},"frame":{"startTimestampUs":17269.0,"endTimestampUs":26121.0,"frameNumber":1,"iso":6400,"exposureTimeUs":227.0,"shutterSpeedNumerator":1,"shutterSpeedDenominator":4197,"cropX":1.0,"cropY":4.0,"cropWidth":4237.0,"cropHeight":2383.0,"lens":[{"cameraIntrinsicMatrix":[3776.2568,0.0,960.0,0.0,3776.752,540.0,0.0,0.0,1.0],"focalLengthMm":70.0,"fNumber":4.9948263,"focusDistanceMm":7570.0,"genericPolynomial":{"coefficients":[1.0135272,-0.8073628,20.804943]}}],"imu":[{"sampleTimestampUs":-3500.0,"gyroscopeX":0.96183205,"gyroscopeY":-3.8473282,"gyroscopeZ":-0.16793893,"accelerometerX":0.50517654,"accelerometerY":9.879673,"accelerometerZ":-0.59735334},{"sampleTimestampUs":-3000.0,"gyroscopeX":1.1755725,"gyroscopeY":-3.7709923,"gyroscopeZ":-0.24427481,"accelerometerX":0.50397944,"accelerometerY":9.88087,"accelerometerZ":-0.59974754}],"ibis":[{"sampleTimestampUs":21084.0,"shiftXNm":-1000.0,"shiftYNm":0.0,"rollAngleDegrees":-0.001}]}}
```

{% endcode %}

Formatted for reading, the same message looks like this:

```json
{
  "magicString": "GyroflowProtobuf",
  "protocolVersion": 1,
  "header": {
    "camera": { "cameraBrand": "Sony", "cameraModel": "ILCE-7SM3", "imuOrientation": "YXz", ... },
    "clip":   { "frameWidth": 1920, "frameHeight": 1080, "recordFrameRate": 59.94006,
                "imuSampleRate": 2000, "frameReadoutTimeUs": 8852.0,
                "frameReadoutDirection": "TopToBottom", ... }
  },
  "frame": {
    "startTimestampUs": 17269.0,
    "endTimestampUs": 26121.0,
    "frameNumber": 1,
    "lens": [ { "focalLengthMm": 70.0, "genericPolynomial": { "coefficients": [ ... ] }, ... } ],
    "imu":  [ { "sampleTimestampUs": -3500.0, "gyroscopeX": 0.96183205, ... }, ... ],
    "ibis": [ { "sampleTimestampUs": 21084.0, "shiftXNm": -1000.0, ... } ]
  }
}
```

#### Sidecar files

A `.jsonl` file placed next to the video and named after it is loaded automatically, the same way `.gcsv` sidecars are:

```
MyClip.mp4
MyClip.jsonl
```

Gyroflow reads the sidecar when the video itself carries no embedded telemetry. It can also be loaded manually at any time from **Motion data** → the file picker.

#### Tools

The [telemetry-parser](https://github.com/AdrianEddy/telemetry-parser) repository contains command-line tools for working with both representations, under `bin/`:

<table><thead><tr><th width="270">Tool</th><th>Purpose</th></tr></thead><tbody><tr><td><code>gyroflow_proto_convert</code></td><td>Converts between the representations: binary ↔ JSONL, and extracts either one out of an MP4's metadata track.</td></tr><tr><td><code>gyroflow_proto_inject</code></td><td>Muxes telemetry, given in either representation, into an MP4 as a metadata track. The video stream is copied as-is, nothing is re-encoded. Note that audio is <em>not</em> carried over - the output holds the video plus the telemetry track only.</td></tr></tbody></table>

```bash
# Extract the telemetry track of an MP4 to JSONL
gyroflow_proto_convert MyClip.mp4 -o MyClip.jsonl

# Convert JSONL to per-frame binary protobuf files, and back
gyroflow_proto_convert MyClip.jsonl -o frames_dir
gyroflow_proto_convert frames_dir -o MyClip.jsonl

# Mux telemetry into a video as a metadata track
gyroflow_proto_inject MyClip.jsonl -v MyClip.mp4 -o MyClip_with_telemetry.mp4
```

These are a practical way to validate a firmware implementation: write JSONL from the camera, inject it into the matching video, and check that Gyroflow stabilizes the result correctly.

***

### 9. Other

If your camera has any specific needs, we're open to extend the protobuf to include any additional fields or features.

If you have any questions, feel free to contact us at <devteam@gyroflow.xyz> or <adrian.eddy@gmail.com>

***

## Protobuf

{% code title="gyroflow\.proto" lineNumbers="true" %}

```protobuf
syntax = "proto3";

// Main entry point of the data
// The first message will contain the Header with CameraMetadata and ClipMetadata
// All subsequent per-frame samples will contain the FrameMetadata, without Header
message Main {
    string magic_string     = 1; // Magic string useful for format detection in binary data. Always "GyroflowProtobuf"
    uint32 protocol_version = 2; // Version of the protocol, currently 1.

    Header        header = 3;
    FrameMetadata frame  = 4;
}

// One-time metadata containing information about the camera, lens and this particular video clip
message Header {
    message CameraMetadata {
                 string camera_brand         = 1; // Camera manufacturer
                 string camera_model         = 2; // Camera model
        optional string camera_serial_number = 3; // Camera serial number
        optional string firmware_version     = 4; // Camera firmware version
                 string lens_brand           = 5; // Lens manufacturer
                 string lens_model           = 6; // Lens model
                 uint32 pixel_pitch_x_nm     = 7; // Sensor pixel pitch in nanometers, horizontal direction.
                 uint32 pixel_pitch_y_nm     = 8; // Sensor pixel pitch in nanometers, vertical direction. Required — for square-pixel sensors, set equal to pixel_pitch_x_nm.
                 uint32 sensor_pixel_width   = 9; // Full sensor width in pixels
                 uint32 sensor_pixel_height  = 10; // Full sensor height in pixels
        optional float  crop_factor          = 11; // Crop factor in relation to full frame sensor size. e.g. 1.6x for APS-C
        optional string lens_profile         = 12; // The Gyroflow lens identifier, or a path to lens profile json file (relative to the `camera_presets` directory), or the json contents directly
        // Axis-permutation-and-sign string describing how IMU axes are labeled
        // relative to the camera body. Three characters, each one of
        // {X, Y, Z, x, y, z} where capital = positive axis and lowercase =
        // negated axis. Default "XYZ" = identity (IMU axes match camera body).
        // Example: "Xyz" means X stays, Y and Z are flipped. The transform is
        // applied to each raw IMU 3-vector as a pure permutation/sign before
        // any sensor fusion.
        optional string imu_orientation      = 13;
        // Additional rigid rotation that aligns the IMU sensor frame with the
        // camera body frame. Applied to each raw IMU 3-vector v as
        //     v' = imu_rotation · v
        // (standard vector rotation). Applied AFTER imu_orientation when both
        // are present (orientation first as axis remap, then rotation).
        optional Quaternion imu_rotation     = 14;
        // Additional rigid rotation that aligns the post-fusion quaternion
        // stream with the camera body frame. Applied to each quaternion q in
        // FrameMetadata.quaternions as CONJUGATION (not composition):
        //     q' = quats_rotation · q · quats_rotation⁻¹
        // The effect is to rotate the AXIS of q by quats_rotation while
        // preserving its angle — i.e. to re-express the same physical rotation
        // in a rotated coordinate frame. Use this to correct a misaligned
        // fused-orientation stream without disturbing the IMU pipeline.
        // imu_rotation and quats_rotation are independent: they apply to
        // different streams (raw IMU vs. fused quaternions). Most producers
        // need only one of them.
        optional Quaternion quats_rotation   = 15;
        optional string additional_data      = 16; // Optional note or additional data. If it starts with {, it will be parsed as JSON
    }
    message ClipMetadata {
        enum ReadoutDirection {
            TopToBottom = 0; // Sensor reads pixels from top to bottom.
            BottomToTop = 1; // Sensor reads pixels from bottom to top.
            RightToLeft = 2; // Sensor reads pixels from right to left.
            LeftToRight = 3; // Sensor reads pixels from left to right.
        }

        uint32 frame_width            = 1; // Video frame width in pixels
        uint32 frame_height           = 2; // Video frame height in pixels
        // Clip duration in microseconds. MUST be double — a 32-bit float loses
        // µs precision beyond ~16.7 s (mantissa = 24 bits); at 10 min the step
        // grows to ~64 µs which causes audible jitter in any time-domain math.
        double duration_us            = 3;
        float  record_frame_rate      = 4; // Recording frame rate
        float  sensor_frame_rate      = 5; // Sensor frame rate. In most cases it will be equal to `record_frame_rate`
        float  file_frame_rate        = 6; // File frame rate. May be different in VFR mode. e.g. 120 fps recorded as 30 fps file
        int32  rotation_degrees       = 7; // Video rotation in degrees. For example 180 degrees for upside-down, or 90 for vertical mode.
        uint32 imu_sample_rate        = 8; // Sampling rate of the IMU chip.
        optional string color_profile = 9; // Shooting color profile, eg. Natural, Log, etc
        float  pixel_aspect_ratio     = 10; // For anamorphic lenses
        // Time it takes to read the video frame from the sensor, for rolling
        // shutter correction. It is the time between the first row of pixels
        // and the last row of pixels of the CROP area — not the full sensor
        // readout. Stored as double for consistency with the per-frame double-
        // precision start_timestamp_us / end_timestamp_us against which it is
        // compared and arithmetically combined.
        double frame_readout_time_us  = 11;
        ReadoutDirection frame_readout_direction = 12; // Frame readout direction
    }

    CameraMetadata camera = 1;
    ClipMetadata   clip   = 2;
}

message FrameMetadata {
    // Time, in microseconds on the camera's internal clock, at the READOUT INSTANT
    // of the FIRST-read sensor row — i.e. the moment that row finished integrating
    // photons and was latched out by the sense amplifier / ADC. NOT the moment that
    // row started exposing; NOT the midpoint of its exposure.
    //
    // "First-read" follows ClipMetadata.frame_readout_direction:
    //   TopToBottom → top row     (visual row 0)
    //   BottomToTop → bottom row  (visual row frame_height - 1)
    //   LeftToRight → left column (visual column 0)
    //   RightToLeft → right column
    //
    // Rationale for the readout-latch convention: hardware naturally timestamps the
    // readout latch event, since that is the observable moment for the readout chain.
    // The exposure midpoint (the canonical per-row time for stabilization) is derived
    // by subtracting exposure_time_us / 2.
    //
    // PER-ROW INTERPOLATION: for per-row stabilization, consumers SHOULD linearly
    // interpolate per-row time between start_timestamp_us and end_timestamp_us
    // (NOT derive it from start + frame_readout_time_us, because the two timestamp
    // fields are doubles and authoritative, while frame_readout_time_us is a float
    // helper). For an output row index r in readout order (r = 0 for the first-read
    // row, r = N-1 for the last-read row, where N = ClipMetadata.frame_height for
    // vertical readout or ClipMetadata.frame_width for horizontal readout):
    //
    //     row_readout_instant(r) = start_timestamp_us
    //                            + (r / (N - 1)) · (end_timestamp_us - start_timestamp_us)
    //     row_exposure_midpoint(r) = row_readout_instant(r) - exposure_time_us / 2
    //     frame_center_of_capture  = (start_timestamp_us + end_timestamp_us) / 2
    //                              - exposure_time_us / 2
    //
    // For consumers indexing by visual (top-down) row v, convert to readout-order r
    // using frame_readout_direction (e.g. for BottomToTop: r = (N - 1) - v).
    //
    // Producers whose hardware reports a different physical event (start of row 0
    // integration, or the row 0 exposure midpoint) must shift by ±exposure_time_us / 2
    // before writing this field.
    double start_timestamp_us = 1;

    // Time, in microseconds on the camera's internal clock, at the readout instant
    // of the LAST-read sensor row (per frame_readout_direction). Together with
    // start_timestamp_us this defines the rolling-shutter timeline of the frame.
    //
    // AUTHORITATIVE for per-row interpolation. The relation
    //     end_timestamp_us ≈ start_timestamp_us + frame_readout_time_us
    // holds approximately, but the two timestamp fields are doubles measured directly
    // by the camera clock and take precedence over the float helper
    // frame_readout_time_us if the two ever disagree.
    double end_timestamp_us   = 2;

    uint32 frame_number       = 3; // Frame number in sequence. The first frame of the video clip should have this set to 1.

    optional uint32 iso                       = 4; // ISO Value
    // Actual exposure time in microseconds. Stored as double — float loses µs
    // precision beyond ~16.7 s, which matters for astro / long-exposure work.
    optional double exposure_time_us          = 5;
    optional uint32 white_balance_kelvin      = 6; // White balance in kelvins
    optional float  white_balance_tint        = 7; // White balance tint value
    optional float  digital_zoom_ratio        = 8; // Digital zoom ratio. If the video is zoomed in digitally, this value should indicate that. E.g. 0.9 for 10% digital crop
    // EXPOSURE PRECEDENCE: if more than one of exposure_time_us /
    // shutter_speed_{numerator,denominator} / shutter_angle_degrees is present,
    // consumers MUST use them in this order (highest precedence first):
    //   1. exposure_time_us (microsecond-precise; most authoritative)
    //   2. shutter_speed_numerator / shutter_speed_denominator (exact rational)
    //   3. shutter_angle_degrees (derived from frame rate + angle, as
    //      exposure_time_us = shutter_angle_degrees / 360 · 1e6
    //                       / ClipMetadata.sensor_frame_rate).
    //      Use sensor_frame_rate — not record_frame_rate or file_frame_rate —
    //      because the shutter angle is a property of the sensor's exposure
    //      cycle: the rate at which the rolling-shutter sweep physically
    //      repeats. For the typical case where sensor_frame_rate ==
    //      record_frame_rate this is a no-op; for slow-motion / high-frame-
    //      rate modes where they differ, sensor_frame_rate is the correct
    //      divisor.
    // Producers SHOULD set the most precise field they have and MAY omit the
    // less-precise ones.
    optional int32  shutter_speed_numerator   = 9;  // Shutter speed numerator. E.g. 1 in case of 1/240 shutter speed.
    optional int32  shutter_speed_denominator = 10; // Shutter speed denominator. E.g. 240 in case of 1/240 shutter speed.
    optional float  shutter_angle_degrees     = 11; // Shutter angle in degrees. E.g. 180
    optional float  crop_x                    = 12; // Sensor crop area in pixels, X coordinate
    optional float  crop_y                    = 13; // Sensor crop area in pixels, Y coordinate
    optional float  crop_width                = 14; // Sensor crop area in pixels, width
    optional float  crop_height               = 15; // Sensor crop area in pixels, height

    repeated LensData       lens        = 16; // Per-frame lens information, like focal length, distortion coefficients etc
    repeated IMUData        imu         = 17; // Per-frame raw IMU data samples, will likely have multiple samples in one video frame
    repeated QuaternionData quaternions = 18; // Per-frame quaternion data. Optional, can contain camera orientation after sensor fusion
    // Per-frame lens optical stabilization data. See LensOISData for units, sign
    // convention (unified with IBISData), and coordinate frame.
    //
    // SAMPLE-COVERAGE REQUIREMENT: for per-row rolling-shutter correction, the sample
    // timestamps must cover the row-exposure-midpoint span of this frame, i.e. at minimum
    //     [ start_timestamp_us - exposure_time_us / 2,
    //       end_timestamp_us   - exposure_time_us / 2 ]
    // plus one or two guard samples on each side for spline tangents. A typical
    // cadence is 4–8 samples per frame plus guards. A single sample per frame degenerates
    // to per-frame correction (no rolling-shutter compensation).
    //
    // Not present when OIS is disabled.
    repeated LensOISData    ois         = 19;

    // Per-frame in-body image stabilization data. See IBISData for units, sign convention,
    // and coordinate frame. Same sample-coverage requirement as `ois`. Not present when
    // IBIS is disabled.
    repeated IBISData       ibis        = 20;
    // Per-frame electronic in-camera stabilization data. Describes transforms the
    // camera applied between sensor read-out and encoded pixels. See EISData for
    // the per-variant semantics. Not present when in-camera EIS is disabled.
    repeated EISData        eis         = 21;

    // Per-frame GPS / GNSS position samples. See GPSData for layout, units, and
    // timing conventions. Sample cadence is producer-dependent (typically 1 Hz
    // for generic GNSS receivers, up to ~10–18 Hz for high-rate receivers).
    // Empty when GPS is disabled, unavailable, or simply hasn't ticked during
    // this frame's interval — most video frames at typical 1 Hz GPS rates carry
    // no entries.
    repeated GPSData        gps         = 22;
}

// Per-frame lens information: intrinsic matrix, focal length, distortion model.
//
// The lens distortion model is encoded as a `oneof distortion` variant. Exactly one
// variant is present per LensData entry. Each variant message defines its own
// coefficient layout and projection math.
//
// MULTIPLE ENTRIES PER FRAME:
//   FrameMetadata.lens is `repeated`. Multiple entries per frame are permitted to
//   handle intra-frame changes (e.g. zoom or focus actuator moving during readout,
//   per-row intrinsics for rolling-shutter-corrected anamorphic). Each entry
//   carries its own sample_timestamp_us on the same camera clock as
//   FrameMetadata.start_timestamp_us, and consumers interpolate between samples
//   by timestamp using the same row-midpoint convention used for ois / ibis.
//   When only one entry exists, the lens parameters apply uniformly to the whole
//   frame and the timestamp may be omitted.
message LensData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the entry
    // applies to the whole frame.
    optional double sample_timestamp_us = 12;

    // Row-major 3x3 camera intrinsic matrix. Usually [[fx, 0, cx], [0, fy, cy], [0, 0, 1]],
    // where fx and fy are focal length values in pixels
    //   (f_mm = f_pixels * sensor_width_mm / image_width_px ;
    //    f_pixels = f_mm / sensor_width_mm * image_width_px),
    // and cx, cy is the principal point in pixels (usually width/2, height/2).
    repeated float camera_intrinsic_matrix = 1;

    // Native lens focal length in millimeters.
    //
    // REQUIRED when `distortion` is GenericPolynomial (the polynomial coefficients
    // are normalized assuming this focal length; see GenericPolynomial message docs).
    //
    // RELATIONSHIP TO camera_intrinsic_matrix:
    //   focal_length_mm is the physical lens focal length and is resolution-INDEPENDENT.
    //   camera_intrinsic_matrix carries f_x / f_y in OUTPUT-PIXEL units, which IS
    //   resolution-dependent. They are related (but not equivalent) by
    //       f_x_pixels = focal_length_mm · (output_width  / sensor_width_used_mm)
    //   where sensor_width_used_mm = pixel_pitch_x_nm · crop_width / 1e6.
    //
    // PRECEDENCE for projection: camera_intrinsic_matrix is the source of truth for
    // sensor → output-pixel mapping. focal_length_mm is the source of truth for
    // anything that needs physical-lens reasoning (e.g. GenericPolynomial
    // normalization, FOV calculation, sensor geometry). When a producer sets both,
    // they MUST be self-consistent under the formula above.
    optional float focal_length_mm   = 2;
    optional float f_number          = 3; // Lens aperture number. E.g. 2.8
    optional float focus_distance_mm = 4; // Focal plane distance in millimeters

    // The distortion model. Exactly one variant is present.
    oneof distortion {
        NoDistortion       no_distortion       = 5;
        OpenCVFisheye      opencv_fisheye      = 6;
        OpenCVStandard     opencv_standard     = 7;
        LensFunPoly3       lensfun_poly3       = 8;
        LensFunPoly5       lensfun_poly5       = 9;
        LensFunPTLens      lensfun_ptlens      = 10;
        GenericPolynomial  generic_polynomial  = 11;
    }
}

// Pinhole (rectilinear) projection — the encoded pixels are already linearized
// so that r = f · tan(θ). Producers that fully correct lens distortion in-camera
// SHOULD emit this variant rather than fitting a polynomial; the consumer treats
// the image as pinhole with no further geometric remap. Mathematically
// equivalent to GenericPolynomial with coefficients [1, 0, 1/3, 0, 2/15, 0]
// (the Taylor expansion of tan) but simpler and faster on the consumer side —
// no Newton iteration, no per-pixel polynomial evaluation.
//
// For producers that apply PARTIAL in-camera correction (residual barrel /
// pincushion remains in the encoded image), use GenericPolynomial refit
// against the post-correction projection instead.
message NoDistortion {}

// OpenCV's fisheye distortion model.
// Reference: https://docs.opencv.org/4.x/db/d58/group__calib3d__fisheye.html
//
// Projection (forward):
//   θ        = angle from optical axis (radians)
//   θ_d      = θ · (1 + k₁·θ² + k₂·θ⁴ + k₃·θ⁶ + k₄·θ⁸)
//   r_pixels = θ_d · f_px        (f_px from camera_intrinsic_matrix)
//
// Coefficients: [k₁, k₂, k₃, k₄] — exactly 4 floats.
message OpenCVFisheye {
    repeated float coefficients = 1;
}

// OpenCV's standard radial + tangential distortion model.
// Reference: https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html
//
// Coefficients (variable length, following OpenCV conventions):
//   4 elements:  [k₁, k₂, p₁, p₂]
//   5 elements:  [k₁, k₂, p₁, p₂, k₃]
//   8 elements:  [k₁, k₂, p₁, p₂, k₃, k₄, k₅, k₆]
//   12 elements: [k₁..k₆, p₁, p₂, s₁..s₄]                  (rational+thin-prism)
//   14 elements: [k₁..k₆, p₁, p₂, s₁..s₄, τ_x, τ_y]        (tilt)
message OpenCVStandard {
    repeated float coefficients = 1;
}

// LensFun's Poly3 radial distortion model.
// Reference: https://lensfun.github.io/manual/latest/group__Lens.html#gaa505e04666a189274ba66316697e308e
//   r_d = r · (1 + k₁ · r²)
// Coefficients: [k₁] — 1 float.
message LensFunPoly3 {
    repeated float coefficients = 1;
}

// LensFun's Poly5 radial distortion model.
//   r_d = r · (1 + k₁·r² + k₂·r⁴)
// Coefficients: [k₁, k₂] — 2 floats.
message LensFunPoly5 {
    repeated float coefficients = 1;
}

// LensFun's PTLens distortion model.
//   r_d = r · (a·r³ + b·r² + c·r + 1)
// Coefficients: [a, b, c] — 3 floats.
message LensFunPTLens {
    repeated float coefficients = 1;
}

// Generic polynomial fisheye projection — a clean generalization of OpenCVFisheye
// with full power range and dimensionless normalization.
//
// SEMANTICS — WHAT THE POLYNOMIAL DESCRIBES
//   coefficients describe the projection of the ENCODED PIXELS as they appear in
//   the recorded image — NOT the raw lens optics. If the producer applies any
//   in-camera distortion correction, geometric crop, anamorphic desqueeze, or
//   any other geometric remap between sensor read-out and the encoded pixels,
//   the polynomial MUST be refit against the resulting (post-correction)
//   projection. Concretely:
//
//     - Producer applies NO in-camera correction → polynomial = raw lens projection
//     - Producer applies in-camera correction toward pinhole → polynomial converges
//       toward the rectilinear Taylor expansion [1, 0, 1/3, 0, 2/15, 0, ...]
//     - Producer fully linearizes to pinhole → emit NoDistortion instead
//
//   The consumer ALWAYS undistorts using these coefficients without needing to
//   know whether in-camera correction was applied. The polynomial alone encodes
//   the projection state.
//
// MATHEMATICAL FORM
//   Maps the ray angle θ from the optical axis (radians) to a DIMENSIONLESS
//   normalized projected radius on the image plane:
//
//       r_normalized = Σᵢ  coefficients[i] · θ^(i+1)
//                    = c₀·θ + c₁·θ² + c₂·θ³ + ... + c_{N-1}·θ^N
//
//   The polynomial is intrinsically radial — a function of θ only. To project
//   to pixels relative to the principal point, scale by each axis's pixel
//   focal length INDEPENDENTLY (this matters for non-square pixels and any
//   anamorphic case where f_x ≠ f_y):
//
//       f_x = camera_intrinsic_matrix[0, 0]   (pixel focal length, X axis)
//       f_y = camera_intrinsic_matrix[1, 1]   (pixel focal length, Y axis)
//       c_x = camera_intrinsic_matrix[0, 2]   (principal point X)
//       c_y = camera_intrinsic_matrix[1, 2]   (principal point Y)
//
//       r_pixels_x = r_normalized · f_x
//       r_pixels_y = r_normalized · f_y
//       u          = unit_direction.x · r_pixels_x + c_x
//       v          = unit_direction.y · r_pixels_y + c_y
//
//   where unit_direction is the unit vector pointing from the optical axis to
//   the projected ray in the image plane (cos φ, sin φ for azimuth φ).
//
// COEFFICIENT ORDER
//   coefficients[i] is the coefficient of θ^(i+1):
//     index 0 → θ¹      (the linear/leading term)
//     index 1 → θ²
//     index 2 → θ³
//     ...
//   Both odd and even powers are allowed. This is the only structural
//   difference from OpenCVFisheye, which restricts to θ³, θ⁵, θ⁷, θ⁹
//   with an implicit leading θ¹ coefficient of 1.0 — i.e. OpenCVFisheye can
//   be expressed in this model as [1, 0, k₁, 0, k₂, 0, k₃, 0, k₄].
//
// STRICT NORMALIZATION REQUIREMENTS
//   This model uses STRICT semantics:
//
//   1. LensData.focal_length_mm MUST be set on the parent LensData entry. The
//      polynomial coefficients are normalized assuming a specific physical
//      focal length; consumers that need to relate to physical sensor
//      geometry require this value.
//
//   2. The polynomial MUST be normalized so that c₀ ≈ 1.0 for a paraxial
//      (small-θ) ray. Concretely, if a calibration produces coefficients
//      in meters/radian^n, divide all coefficients by the focal length in
//      meters before writing them here. Consumers MAY reject coefficients
//      whose c₀ is outside a reasonable tolerance (e.g. [0.8, 1.2]) as
//      malformed.
//
//   3. Reference projections under this normalization:
//        Equidistant fisheye:  r_normalized = θ            → [1, 0, 0, ...]
//        Rectilinear pinhole:  r_normalized = tan(θ)       → [1, 0, 1/3, 0, 2/15, ...]
//        Stereographic:        r_normalized = 2·tan(θ/2)   → [1, 0, 1/12, 0, 1/120, ...]
//
// NUMBER OF COEFFICIENTS
//   Variable. Typical ranges:
//     - 4 terms: mild fisheye, narrow-to-medium FOV
//     - 6 terms: wide-angle / fisheye
//     - 8+ terms: extreme wide-angle or non-symmetric optics
//   Producers SHOULD report only as many terms as the calibration
//   actually fitted; do not pad with trailing zeros.
//
// INVERSION
//   Forward (θ → r_normalized) is closed-form polynomial evaluation.
//   Inverse (r_normalized → θ) requires numerical iteration; Newton's
//   method on the polynomial converges in <10 iterations for any
//   physically reasonable lens.
message GenericPolynomial {
    repeated float coefficients = 1;
}

message IMUData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the sample
    // applies to the whole frame. For multi-sample entries (the normal case for
    // IMU at 200–1000 Hz) this MUST be set on every sample.
    optional double sample_timestamp_us = 1;
    float gyroscope_x             = 2;  // Gyroscope X reading. Unit: degrees/sec
    float gyroscope_y             = 3;  // Gyroscope Y reading. Unit: degrees/sec
    float gyroscope_z             = 4;  // Gyroscope Z reading. Unit: degrees/sec
    float accelerometer_x         = 5;  // Accelerometer X reading. Unit: m/s²
    float accelerometer_y         = 6;  // Accelerometer Y reading. Unit: m/s²
    float accelerometer_z         = 7;  // Accelerometer Z reading. Unit: m/s²
    optional float magnetometer_x = 8;  // Magnetometer X reading. Unit: µT
    optional float magnetometer_y = 9;  // Magnetometer Y reading. Unit: µT
    optional float magnetometer_z = 10; // Magnetometer Z reading. Unit: µT
}

// Unit quaternion (w + xi + yj + zk) using the HAMILTON convention:
//   - Right-handed coordinate system.
//   - Multiplication: i·j = k, j·k = i, k·i = j, and i² = j² = k² = ijk = -1.
//     This is NOT the JPL convention (which uses i·j = -k) found in some IMU
//     vendor literature; producers that natively use JPL must convert before
//     writing here.
//   - The four components MUST satisfy w² + x² + y² + z² = 1 (within float
//     precision); consumers MAY renormalize on read.
//   - Storage order is (w, x, y, z) as the four float fields below; this is
//     independent of the multiplication convention but listed for clarity.
message Quaternion {
    float w = 1; // Quaternion component W (real / scalar part)
    float x = 2; // Quaternion component X (i-axis imaginary part)
    float y = 3; // Quaternion component Y (j-axis imaginary part)
    float z = 4; // Quaternion component Z (k-axis imaginary part)
}

// Per-sample camera orientation as a quaternion.
//
// This is the camera's orientation in some inertial / world frame, derived from
// sensor fusion of raw IMU samples — the same role as the output of a complementary
// or Kalman filter, or the camera's own onboard sensor fusion. Producers should fill
// this when the camera reports a fused orientation. When only raw IMU is available,
// leave this field empty and the consumer will integrate from `FrameMetadata.imu`.
//
// For cameras that emit TWO related quaternion streams (a body-orientation stream and
// an image-orientation in-camera transform), this field carries the COMBINED product
// (body_orientation · image_orientation). The image-orientation transform alone, if
// separately useful (e.g. for re-expressing gravity in the encoded-frame coordinate
// system, or for horizon-lock integration), is reported under EISData.data.quaternion
// — see EISData docs.
//
// Sample cadence: typically denser than one per frame (commonly one quaternion per
// gyro sample, ~200 Hz). The consumer interpolates between samples by timestamp.
message QuaternionData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the sample
    // applies to the whole frame. For multi-sample entries this MUST be set on
    // every sample.
    optional double sample_timestamp_us = 1;
    Quaternion quat = 2;
}

// UNIFIED STABILIZER SIGN CONVENTION (applies to both LensOISData and IBISData)
//
// Both fields report the DISPLACEMENT OF IMAGE CONTENT on the sensor caused by
// the stabilizer at this sample's time, in the sensor-native pixel coordinate
// frame (+X right, +Y down, origin at the top-left of the sensor active area;
// axes do NOT rotate with ClipMetadata.rotation_degrees).
//
// Consumer formula is the same for both:
//
//       uv_source = uv_output + ois_shift_pixels + ibis_shift_pixels
//
// where each per-axis pixel shift is derived as
//
//       shift_pixels_x = shift_x_nm · frame_width  / (crop_width  · pixel_pitch_x_nm)
//       shift_pixels_y = shift_y_nm · frame_height / (crop_height · pixel_pitch_y_nm)
//
// PRODUCER SIGN RULES (because OIS and IBIS physically move different things):
//   - OIS: the lens group moves the IMAGE. If the image content shifted by +N nm
//     on the sensor, write +N.
//   - IBIS: the SENSOR moves. If the sensor displaced by +N nm in some direction,
//     the image content effectively appears at -N nm in the sensor-local frame.
//     Encoders MUST flip the sign before writing IBIS shifts here: write -N when
//     the sensor moved +N.
//
// The reported value is the EFFECTIVE IMAGE-PLANE DISPLACEMENT at the sensor
// surface, in nanometers. For OIS specifically, this is NOT the mechanical
// position of the IS lens group: manufacturers whose IS group has image-plane
// magnification β ≠ 1 must multiply the actuator displacement by β before
// reporting it here, so the single pixel-conversion formula above applies
// uniformly regardless of lens design.

message LensOISData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the sample
    // applies to the whole frame. For multi-sample entries this MUST be set on
    // every sample.
    optional double sample_timestamp_us = 1;
    // Image-plane displacement caused by OIS, in nanometers, in sensor-native
    // coordinates. Positive = content moved in +X direction.
    float shift_x_nm = 2;
    // Same, Y axis.
    float shift_y_nm = 3;
}

message IBISData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the sample
    // applies to the whole frame. For multi-sample entries this MUST be set on
    // every sample.
    optional double sample_timestamp_us = 1;
    // Image-plane displacement caused by IBIS, in nanometers, in sensor-native
    // coordinates. Positive = content moved in +X direction. NOTE: this is the
    // displacement of the IMAGE CONTENT, not the sensor — i.e. it's the negative
    // of the sensor's mechanical displacement. See the unified-sign-convention
    // block above LensOISData for the producer rule.
    float shift_x_nm = 2;
    // Same, Y axis.
    float shift_y_nm = 3;
    // Sensor rotation about the optical axis (Z), in degrees, pivoting about
    // the principal point. Positive = counterclockwise viewed from the lens
    // toward the sensor.
    //
    // PIVOT COORDINATE FRAME: the rotation is applied in sensor-native pixel
    // coordinates (the same frame as shift_x_nm / shift_y_nm — origin at the
    // top-left of the sensor active area, +X right, +Y down). The pivot
    // therefore must be expressed in the same frame, NOT in output-pixel
    // coordinates. Convert the principal point from camera_intrinsic_matrix
    // (which is in output-pixel units, per LensData docs) using the per-frame
    // crop:
    //
    //     pivot_sensor_px_x = FrameMetadata.crop_x
    //                       + (camera_intrinsic_matrix[0, 2] / frame_width)
    //                         · FrameMetadata.crop_width
    //     pivot_sensor_px_y = FrameMetadata.crop_y
    //                       + (camera_intrinsic_matrix[1, 2] / frame_height)
    //                         · FrameMetadata.crop_height
    //
    // (where frame_width/frame_height are ClipMetadata.frame_{width,height}).
    // Producers that don't expose camera_intrinsic_matrix should approximate
    // the pivot as the center of the per-frame crop rectangle.
    //
    // PHYSICAL MODEL: the IBIS mechanism has exactly three mechanical degrees
    // of freedom — translation X, translation Y, and this rotation about the
    // optical axis. The sensor does not pitch or yaw (physically tilting the
    // sensor would defocus the image). The X/Y shift pair captures ALL linear
    // corrective output, including correction for camera yaw/pitch shake (both
    // manifest at the sensor as horizontal/vertical image translation by
    // approximately f·tan(θ)).
    float roll_angle_degrees = 4;
}

// Per-sample electronic-image-stabilization data — describes a transform the camera
// applied INTERNALLY between sensor read-out and the encoded pixels. The consumer
// applies the inverse to recover the sensor-native frame before doing its own
// stabilization on top.
//
// Distinct from QuaternionData (which carries camera ORIENTATION in world frame,
// not an in-camera transform applied to pixels).
//
// VARIANTS:
//
//   - `quaternion`: a rotation the camera applied to the captured pixels before
//     encoding (e.g. the image-orientation half of a body-orientation +
//     image-orientation quaternion pair, used to re-express data into the encoded
//     frame and for horizon-lock integration).
//
//   - `mesh_warp`: a 2D mesh describing a spatial warp the camera applied as part
//     of in-camera electronic stabilization. The consumer numerically inverts the
//     mesh to recover the sensor-native frame. See MeshWarpData for layout.
//
//   - `matrix_4x4`: a 4×4 affine transform the camera applied. Preliminary — no
//     grounded producer yet.
//
// MULTIPLE ENTRIES PER FRAME:
//   Multiple EISData samples per frame are permitted; use sample_timestamp_us for
//   per-sample timing (aligned with the row-midpoint timeline for rolling shutter).
//   When only one entry exists, the transform applies uniformly to the whole frame
//   and the timestamp may be omitted.
message EISData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the transform
    // applies to the whole frame.
    optional double sample_timestamp_us = 1;

    // Exactly one variant is present. Each describes a different kind of in-camera
    // applied transform.
    oneof data {
        // Rotation the camera applied to the captured pixels before encoding.
        // Consumer applies the inverse to undo it.
        Quaternion   quaternion = 2;

        // 2D mesh warp the camera applied. See MeshWarpData.
        MeshWarpData mesh_warp  = 3;

        // 4×4 affine transform the camera applied. Preliminary — no grounded
        // producer yet.
        Matrix4x4    matrix_4x4 = 4;
    }
}

// 4×4 affine transform. Row-major: values[0..4] = first row, etc.
message Matrix4x4 {
    repeated float values = 1; // 16 floats, row-major
}

// 2D mesh describing an in-camera spatial warp the camera applied between sensor
// read-out and the encoded frame. Used by the EISData.mesh_warp variant.
//
// DIRECTION:
//   The mesh is the FORWARD direction — it describes what the camera DID to map
//   from sensor-native positions to encoded-frame positions. The consumer
//   numerically inverts (Newton / Nelder-Mead on the interpolated mesh) to map
//   encoded positions back to sensor positions for sampling.
//
// COORDINATE FRAME:
//   Both grid anchors and warped output positions are in SENSOR-pixel coordinates,
//   measured relative to FrameMetadata.crop_x, crop_y (the per-frame capture-area
//   origin). Axes match LensOISData / IBISData: +X right, +Y down, sensor-native
//   (do NOT rotate with ClipMetadata.rotation_degrees).
//
// LAYOUT:
//   Grid anchors are uniformly spaced over the rectangle [0, region_width] ×
//   [0, region_height] in sensor-pixel coordinates:
//       anchor(i, j) = ( i · region_width  / (grid_width  - 1),
//                        j · region_height / (grid_height - 1) )
//
//   For each anchor in row-major order (index k = j · grid_width + i), the pair
//   (warped_xy[2k], warped_xy[2k + 1]) gives the (x, y) position the camera
//   mapped that anchor TO under its in-camera EIS warp. Typically the warped
//   position is the anchor itself plus a small displacement (sub-pixel to a few
//   pixels) representing the per-frame stabilization correction.
//
//   Total warped_xy length = 2 · grid_width · grid_height.
//
// INTERPOLATION:
//   Between grid anchors, the consumer interpolates the warped positions. Cubic
//   spline (Catmull-Rom or natural cubic) is recommended for smoothness; bilinear
//   is acceptable for low-precision use cases.
message MeshWarpData {
    // Grid resolution. Typically 9 × 9.
    uint32 grid_width  = 1;
    uint32 grid_height = 2;

    // Rectangular region the grid covers, in sensor pixels relative to crop origin.
    float region_width  = 3;
    float region_height = 4;

    // Warped target position for each anchor. 2 · grid_width · grid_height floats,
    // row-major, two per anchor (x, y).
    repeated float warped_xy = 5;
}

// Per-sample GPS / GNSS position fix.
//
// SAMPLE CADENCE: typically much lower than IMU — 1 Hz for generic GNSS chips,
// up to ~10–18 Hz for high-rate sport-camera receivers. Most video frames at
// 1 Hz GPS rates contain no GPSData entries; producers emit them only on the
// frames during whose interval the receiver fired. Multi-sample entries within
// a single frame are permitted and MUST set sample_timestamp_us on every sample.
//
// COORDINATE / UNIT CONVENTIONS:
//   - latitude_degrees  ∈ [−90, +90],   WGS-84, N positive / S negative.
//   - longitude_degrees ∈ [−180, +180], WGS-84, E positive / W negative.
//     Producers whose native form is DMS plus N/S/E/W hemisphere char MUST
//     convert to signed decimal degrees before writing.
//   - altitude_m in meters. The reference surface (WGS-84 ellipsoid vs MSL via
//     internal geoid model) is producer-defined — this schema does not
//     distinguish them. Most consumer GNSS chips output MSL via a built-in
//     geoid model; raw RTK altitude is usually ellipsoid. Consumers that need
//     a specific reference SHOULD verify against the producer's documented
//     behavior.
//   - speed_mps in m/s (SI). Producers whose native unit is km/h MUST divide by 3.6.
//   - track_degrees ∈ [0, 360), 0° = true north, 90° = east (clockwise).
//   - velocity_*_mps decompose ground velocity in the ENU (East-North-Up)
//     local-tangent-plane frame, m/s. Optional and independent of speed_mps /
//     track_degrees: producers MAY emit either, both, or neither. When both
//     are present they MUST be self-consistent:
//        speed_mps   ≈ √(velocity_east_mps² + velocity_north_mps²)
//        track_degrees ≈ ((atan2(velocity_east_mps, velocity_north_mps) · 180/π) + 360) mod 360
//      (the +360 / mod 360 wrap is required because atan2 returns (−180°, +180°]
//      but track_degrees is defined on [0, 360); westerly headings would
//      otherwise come out negative.)
//   - *_accuracy_* fields are 1-σ standard deviations as estimated by the
//     receiver (typically from satellite geometry + signal-to-noise — NOT a
//     fixed multiple of σ). Producers SHOULD omit these unless their hardware
//     provides them; setting them to zero would be misinterpreted as "perfect
//     accuracy" rather than "unknown accuracy".
message GPSData {
    // Sample timestamp on the same camera clock as FrameMetadata.start_timestamp_us.
    // Unit: microseconds. Optional; when omitted (single-entry case), the sample
    // applies to the whole frame. For multi-sample entries this MUST be set on
    // every sample. Producers that have only an absolute UTC time (no camera-
    // clock alignment) SHOULD leave this unset and rely on unix_timestamp_s.
    optional double sample_timestamp_us = 1;

    // Absolute time of the fix in Unix-epoch seconds (UTC), if known. Producers
    // that natively use GPS-epoch time MUST subtract the GPS↔UTC leap-second
    // offset (~18 s as of 2025) before writing — UTC is the universal convention
    // here. Independent of
    // sample_timestamp_us: producers MAY emit either, both, or (rarely) neither;
    // when both are present they refer to the same physical instant.
    optional double unix_timestamp_s = 2;

    // True iff the receiver has a valid position fix at this sample. Defaults
    // to false (proto3 scalar default), which is the safe interpretation for
    // producers that omit it. Producers SHOULD also set fix_type when their
    // hardware reports finer detail — consumers MAY treat fix_type ∈
    // {Fix2D, Fix3D, RTK} as implying is_acquired = true even when the bool
    // is unset.
    bool is_acquired = 3;

    // Finer fix-quality classification, when the producer hardware reports it.
    // Optional — is_acquired alone is enough for the basic valid/invalid split.
    optional FixType fix_type = 4;

    enum FixType {
        Unknown = 0; // Producer did not classify the fix
        NoFix   = 1; // Receiver has no usable fix this sample
        Fix2D   = 2; // Horizontal position valid; altitude unreliable
        Fix3D   = 3; // Horizontal position + altitude valid
        RTK     = 4; // Real-Time Kinematic — centimeter-class accuracy (survey-grade)
    }

    // WGS-84 latitude in degrees, N positive / S negative.
    double latitude_degrees  = 5;
    // WGS-84 longitude in degrees, E positive / W negative.
    double longitude_degrees = 6;

    // Altitude in meters. Reference surface (ellipsoid vs MSL) is producer-
    // defined — see the COORDINATE / UNIT CONVENTIONS block above.
    optional float altitude_m = 7;

    // Ground speed in m/s.
    optional float speed_mps     = 8;
    // Ground course / heading in degrees, 0° = true north, increasing clockwise.
    optional float track_degrees = 9;

    // 1-σ uncertainty estimates as reported by the receiver, in the corresponding
    // native units. Producers SHOULD omit these when their hardware doesn't
    // supply them — zero is NOT a valid placeholder for "unknown".
    optional float horizontal_accuracy_m = 10;
    optional float vertical_accuracy_m   = 11;
    optional float speed_accuracy_mps    = 12;

    // Decomposed ground velocity in the ENU (East-North-Up) local-tangent-plane
    // frame, m/s. Optional alternative to speed_mps + track_degrees; many GNSS-
    // only formats emit the polar form instead. See the self-consistency
    // requirement in the COORDINATE / UNIT CONVENTIONS block when both
    // representations are present.
    optional float velocity_east_mps  = 13;
    optional float velocity_north_mps = 14;
    optional float velocity_up_mps    = 15;
}
```

{% endcode %}


# Authors

### Authors

* [AdrianEddy](https://github.com/AdrianEddy/) - *Author of the Rust implementation (code in this repository), author of the UI, GPU processing, rolling shutter correction and advanced rendering features*
* [Elvin Chen](https://github.com/ElvinC/) - *Author of the first version in Python, laid the groundwork to make all this possible*

#### Notable contributors

* [Maik Menz](https://github.com/mycosd/) - *Contributed to all areas of Gyroflow with fixes and improvements*
* [Aphobius](https://github.com/Aphobius/) - *Author of the velocity dampened smoothing algorithm*
* [Marc Roeschlin](https://github.com/marcroe/) - *Author of the adaptive zoom algorithm*
* [Ilya Epifanov](https://github.com/ilya-epifanov/) - *Author of the DaVinci Resolve (OpenFX) Plugin*
* [Vladimir Pinchuk](https://github.com/VladimirP1/) - *Author of robust gyro-to-video synchronization algorithm*
* [Chris Hocking](https://github.com/latenitefilms) - *Author of the Gyroflow Toolbox Plugin for Final Cut Pro*


