Post-processing HDR10/Hyperion: Master-grade encoding with SVT-AV1 4.0!

Hi community,

Here is a script designed to help you generate a high-quality, final HDR10 file from a TVAI output processed with Hyperion.
You can use it with any source file; however, please note that I’ve named some variables “TVAI” for the sake of clarity.

svt-av1-psyex.txt (55.5 KB)
Rename this .txt file into .bat file and run it from cmd console

What does it do ?

It pipes the FFmpeg stream directly into SVT-AV1, combining the versatility of FFmpeg for handling various sources with the superior encoding efficiency of SVT-AV1.
The output will be a fully compliant HDR10 file, strictly following the ITU-R BT.2100 standard (PQ / Rec.2020).
I chose the AV1 codec and the Intel SVT-AV1 encoder because they represent the most advanced encoding technology available today, with rapidly growing support across all platforms.

Key features

  • Safety: It prevents you from encoding a master with incorrect parameters that you might overlook in the heat of the moment.

  • Efficiency: It uses a piped FFmpeg/SVT-AV1 process to leverage the superior scene change detection of SVT-AV1.

  • Quality: It utilizes the SVT-AV1-PSYEX fork to deliver state-of-the-art HDR10 perceptual quality for your videos.

  • CLI : Visual clarity through a clever use of colors and symbols, even within a CLI environment.

  • Bulletproof : The script features an interactive Q&A to validate or override settings, ensuring all potential edge cases are covered.

How to set it ?

Fill the parameter from

:: ===========================================================================================================================================================

:: START of section to fill

:: ===========================================================================================================================================================

to

:: ===========================================================================================================================================================

:: END of section to fill

:: ===========================================================================================================================================================

If you aren’t familiar with SVT-AV1 or SVT-AV1-PSYEX parameters, feel free to leave them as they are; the default settings already deliver high-quality results.

What programs are needded ?

FFmpeg : https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z
SVT-AV1-PSYEX : https://github.com/BlueSwordM/svt-av1-psyex/releases/download/v3.0.2-B/windows_svt-av1-psyex-v3.0.2B_x86-64-v3.zip
Mkvtoolnix : https://mkvtoolnix.download/windows/releases/97.0/mkvtoolnix-64-bit-97.0-setup.exe

Sample result explored with Mkvtoolnix & Mediainfo


Color coding legend

Scanline handling

(see below for further explanations)


Optionnal MaxFALL & MaxCLL computation

(see below for further explanations)

Temporary and previous run handling

Feel free to share your questions, critiques, or recommendations!

[Edits]

  • Uncapped MaxFALL/MaxCLL calculation following PQ standards (10000 nits)

Source Analysis & Metadata Extraction

Instead of forcing the user to manually enter source specifications, the script queries the input file directly to ensure 100% accuracy in the processing chain.

  • Automated Probing: The script executes an optimized ffprobe command targeting only the first video stream (v:0). It extracts critical data points such as resolution, color space, frame rate, and field order.

  • Dynamic Variable Mapping: By using the default=nk=0:nw=1 output format, the script captures ffprobe’s output and instantly converts it into Batch variables (e.g., width=3840).

  • UI Polish: To keep the console clean, it uses custom calls (:move_up and :erase_line) to replace the “Running…” status with a “Success” message once the analysis is done.

  • Standardization: The script then “re-maps” these raw values into dedicated input variables (like width_in or fps_in). This creates a clean separation between the original source data and the target output data, allowing for precise comparison later in the script.

  • Eliminates Human Error: By reading the field_order (Interlaced vs Progressive) and color_space directly from the file, the script prevents common mistakes where a user might apply the wrong HDR tags or miss an interlaced source.

  • Bulletproof Logic: This is where the script gathers the “truth” about the file. Without this step, the subsequent automated scaling, color range matching, and HDR metadata injection would not be possible.

Interlaced Scan Safety Gate

