Skip to content

feat: Windows context menu, HDR handling and AV1 input (v1.3.0) - #16

Merged
SimpNick6703 merged 41 commits into
mainfrom
feat/hdr
Nov 23, 2026
Merged

SimpNick6703 merged 41 commits into
mainfrom
feat/hdr

Conversation

@SimpNick6703

@SimpNick6703 SimpNick6703 commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Changes for v1.3.0: a Windows right-click installer, HDR10 and HLG handling, AV1 input, a budget-aware audio rule, and fixes for the stutter at the split point and for rotated videos being written sideways.

Pre-release for feedback: v1.3.0-rc5, built from this branch at a526b7a. The rounded tables, the Ctrl+C and file name fixes, the installer note and the documentation updates came after rc5. This stays a draft while feedback comes in.

Requirements

  • NVIDIA: driver 610.0 or newer for NVENC. With an older driver the app uses the next encoder, down to the CPU. This has been true since v1.1.4, and GTX 900 and 10 series cards cannot install 610.
  • Linux: glibc 2.38 or newer, for example Ubuntu 24.04 or Debian 13. This has been true since v1.0.0.

What to try

  • Windows: install VideoCompression-Setup-win64-1.3.0-rc5.exe, then right-click a video (under Show more options on Windows 11).
  • HDR videos: HEVC should stay HDR. H.264 should look natural on an SDR screen.
  • Anything else: the preset executables work as before. Please attach the _compress-error.log file if one fails.

Changes

Windows installer

  • The codec page notes that H.264 always converts HDR to SDR, with a link to the Architecture Explorer.
  • Per-user Inno Setup installer with a right-click submenu (20 MB, 50 MB, 100 MB, 1 GB, Custom) for .mp4, .mkv, .mov, .avi, .webm, .m4v, .flv and .3gp.
  • Installing over rc1 or rc2 removes their entries for the six file types that are not supported.
  • New --custom flag for the Custom menu entry.

HDR and AV1

  • GPU HEVC keeps HDR10/HLG at the source bit depth.
  • H.264, and HEVC on the CPU encoder, tone-map to SDR on the CPU. This is by design.
  • HLG uses agamma=0, so the system gamma is applied on luminance. HDR10 keeps the faster default, which is already correct for it.
  • Colour tags are read from the first frame. Missing transfer, primaries or matrix tags are filled in for zscale.
  • AV1 sources can be decoded through FFmpeg n9.1 from ffmpeg-minimal-builds.

Fixes

  • Split encodes: segments are encoded video-only and the audio is added once when stitching, which removes the timestamp gap at the split.
  • Ctrl+C exits with 130 on the CPU path and at the Custom... size prompt, and removes the partial output on both encode paths.
  • Stitching works when the temp folder path contains ' (for example a user named O'Brien).
  • An input already under the target exits before the audio and HDR probes.
  • Only names with a file extension are paths, so 20 is always a size. Since v1.1.6-pre an item named 20 in the working directory changed the target, and could make the app overwrite the input.
  • Rotated videos play upright (v1.2.0 wrote them sideways on NVENC and VA-API).
  • Audio: copied by default. Lossless audio, and audio above 160 kbps that would take more than 10% of the target, is re-encoded to 128 kbps stereo AAC, and the video budget gets the saved bits. Audio FFmpeg cannot decode is copied.
  • Audio without a reported bitrate is measured from its first 30 s of packets.
  • The AAC encoder check works with FFmpeg 9.
  • Linux: a missing VA-API runtime library gives a message with the install command.

Console

  • Tables and panels have rounded corners, including in the classic Windows console that the right-click menu opens.

