Skip to content

4. FGSEditor Overview

Michele Cosentino edited this page May 31, 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")

This severe warning is indicated by a bright red ar_coeff_shift box in the Sidebar. Unlike external clipping, this alert must never be ignored. It means your Auto-Regressive (AR) coefficients are mathematically unstable because their total sum exceeds the safety limits imposed by the chosen ar_coeff_shift value.

If you attempt to apply an unstable preset, the grain generator will completely diverge. Instead of producing natural, randomized noise, the math will break down and produce repeating geometric patterns, pure static blocks, or severe digital corruption across your video.

Because FGSEditor performs this validation in real-time, it will warn you immediately. To resolve this, you must either increase the ar_coeff_shift value (which raises the mathematical stability threshold) or decrease the intensity of the individual cX coefficients until the red warning disappears and the generator returns to a safe state.

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., 16-235 for 8-bit limited range). 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, 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, such as a movie with different film stocks or a grainy scene followed by a clean one, the Timeline Editor allows you to fully manage multiple FGS events. You can visualize every grain change across the video's duration and modify start and end times for specific segments using Frames, Seconds, or Timecodes. Crucially, you can dynamically expand and adjust your timeline by adding new grain events or deleting existing ones directly inside the editor, giving you absolute control over the temporal layout.

dynamic_editor_not_zoomed

5. Video Integration Workflow

For AV1 workflows, you can drag and drop an AV1 MKV file into FGSEditor. The app automatically uses grav1synth to extract any existing FGS metadata. Once you are happy with your edits, clicking Save & Apply generates a new output video file with your updated grain parameters applied, leaving your original source file completely untouched.

For HEVC (x265) workflows, you can import HEVC video files in MP4 or MKV format. The app will automatically run ffprobe to read the video's exact duration and frame rate (FPS) to set up your timeline workspace. However, because grav1synth is strictly an AV1 tool, automated grain extraction and the Save & Apply button are completely disabled for HEVC files. Instead, you can design your grain curves manually and use Save Binary to export your tables to external .bin files to feed into your HEVC encoder.


6. Settings & Performance Calibration

Accessible from the main menu, the Settings dialog allows you to tune FGSEditor to match your hardware capabilities and protect your work with automated backups.

Autosave & Backups

To protect against unexpected crashes, the editor includes a robust, background autosave engine. Backups are automatically placed in a backup folder created next to the application executable or the open file. You can adjust the autosave interval in the settings, starting from a minimum of 1 minute (with a default of 5 minutes). The backup files are named automatically following the pattern {original_name}_{timestamp_down_to_minute}_{dynamic/static}.txt.

Performance Tuning

To optimize real-time calculations, especially when calculating dynamic grain strength across long timelines, you can fine-tune resource limits directly in the settings. You can set the maximum number of multiprocessing workers allocated for dynamic FGS strength calculations, ranging from a minimum of 1 to a maximum of 2x the number of logical CPU cores to leverage hyper-threading and SMT architectures safely. Additionally, you can configure the maximum RAM cache size for pre-rendered frames to keep the timeline preview fast and fluid, as well as adjust the thread stack size constraint for massive projects.

Caution

Application Restart Required
Changing critical system and performance parameters (such as the number of parallel processes or the stack size) requires a full application reload. When you click Apply, the editor will display a confirmation dialog prompting you to ensure all unsaved changes are secured. Confirming will automatically restart the application to apply the new hardware boundaries safely. Clicking No cancels the action.

Clone this wiki locally