Since the AV1 codec is strictly progressive-only, feeding it interlaced material without proper handling would result in severe visual artifacts (combing).

  • Field Order Detection: The script checks the field_order_in variable (retrieved during the analysis phase) against known interlaced standards:

    • i: Identifies Bottom Field First (BFF), common in DV/NTSC SD content.
    • tt: Identifies Top Field First (TFF), the standard for HD broadcast and DVDs.
  • Automatic Redirection: If either interlaced type is detected, the script interrupts the automatic flow and jumps to a specific prompt (:prompt_interlaced_fo). This forces the user to acknowledge the state of the source.

  • Missing Metadata Handling: If the field order is empty (""), the script triggers a warning prompt (:prompt_missing_fo). This is a “fail-safe” for files with malformed headers, ensuring the user manually verifies if the source is truly progressive or not.

  • Prevents “Combing” Artifacts: Encoding interlaced video as progressive creates permanent “jagged lines” in motion that cannot be fixed later.

  • Expert Guidance: Instead of just failing, the script uses this logic to recommend high-quality deinterlacing (like QTGMC via Topaz or VapourSynth) before the AV1 encoding process, ensuring the highest possible output fidelity.

Terminology & Conventions

To ensure maximum precision—especially when dealing with anamorphic or interlaced content—this script follows these specific ratio conventions:

  • PAR (Pixel Aspect Ratio): Defines the shape of an individual pixel. Not all pixels are square! This is crucial for correctly interpreting legacy formats (like DVD or DV).
  • DAR (Display Aspect Ratio): The final intended shape of the image when viewed on a screen (e.g., 16:9 or 4:3).
  • SAR (Storage Aspect Ratio): Refers strictly to the pixel dimensions stored in the container (e.g., 720x576).

Why I don’t use the FFmpeg convention: Standard FFmpeg documentation often uses SAR to mean Sample Aspect Ratio (which is technically the same as PAR). This creates unnecessary confusion between “Sample” and “Storage.”

By sticking to PAR / DAR / SAR as defined above, the script eliminates ambiguity and ensures that your final HDR10 output maintains its correct geometry, regardless of the source’s original format.

VUI Mismatch Breakdown

To maintain absolute signal integrity, the script monitors three critical parameters. A mismatch in any of these will trigger the color_tags_mismatch flag:

1. Primaries Mismatch (Color Gamut)

  • What it is: Defines the coordinates of the Red, Green, and Blue “reference” points (e.g., BT.709 for HD or BT.2020 for Ultra HD/HDR).
  • The Risk: If you encode a BT.709 source into a BT.2020 container without proper signaling, the TV will map the colors incorrectly, leading to dull, undersaturated, or “shifted” colors.
  • The Check: The script detects if your output gamut differs from the source, ensuring you don’t accidentally “mislabel” the color space.

2. Transfer Mismatch (EOTF / Gamma curve)

  • What it is: The mathematical curve that dictates how digital values are converted into visible light (e.g., SDR Gamma vs. HDR PQ/ST.2084).
  • The Risk: This is the most visible error. If the metadata says “SDR” but the stream is “HDR” (or vice versa), the image will appear either heavily “washed out” (low contrast) or completely “blown out” (crushed highlights).
  • The Check: It ensures the luminance behavior of your file matches the intended display standard.

3. Matrix Mismatch (YUV to RGB Conversion)

  • What it is: The coefficients used to transform the video’s YUV data back into RGB for your screen.
  • The Risk: A mismatch here causes a “Color Shift.” Even if brightness is correct, hues will be off—skin tones might look slightly green or purple because the TV is using the wrong math to calculate the color.
  • The Check: It guarantees that the mathematical “recipe” used to decode the color remains consistent from input to output.

4. Color Range & Levels Validation

This logic handles one of the most common “silent killers” in video encoding: Color Range (Limited vs. Full). It ensures that black and white levels are correctly interpreted between the source and the final encode to avoid contrast issues.

  • Standardized Translation: It maps ffprobe string outputs (tv or pc) into a clear, unified format: Limited (16-235) or Full (0-255).
  • MPEG-2 Legacy Fail-safe: The script includes an implicit rule for MPEG-2. Since MPEG-2 is almost strictly Limited Range by standard, the script automatically fills the metadata if it’s missing, preventing “Unknown range” errors.

5.Smart DAR Analysis & Fallback Logic