Build and docs

  • The release workflow builds the installer and runs when a release is published, including published drafts.
  • build.py requires the zscale and tonemap filters.
  • pyproject.toml packages only videocompress, so pip install -e . works with the installer/ directory present.
  • The Architecture Explorer has an HDR & Color tab with explanations and benchmarks, plus fixes for table colours and the narrow-screen tab bar.
  • The Architecture Explorer's dataflow figures are re-measured on release executables, and its BPP calculator now picks the same settings as the app.
  • The Architecture Explorer's Engine tab has a decision table for every input type, and the HDR tab links explanatory articles.
  • README and captions are updated. tools/bench_vitals.py is removed.

Behaviour changes to review

  • Audio: when re-encoded, surround becomes stereo and a 3-minute video takes about 4 s longer.
  • HDR to H.264: output is now SDR, and slower than HEVC with HDR kept.
  • CLI: input and output names need their extension. Folder names, names without an extension and unknown options are rejected instead of being used as the output name.
  • Installer: updates keep the earlier codec choice, and /CODEC overrides it. A first silent install uses HEVC.

Benchmarks

RTX 4060 laptop (NVENC), release executables.

rc5 against v1.2.0, HEVC. The 110 MB rows are the mean of two runs, the others one run:

Source, target Version Time Size Video bitrate Gap at split
170 s 4K60, 110 MB v1.2.0 41.8 s 99.57 MB 4693 kbps 43 ms
170 s 4K60, 110 MB rc5 42.3 s 99.53 MB 4691 kbps none
183 s 4K, 110 MB v1.2.0 42.3 s 99.61 MB 4337 kbps 486 ms
183 s 4K, 110 MB rc5 42.9 s 99.62 MB 4348 kbps none
183 s 4K, 20 MB (audio re-encoded) v1.2.0 42.2 s 18.51 MB 639 kbps 486 ms
183 s 4K, 20 MB (audio re-encoded) rc5 46.4 s 18.48 MB 703 kbps none
237 s 1080p60, 20 MB (audio re-encoded) v1.2.0 22.6 s 20.35 MB 512 kbps 103 ms
237 s 1080p60, 20 MB (audio re-encoded) rc5 28.3 s 18.76 MB 522 kbps none
12 s 4K60 HDR10 to 1440p, 20 MB v1.2.0 6.2 s 17.20 MB, 8-bit 10913 kbps 518 ms
12 s 4K60 HDR10 to 1440p, 20 MB rc5 6.2 s 17.20 MB, 10-bit 11363 kbps none

Cost of converting HDR to SDR, 8.5 s 4K60 HDR10 at 20 MB, mean of two runs:

Output Time CPU
HEVC, HDR kept 8.5 s 2%
H.264, SDR 31.0 s 72%

HLG to H.264, 4K60:

Source rc4 (wrong colours) rc5 Ratio
Game capture converted from PQ 31.6 s 40.8 s 1.29x
Test pattern 31.5 s 46.5 s 1.48x
Phone capture upscaled to 4K60 21.2 s 31.2 s 1.47x

HLG colour error (dE against an independent BT.2100 reference, lower is better):

Clip rc4 chain rc5 chain
Android phone capture 1.40 to 2.01 0.11 to 0.12
iPhone 14 Pro, Dolby Vision 8.4 1.20 0.12
Test pattern 9.1 to 9.9 0.08 to 0.09

Testing

  • 186 unit tests and Ruff pass locally and in CI (Python 3.11 and 3.13). The release build passes on Windows, Linux and macOS.
  • rc5 on NVENC: HDR10, two phone HLG clips, and six variants of missing or container-only colour tags.
  • rc5 on VA-API: all 14 candidate file types (8 supported, 6 not), lossless and undecodable audio, HDR10 static metadata retention, and rotated SDR and HLG compared upright by picture.
  • From source at rc4 (audio code unchanged since): audio and video sync across eight audio codecs, and the audio rule on the CPU encoder path.
  • Rounded tables, from source: a real NVENC encode in a classic Windows console, read back from its screen buffer.
  • Requirements: both read from the binaries of all 24 published releases. 12 of them run on Ubuntu 22.04 and Rocky Linux 9 (none start), and the driver check with a stand-in driver that reports NVENC API 13.0.
  • File names: nine folder, decimal size and output name cases replayed on CI executables on Linux and Windows.
  • Ctrl+C: real key events on CI executables (Linux CPU and GPU, Windows GPU and stitch) and from source (Windows CPU).
  • Installer codec choice: silent installs with and without /CODEC keep the choice across upgrades, and uninstalling leaves nothing behind.
  • Installer: rc1 to rc3 upgrade, both codecs, clean uninstall, and rc3 to rc4 upgrade. The script has not changed since rc3.

