Skip to content

4. FGSEditor Overview

PingWer edited this page Apr 29, 2026 · 6 revisions

As you have seen in the previous pages, manually writing filmgrn1 files and balancing IIR filters to achieve a specific grain aesthetic is incredibly difficult and prone to mathematical instability.

FGSEditor abstracts all of this complexity away. It provides a visual, real-time environment where you can shape scaling curves, adjust intensities, and manage temporal events without ever touching raw code. The software automatically handles the mathematical limits and visualizes the results.

Here is a detailed overview of the FGSEditor workspace and how to integrate it into your video encoding pipeline.

homepage

1. Grain Generation Models & Presets

Instead of manually typing Auto-Regressive coefficients, FGSEditor provides powerful built-in generators:

Grain Size Presets

FGSEditor offers presets ranging from small "digital" noise to large "8mm" clumps. Larger grain sizes are achieved by automatically scaling the AR coefficients.

Presets range from 0 to 13 and manage both the intensity and the size of the grain:

  • Preset 0: Acts as a sort of photon noise (no spatial correlation), which is significantly more effective than simple dithering.
  • Presets 1 to 3: Excellent for debanding purposes.
  • Presets 4+: Introduce actual, heavier grain, designed for scenarios where proper regraining is necessary.

Photon Noise Model

Based on the official SVT-AV1-Essential implementation, this model simulates realistic camera sensor noise based on physics, eliminating the need for manual curve drawing.

  • Parameters: Adjust ISO strength, Sensor Format (e.g., 8mm, 16mm, 35mm, IMAX), and Transfer Functions (SDR, HDR/PQ, HLG).
  • Synergy: This feature can be combined with Grain Size presets to create highly realistic grain patterns that match specific film stocks.

2. The Static Editor (Single Event)

The primary interface is designed for surgical modification of a single FGS event, providing three main control areas:

  1. Interactive Plotter: A graphical environment where you can click and drag points to define scaling curves (sY, sCb, sCr). This determines the grain intensity distribution across different luminance and chrominance levels.
  2. Sidebar Controls: A comprehensive panel for adjusting global parameters like AR coefficients, scaling shifts, and applying the presets mentioned above.
  3. Grain Preview: A real-time plot at the bottom of the interface rendering the mathematical grain based on the AFGS1 specification.
static_editor

Note

Mathematical vs. Psychovisual Strength: The Grain Preview displays the exact variance injected into the pixels. Due to human "Luma Masking," the same grain strength often appears vibrant in mid-tones but becomes less perceptible in very dark or very bright areas.


3. Real-Time Stability and Clipping Alerts

FGSEditor performs real-time validation of your parameters to prevent digital artifacts and mathematical divergence. Understanding these alerts is critical.

Internal Noise Clipping ("Unsafe Preset")

Indicated by a bright red ar_coeff_shift box in the Sidebar.

  • What it means: Your AR coefficients are mathematically unstable (their sum exceeds the limits of the chosen shift).
  • Effect: The grain generator will diverge, producing static blocks or severe artifacts instead of noise.
  • How to Fix: FGSEditor will warn you immediately. You must increase the ar_coeff_shift value or decrease the individual cX coefficients until the red warning disappears.

External Pixel Clipping (Red Triangles on Luma points)

This alert indicates that the synthesized grain variance added to the decoded image pixels theoretically exceeds the color depth limits (e.g., 0-255 for 8-bit). However, the presence of these red triangles should not be alarming. It is simply an analytical warning, not a critical error.

Film Grain parameters are often derived from mathematical models (such as photon noise) that calculate variance using "full range" math. This naturally pushes extreme highlights or deep shadows past digital boundaries. When we apply this grain in post-production onto standard "limited range" digital video (e.g., 16-235), those theoretical peaks will inevitably be clamped.

This external clipping only becomes dangerous if a large portion of the grain variance falls completely outside the legal range, which can destroy fine image textures under a blanket of clamped white or black pixels. In reality, the impact depends entirely on your video content. If your footage rarely reaches those extreme brightness levels, the clipping will happen so infrequently that it won't be visually noticeable. You should use the red triangles purely as a cue to analyze your footage: if your video has heavily blown-out highlights, consider lowering the intensity of those specific curve points. Otherwise, occasional theoretical clipping is perfectly normal and safe to ignore.


4. The Dynamic Timeline (Multi-Event)

For projects requiring temporal grain changes (e.g., a movie with different film stocks or a grainy scene followed by a clean one), the Timeline Editor allows you to manage multiple FGS events:

  • Event Tracking: Visualize every grain change across the video's duration.
  • Temporal Precision: Modify start and end times for specific segments using Frames, Seconds, or Timecodes.
dynamic_editor_not_zoomed

5. Video Integration Workflow

  • Open Video: Drag and drop an MKV file into FGSEditor. It will automatically use grav1synth to extract any existing FGS metadata.
  • Save & Apply: Once you are happy with the grain, clicking save generates a new output video file with your updated grain parameters applied, leaving your original source file completely untouched.

Clone this wiki locally