This section ensures that the Display Aspect Ratio (DAR) is always accurately identified, even when the source file metadata is missing or malformed.

  • Intelligent Calculation (The Fallback): If the DAR isn’t defined in the file headers, the script doesn’t give up. It triggers a mathematical fallback
  • Standard Ratio Lookup: It references a pre-defined list of industry-standard ratios (from classic 4:3 to ultra-wide 32:9) to prepare for further validation or snapping.

6.Resolution & Field Order Management

The script handles the spatial transformation of the video and tracks the scan type (Progressive vs. Interlaced) to ensure a clean transition to the final AV1 output.

  • Scan Type Detection (Field Order): The script identifies the input’s field order (i, tt, p).
    • Visual Cues: Interlaced sources are flagged in yellow (i) as they require special attention, while progressive sources are marked in blue (p).
    • The “?” Safety: If the metadata is missing, a yellow question mark appears, alerting the user that the scan type is undetermined.
  • Smart Scaling Detection:
    • Dynamic vf Construction: If the output resolution differs from the source, the script automatically injects the zscale filter into the FFmpeg chain.
    • Directional Arrows: It calculates the pixel count to determine if you are Upscaling (↑) or Downscaling (↓), providing immediate visual context.
  • Algorithm Labeling: The script translates technical filter names into more readable labels (e.g., Spline 36p² or Lanczos3), making the summary table more professional and explicit.
  • In an HDR10/AV1 workflow, proper scaling is vital. By using zscale (ZImg library) instead of the standard swscale, the script maintains higher bit-depth precision and avoids common “ringing” or “aliasing” artifacts. Furthermore, explicitly flagging interlaced input prevents the common mistake of encoding interlaced content directly into AV1, which is a progressive-only codec.

7.PAR Standard Validation & Lookup

The scriptfocuses on the Pixel Aspect Ratio (PAR), ensuring that non-square pixel sources (common in SD/Anamorphic content) are correctly identified and handled.

  • Standard Ratio Lookup: The script maintains a lookup table of industry-standard PARs (e.g., 8:9, 10:11, 16:11, etc.). These correspond to PAL and NTSC standards for both 4:3 and 16:9 content.
  • Integrity Check: It cross-references both the input and output PAR against this table. If a ratio isn’t found, it flags it as non-standard (par_in_std=n), alerting you to potentially malformed metadata.
  • Human-Readable Descriptions: Instead of just showing numbers like 10:11, the script calls a lookup function to provide context (e.g., “NTSC 4:3” or “PAL 16:9”).
  • Dynamic Labeling: If the PAR remains unchanged, it shows a clean blue status.
    • If a PAR conversion is happening (e.g., conforming anamorphic content to Square Pixels 1:1), it displays a clear transformation path (Source ► Target) in yellow.

8.SAR Computation & Validation

This final stage of the aspect ratio logic computes the SAR (Storage Aspect Ratio). As defined in this script’s convention, SAR represents the raw pixel resolution (e.g., 720x576 or 1920x1080) derived from the relationship between the Display Aspect Ratio (DAR) and the Pixel Aspect Ratio (PAR).

  • Mathematical Derivation: The script calls a dedicated function to calculate the SAR based on the previously validated DAR and PAR values. This ensures that the three values ($DAR$, $PAR$, $SAR$) remain mathematically consistent ($DAR = SAR \times PAR$).
  • Input vs. Output Tracking: It computes both the source SAR and the target SAR to monitor any changes in the underlying pixel grid.
  • Smart Labeling: * If the storage ratio remains identical, it displays a clean status in blue.
    • If a change is detected (e.g., during an upscale or a crop/resize operation), it displays a transformation path (Source ► Target) in yellow.
  • Verification: By calculating the SAR independently, the script acts as a final “check-sum” for your geometry settings. If the computed SAR doesn’t match your intended output resolution, you know immediately that your PAR or DAR values are incorrect.
  • Bulletproof Metadata: This logic ensures that when the video is muxed into the final container (MKV/MP4), the relationship between the stored pixels and the display dimensions is perfectly calibrated, preventing any “squashed” or “stretched” images on playback devices.

The Comprehensive Encoding Dashboard