Not tested

  • AMF, QSV, VideoToolbox and the macOS executables on real hardware.
  • A long or native 4K60 phone HLG recording.
  • A real NVIDIA driver older than 610.
  • The rc5 installer, and installing from a non-elevated console.

Known issues, not fixed here

  • VA-API overshoots low targets: 26.3 MB for a 20 MB target on a 4-minute 1080p60 video (28.1 MB with v1.2.0). A smaller target does not help (15 MB gave 26.1 MB). H.264 gave 18.6 MB at 20 MB.
  • Portrait videos can be downscaled below 720 pixels wide (406x720, 608x1080). With a rotation tag this happens on the CPU paths, without one on any encoder. Deferred.
  • .ts, .mts, .m2ts, .wmv, .mpg, .mpeg, and VP8, ProRes or FLV1 video are not supported.
  • 8-bit PCM and ADPCM audio fail the encode (also in v1.2.0).
  • ALAC and big-endian PCM are copied, which can slightly exceed small targets.
  • Dolby Vision profile 5 gets wrong colours, and Dolby Vision metadata is not kept.
  • Very short clips with a single keyframe can fail (also in v1.2.0).
  • Only the first audio track is kept, and subtitles are not copied (also in v1.2.0).
  • GTX 900 and 10 series cards get no NVENC (since v1.1.4).
  • Linux executables do not start on distributions with glibc older than 2.38 (since v1.0.0). Not planned for this release.
  • A second existing path, such as a second dropped video, is used as the output and overwritten.
  • A GPU encode that stays wider than the encoder supports fails, with no CPU fallback (tested at 5120 pixels wide).

Before publishing v1.3.0

  • Decide on the audio re-encode rule (rc4).
  • Fix HLG colours and untagged HDR (rc5).
  • Collect feedback on rc5.
  • Mark this PR ready and merge it. The draft release targets main, so publish after merging.

…ching

Segment A copied its audio, which ends on an AAC packet boundary past its
last video frame. The concat demuxer offsets segment B by A's full
duration, leaving a 40-100 ms video gap at the split and video lagging
audio for the second half. Segments are now encoded without audio and the
stitch maps the source audio in one piece, via a shared build_audio_args.
The Linux FFmpeg build links libva/libdrm dynamically. On minimal installs
without them every FFmpeg call failed in the loader and the user saw only
'Failed to extract video info'. compress_video now starts ffprobe once and,
on a loader error, stops with the missing library and install commands.
installer/windows.iss adds a per-user Video-Compression submenu for video
files (20 MB, 50 MB, 100 MB, 1 GB, Custom...). The codec is chosen on a
setup page; silent installs (WinGet) use HEVC unless /CODEC=h264 is given.
--custom asks for the target size on the console. The release workflow
builds the installer on the Windows job.
The concat demuxer places the second segment at the first one's reported
duration, which includes its start offset. That offset follows the first
source frame's duration, so a source that holds its first frame (a screen
recording held it 467 ms) shifted everything after the split by ~450 ms.
The list now gives the first segment's duration as the split time.
FFmpeg 9 lists encoders as 'A....D aac'; the check only matched 'A.....'
and 'A...D.', so audio above 160 kbps was always copied instead of
re-encoded to 128 kbps AAC.
Explorer ignored SystemFileAssociations\video on a machine where VLC owns
.mp4, so the submenu never appeared. Each extension now points at one
shared submenu key through ExtendedSubCommandsKey.
HEVC on a hardware encoder now stays 10-bit (p010, Main 10) with the
source's BT.2020 and PQ/HLG tags; before, downscaled encodes dropped to
8-bit while still tagged HDR. H.264 and CPU encodes tone-map HDR to
BT.709 SDR with zscale and tonemap after scaling. The build now requires
zscale and tonemap from ffmpeg-minimal-builds.
An 8-bit HDR source now stays 8-bit (Main) with its HDR tags instead of
being widened to 10-bit.
rc1 and rc2 also registered .wmv, .ts, .mts, .m2ts, .mpg and .mpeg, which the
bundled FFmpeg cannot read. Installing over them removes those entries.
The README lists the supported types and the unsupported inputs.
The installer/ directory made setuptools discover two top-level packages, so
pip install -e . failed, in CI and for installs from source.
Audio is copied unless it is lossless, or is above 160 kbps and would take
more than 10% of the target. When it is re-encoded, the video budget reserves
128 kbps instead of the source bitrate.