Just before the encoding begins, the script displays a detailed Technical Summary. This isn’t just a list of settings; it’s a dynamic dashboard that shows the “Transformation Journey” from source to destination.

  • Workflow Visualization: A clear Input ► Processing ► Output header that immediately shows the source container and the target AV1 bitstream.
  • Unified Video Parameters: This section groups all core video attributes (Resolution, FPS, Aspect Ratios, Color Range, and Metadata). It uses the “Comparison Labels” we saw earlier (e.g., Source ► Output), making any change (upscaling, frame rate conversion, etc.) impossible to miss.
  • Deep Color & HDR Metadata: It explicitly lists the VUI tags (Primaries, Transfer, Matrix) and Mastering Display Metadata. This is crucial for HDR10 to ensure the encoder is correctly receiving the brightness and color gamut targets.
  • Advanced SVT-AV1-PSY Tuning: This is the “Engine Room.” The dashboard exposes high-level SVT-AV1 parameters (CRF, Preset, Lookahead) but also dives into advanced Psychovisual (PSY) and Variance Boost settings.
    • It tracks everything from Quantization Matrices (QM) to Hierarchical Levels, giving power users full visibility over how the encoder will prioritize grain, sharpness, and motion.
  • PSYEX Specifics: Highlights the unique parameters of the SVT-AV1-PSYEX fork, such as Complex HVS and Psycho RD, which are key to achieving superior visual fidelity compared to the standard encoder.

This dashboard serves as the final Quality Gate. In one glance, an encoder can verify that their bitstream is compliant, their HDR tags are correct, and their psychovisual tuning is exactly as intended. It eliminates the “black box” feeling of command-line encoding and ensures a professional, predictable result every time.

Pro-Active Warning System & Pre-Flight Checks

Before the encoding process starts, the script runs a comprehensive Pre-Flight Check. It uses the flags generated in previous steps to display human-readable warnings. This prevents the most common “encoding disasters” by alerting the user to potential issues.

  • Spatial & Temporal Mismatch: Alerts the user if the resolution or FPS is being changed, explicitly stating which Resizing Algorithm (e.g., Spline36) and Resize Type (Upscaling/Downscaling) will be used.
  • Color Range Awareness: This is a standout feature. The script doesn’t just say “Range Mismatch”; it explains the visual consequence:
    • TV ► PC: Warns about crushed blacks and oversaturated colors.
    • PC ► TV: Warns about washed-out colors and lifted blacks.
  • VUI Metadata Integrity:
    • It handles the “Unknown/Unspecified” (Value 2) edge case. If tags are missing from an MKV source, it tells the user that the mismatch is “Potential” but not confirmed, avoiding false positives.
    • For confirmed mismatches, it lists exactly which tag is problematic (Primaries, Transfer, or Matrix).
  • Aspect Ratio Validation: Flags any DAR (Display Aspect Ratio) that deviates from the source or fails to match industry standards, preventing stretched images.
  • Interlace Guard: Since SVT-AV1-PSY (and AV1 in general) is designed for progressive content, the script issues a high-priority warning if an interlaced source is detected, recommending external deinterlacing (like QTGMC) for optimal results.

This system turns a “blind” command-line tool into an expert assistant. By surfacing these technical nuances before the first frame is processed, the script ensures that the user is fully aware of every transformation, guaranteeing a consistent, high-grade HDR10/AV1 output.

Post-Process Metadata & Bitrate Refinement

Once the encoding is complete, the script performs a final pass to extract and format technical metadata. This ensures that the generated file isn’t just a video stream, but a fully documented asset compliant with professional playback standards.

  • Precision Bitrate Calculation:
    • Instead of relying on rough estimates, the script queries the final file using ffprobe to get the exact raw bitrate.
    • Batch Arithmetic Hack: Since Windows Batch doesn’t support floating-point numbers, the script uses a clever /10000 and modulo logic to reconstruct a precise decimal value (e.g., converting 15420000 bps into a readable 15.42 Mbps).
    • It includes a fallback warning if the bitrate metadata is missing, ensuring the user is never left with an “n/a” without explanation.
  • HDR Mastering Metadata Conversion (The “Translator”):
    • FFmpeg to MKV bridge: FFmpeg reports Mastering Display Metadata in a specific string format (e.g., R(x,y) G(x,y)...). However, muxers like mkvmerge or HDR10 signaling require a different coordinate string.
    • String Parsing: The script uses for loops and custom delimiters to “strip” the parentheses and labels, extracting the raw coordinates for Red, Green, Blue, and the White Point.
    • Coordinates Mapping: It reconstructs the chroma_coord and white_coord variables. This is the “secret sauce” that allows the HDR10 metadata to be correctly injected into the final MKV container, ensuring your TV knows exactly how to map the colors based on the original mastering monitor.

This is the difference between a “file that plays” and a “Master-grade file.” By meticulously re-formatting the Mastering Display Metadata, the script guarantees that the high-dynamic-range information is preserved through the entire pipeline. It prevents the loss of HDR signaling that often occurs when simply piping raw streams into containers.

HDR10 Metadata Injection & Final Muxing

This final stage uses mkvmerge to package the AV1 stream into a permanent MKV container. Rather than a simple mux, the script performs a surgical injection of HDR10 parameters to ensure 100% compatibility with HDR displays.

  • Dynamic Track Labeling: The video track is automatically named with its actual bitrate (e.g., "AV1 15.42 Mbps"). This provides immediate technical info to the user during playback via media players like MPC-HC or VLC.
  • Low-Level Signal Correction: The script forces specific flags that are often lost or misinterpreted during the encoding process:
    • Chroma Subsampling: Explicitly sets 1,1 (for 4:2:0) to prevent playback devices from guessing the chroma alignment.
    • Bit Depth: Hard-codes the 10-bit (or 12-bit) signal into the MKV headers.
  • Full HDR10 Static Metadata Suite: It injects the coordinates parsed in the previous steps:
    • Chromaticity & White Point: Defines the exact color gamut boundaries.
    • Luminance Range: Sets the min-luminance and max-luminance of the mastering display.
  • Automated Light Level Analysis (MaxFALL/MaxCLL): * If enabled, the script calls a function to analyze the actual IVF stream to calculate the Max Content Light Level (MaxCLL) and Max Frame Average Light Level (MaxFALL).
    • These values are then injected, allowing HDR TVs to apply the most accurate Tone Mapping possible based on the brightest pixels in your specific video.
  • Robust Error Handling: The script monitors the mkvmerge exit code. If the muxing fails (e.g., disk full or header corruption), it halts the process with a critical error message instead of leaving you with a broken file.

Without this block, an AV1 encode might play, but it might not trigger the “HDR” logo on your TV, or it might use the wrong brightness levels. By manually “fixing” these flags in the MKV container, you ensure that the video is played exactly as it was intended, with perfect color and luminance reproduction.

Automated Cleanup & Finalization

This final stage of the workflow handles the transition from temporary workfiles to the final “Master” file. It ensures that the user’s workspace remains clutter-free while confirming the integrity of the process.

  • Verification: The script only proceeds to this stage if the previous muxing step was successful (Muxing done successfully !).

  • Temporary File Purge: It deletes the IVF container (the raw AV1 stream), which is no longer needed after being muxed into the MKV.

    • It removes the Intermediate MKV (the version without the corrected HDR10 metadata), preventing any confusion between the “raw” encode and the “fixed” version.
  • Smart Renaming: Using the move /y command, it replaces the temporary flagged file with the final filename. This makes the entire process transparent to the user: they started with an input and ended with a single, perfectly tagged AV1 output.

  • Process Exit: A final “Success” message is displayed, and the script pauses. This is crucial as it allows the user to review the logs, bitrate calculations, and HDR metadata confirmations one last time before closing the console.

  • Efficiency: Automated cleanup is vital when dealing with high-bitrate HDR files that can easily take up dozens of gigabytes.

  • Reliability: By using 2>nul, the script silences potential errors during deletion (like if a file was already moved), ensuring a smooth exit without alarming the user with unnecessary “File not found” messages.

  • Professionalism: It delivers a “clean” final product, exactly where the user expects it, with all temporary “under-the-hood” artifacts removed.

User Configuration: Full Parameter Guide

Language & Global Settings

  • language: Sets the ISO language tag for the MKV metadata (e.g., fr-FR). This ensures players display “French” instead of “Unknown” for the track.

AOM AV1 Generic Parameters

  • max_birate: Sets the maximum bitrate limit in Mbps. It prevents massive data spikes that could cause buffering on hardware players.
  • max_birate_overshoot: The allowed percentage for the bitrate to exceed the max limit during very complex scenes.
  • preset: Determines the speed vs. efficiency tradeoff. 2 is slow (best quality), while 8 is very fast (lower efficiency).
  • crf: Constant Rate Factor. Controls the quality target; lower values (e.g., 16) result in higher quality and larger files.
  • lp: Logical Processors. Defines how many CPU threads to use. 0 is auto, or set a specific number to limit CPU load.
  • fps_num / fps_den: The numerator and denominator for the frame rate (e.g., 24000/1001 for 23.976 fps). Essential for audio sync.
  • width_out / height_out: The target resolution. The script will automatically resize the source if it doesn’t match these.
  • resize_algo: The scaling filter. spline36 is balanced, while lanczos is sharper but may cause “ringing” artifacts.
  • master_disp_meta: Manual override for HDR Mastering Display metadata. Leave empty for the script to auto-detect from the source.
  • enc_color_format: Internal color format (e.g., 1 for YUV 4:2:0, the most compatible consumer standard).
  • bit_depth: Bit depth of the output. 10 is highly recommended for HDR and to prevent “banding” in SDR gradients.
  • color_range: Luminance range. 0 for Limited (standard for TV/Movies), 1 for Full (standard for PC/Monitors).
  • color-primaries: The color gamut (e.g., 9 for BT.2020/HDR, 1 for BT.709/SDR).
  • transfer_characteristics: The EOTF curve (e.g., 16 for PQ/HDR10, 1 for Gamma/SDR).
  • matrix_coefficient: The YUV conversion matrix (e.g., 9 for BT.2020, 1 for BT.709).
  • chr_samp_pos: Chroma sample location. colocated is the standard and recommended setting for AV1.

Intel SVT-AV1 Core Parameters

  • recode_loop: Number of attempts the encoder makes to reach the target quality/bitrate for a frame.
  • tune : It is designed to prioritize raw visual quality and high fidelity. While it is more efficient at preserving detail than tune 1 (the subjective/VMAF tune), it can sometimes be “aggressive” on edges. 0 is a must have to enable PSYEX feature
  • noise_adapt_filter: Enables an adaptive filter that protects source grain from being destroyed by compression.
  • sharpness: Adjusts edge sharpness. Positive values sharpen the image; negative values soften it.
  • scd: Scene Change Detection. Enables the encoder to place clean keyframes at every scene cut.
  • look_ahead_sec: The amount of video (in seconds) the encoder analyzes in advance to plan for motion and complexity.
  • hier_lvls: Number of hierarchical B-frame levels. 5 or 6 typically provide the best compression efficiency.
  • startup_mg: Sets the size of the initial Mini-GOP (Group of Pictures) at the start of the stream.
  • qm: Enables Quantization Matrices. Helps preserve fine details by optimizing bit distribution across frequencies.
  • qm_min / qm_max: Sets the minimum and maximum quality boundaries for the Quantization Matrices.
  • chroma_qm_min / chroma_qm_max: Same as above, but specifically for the color (Chroma) channels.
  • deblock_loop_filter: Anti-blocking filter. Essential for smoothing out compression artifacts in dark or flat areas.
  • temp_filter: Temporal filtering. Reduces noise by analyzing pixels across multiple frames.
  • temp_filter_str: The strength of the temporal noise reduction filter.
  • keyframe_temp_filter_str: The strength of filtering applied specifically to the most important frames (Keyframes).
  • variance_boost: Enhances bit allocation for fine-textured areas to prevent them from looking “smeared.”
  • variance_boost_str: The strength of the variance boost. Higher values (e.g., 3) help maintain film grain.
  • variance_oct: Sets the sensitivity for octile-based analysis in the variance boost logic.
  • alt_variance_boost_curve: Uses an alternative curve for variance boost, often better for organic film grain.

PSYEX Fork Parameters

  • spy_rd: A PSY-fork specific algorithm that distributes bitrate based on human visual perception.
  • complex_hvs: A complex Human Visual System model that helps hide compression where the eye is less likely to see it.
  • noise_norm_str: Normalizes compressed grain so it appears natural and “analog” rather than robotic.
  • low_q_taper: Adjusts quality in very dark areas to prevent “flickering” or “pulsing” artifacts.
  • psy_rate_dist: The core Psychovisual setting. Higher values prioritize “beauty” over raw mathematical accuracy.
  • qp_scale_compress_str: Compresses the range of QP values to prevent jarring quality jumps between frames.

Paths & Executables

  • tvai_path / tvai_file: The directory and filename of your source video (e.g., a Topaz Video AI export).
  • av1_path: The destination folder where your final MKV file will be saved.
  • svtenc / ffprobe / ffmpeg / mkvmerge / mkvpropedit: The full paths to your tool executables. Ensure these are correct for the script to run.
1 Like

Official Thread Guide

SVT-AV1-PSYEX fork

SVT-AV1

https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md?ref_type=heads

FFmpeg

FFprobe

:: Convert 'Mastering Display Metadata' from FFmpeg format to MKV format
set "chroma_coord=" & set "white_coord="

if defined master_disp_meta (
    for /f "tokens=1,2 delims=()," %%a in ("%master_disp_meta:*R(=%") do ( set "rx=%%a" & set "ry=%%b" )
    for /f "tokens=1,2 delims=()," %%a in ("%master_disp_meta:*G(=%") do ( set "gx=%%a" & set "gy=%%b" )
    for /f "tokens=1,2 delims=()," %%a in ("%master_disp_meta:*B(=%") do ( set "bx=%%a" & set "by=%%b" )
    for /f "tokens=1,2 delims=()," %%a in ("%master_disp_meta:*WP(=%") do ( set "wpx=%%a" & set "wpy=%%b" )
)

if defined rx set "chroma_coord=%rx%,%ry%,%gx%,%gy%,%bx%,%by%" &  set "white_coord=%wpx%,%wpy%"

This code causes redundant Mastering Display data injection. I will patch it ASAP. It has no effect other than showing duplicate entries in MediaInfo.

The PSY(EX) fork has been integrated into the SVT-AV1 mainline, which is a huge win for these enhancements!

The SVT-AV1 4.0 release also brings further improvements in quality and file size—it’s impressive!

I’ve adapted the script accordingly. You should now use the mainline SVT-AV1, which you can find precompiled here: Package: mingw-w64-x86_64-svt-av1 - MSYS2 Packages

Just unzip/untar the package and drag-and-drop the .exe and .dll into your SVT-AV1 folder. :slightly_smiling_face:

Below the new batch script, rename it from .txt to .bat

svt-av1-4.txt (55.2 KB)

Back to mainline SVT-AV1, I will add multipass for even more quality and size ! Even if using CRF mode :smiley:

Added: Area, Catmull-Rom and Mitchell-Netravali resize algo.
Added : More explicit “Hierarchical levels [0-6]” readable value
Added : More explicit “Startup MG -mini GOP [0,2,3,4]” readable value
Fixed : Tune label for SVT-AV1 matching and not anymore to SVT-AV1-PSYx (0:VQ, 1=PSNR, 2=SSIM", 3=IQ (Image Quality), 4=MS-SSIM / SSIMULACRA2)
Added : “Adptative film grain parameter” (Off/On)
Fixed : Input file is missing now proprely trigger exit
Fixed : Multithread handling (0= Auto, 1->3 low/mid/high, 4->5 high/vhigh +miniGOP(RAM+), 6-> max (RAM++))
Fixed : Mastering Display Metadata duplicated entry has been removed from encoding for a proper add with Mkvmerge
Fixed : Some minor display bugs patched, and typo fixed

Latest script below to rename from .txt to .bat

svt-av1-4.txt (57.4 KB)

New : With ~PSYEX parameters, encoding speed is x2 and size 9.5% lighter ! using 4.x

More modern resize algos coming soon :slight_smile: specifically those using the Vulkan API :wink:



Added : Hermite resize algo.
Added : Han resize algo. (Vulkan)
Added : Lanczos resize algo. (Vulkan)
Added : LanczosSharp resize algo. (Vulkan)
Added : Lanczos4 resize algo. (Vulkan)
Added : Lanczos4Sharp resize algo. (Vulkan)

Latest script below to rename from .txt to .bat

svt-av1-4b.txt (59.5 KB)