- Audio without a reported bitrate (MKV, WebM) is measured from its packets,
  so FLAC no longer overshoots the target.
- Audio FFmpeg cannot decode (ALAC, MP2) is copied instead of failing.
Adds an HDR & Color tab: what the three terms mean, what the app does with
each combination, why tone mapping stays on the CPU, and rc4 benchmarks.

Also fixes two page bugs: table cells ignored their color classes, and the
tab bar overflowed on narrow screens.
- HLG: zscale's default agamma=1 applies the system gamma per channel. With
  agamma=0 a phone HLG clip goes from dE 1.4-2.0 to 0.12 against a BT.2100
  reference. 4K60 tone mapping takes 1.4-1.5x as long. PQ keeps the default,
  which is already correct there.
- Sources without primaries or matrix tags failed with 'no path between
  colorspaces'. BT.2020 is assumed for them, and only for them.
ffprobe's stream entry can show the container's tags while the frames have
none, and zscale only sees the frames'. Such files still failed to convert.
The transfer is now filled in the same way as primaries and matrix.
Safe boxes are turned off, because rich otherwise draws rounded boxes square in legacy Windows consoles, such as the one the right-click menu opens.
The bundled FFmpeg needs NVIDIA driver 610 for NVENC, and the Linux executables need glibc 2.38.
NVENC needs driver 610 since v1.1.4. Re-measure the dataflow and HDR benchmarks on release executables, match the BPP calculator to the app and correct the VA-API overshoot advice.
The CPU path returned a failure, so the exit code was 1. A cancelled CPU
encode or GPU stitch also left an unplayable partial file.
Since v1.1.6-pre an existing file or folder named like a size was taken as a
path, so a run could use the wrong size or overwrite the input video. Folder
names and names without an extension are now rejected.

@SimpNick6703 SimpNick6703 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #16 — overall the changes are clean, well-tested, and all CI/build checks pass. Left 6 inline comments covering two edge-case bugs (Ctrl+C at the --custom prompt and single-quote escaping in the concat list) plus a few minor improvements (early-exit ordering before audio/HDR probes, _tonemap_args type narrowing, preserving codec choice on silent installer upgrades, and updating the README test table).

Comment thread videocompress/core.py Resolved
Comment thread videocompress/hwpipeline.py Resolved
Comment thread installer/windows.iss Resolved
Comment thread videocompress/cli.py Resolved
Comment thread videocompress/encode.py Resolved
Comment thread README.md Resolved
@SimpNick6703
SimpNick6703 marked this pull request as ready for review November 23, 2026 06:16
@SimpNick6703
SimpNick6703 merged commit c6c3a81 into main Nov 23, 2026
3 checks passed
@SimpNick6703
SimpNick6703 deleted the feat/hdr branch November 23, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant