Skip to content

Add Player > External Monitor > Preview Window (HDR)#1831

Merged
ddennedy merged 43 commits into
masterfrom
qml-videowidget
May 24, 2026
Merged

Add Player > External Monitor > Preview Window (HDR)#1831
ddennedy merged 43 commits into
masterfrom
qml-videowidget

Conversation

@ddennedy
Copy link
Copy Markdown
Member

@ddennedy ddennedy commented May 14, 2026

  • Replaces custom GPU shaders/integrations with Qt Quick Multimedia's VideoOutput with a custom QVideoSink based on MLT.
  • That makes external monitor with system display work again plus more.
  • Adds Preview Window (HDR) to External Monitor sub-menu. As a QQuickView (window) separate from the widgets-based MainWindow, Quick can support HDR.
    • This window is not only useful for HDR. Some might like it over the other system display options because fullscreen is optional but also filter overlays are still in the main window.
    • HDR is working for me on macOS and Windows but not yet Linux.
    • Keyboard shortcut Ctrl+` opens or raises it if already open (convenient for single screen).
  • Move the External Monitor sub-menu to the Player main menu so it is more convenient.
  • Adds Dynamic range to the Add Custom Video Mode dialog: SDR, HLG HDR, or PQ HDR. Automatic video mode also adapts to HDR.
  • HDR editing requires:
    • Native 10-bit CPU or Linear 10-bit GPU/CPU processing modes, and
    • filters tagged with #gpu or #10bit.
  • You cannot switch between different HDR systems (HLG vs. PQ) within the same app session. You can freely switch between SDR and a single HDR, however. There is nothing in place to enforce this, but the video is visually obvious when you need to restart.
  • Export automatically encodes HDR per the video mode assuming you stick with the default 10-bit preset or choose another compatible one.
  • Added an Export > Codec > HDR... button to set PQ HDR metadata, which only works for the libx265 and libsvtav1 codecs. A post-processing step to inject metadata for hardware encoders is pending, e.g.
ffmpeg -i output_temp.mp4 -c copy -metadata:s:v:0 master_display="G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" -max_cll "1000,400" output_final.mp4
  • Adds Settings > Display Method > Vulkan for Linux and removes the non-functional "Software (Mesa)" option.
  • Special note for Linux/BSD build: the default media backend for Qt now is FFmpeg. If you are building your own FFmpeg, then it will likely be incompatible with Qt's. Likewise, if you are installing binary Qt from upstream (qt.io), then your build of MLT might be using a different version of FFmpeg than the version included with Qt for its media backend. Due to these complications, and the fact that Shotcut does not need a fully operational Qt Multimedia backend on Linux (it uses MLT) there is now a MinimalMediaBackend library build target. You can opt into it with cmake configure option -DBUILD_MINIMAL_MEDIA_BACKEND=ON. Shotcut needs Qt Multimedia on Linux/BSD now (previously it did not) because it must be able to make a custom, MLT-based QVideoSink to feed the QML Quick Multimedia-based video component. After building, you need to manually install it like:
    cp -p build/MinimalMediaBackend/libminimalmediaplugin.so ~/Qt/6.10.3/gcc_64/plugins/multimedia/

ddennedy added 28 commits May 10, 2026 21:07
It already defaults to Metal on macOS, and Vulkan is required for HDR on
Linux. But FYI, Vulkan still needs to be explicitly requested with env
var QSG_RHI_BACKEND.
and remove the Softare option (doesn't work)
- It was inconveniently deep in that menu.
- Added keyboard shortcut to open/raise it to Ctrl+`.
- Rename it "Preview Window (HDR)" to clarify it is not only for HDR but can provide HDR.
@ddennedy ddennedy changed the title Qml videowidget Add Player > External Monitor > Preview Window (HDR) May 16, 2026
@ddennedy ddennedy marked this pull request as ready for review May 17, 2026 00:03
@ddennedy ddennedy requested a review from Copilot May 17, 2026 00:04
@ddennedy ddennedy added this to the 26.6 milestone May 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the custom GPU-backed preview rendering path with Qt Multimedia VideoOutput/QVideoSink, adds an HDR-capable external preview window, and extends video mode/export settings for HDR transfer metadata.

Changes:

  • Adds HDR preview window UI, frame delivery through QVideoFrame, HDR gain handling, and platform/build support for Qt Multimedia.
  • Adds dynamic range selection/display for custom video modes and timeline properties.
  • Adds HDR export metadata UI/injection and updates packaging/build scripts for newer Qt and multimedia/QML dependencies.

Reviewed changes

Copilot reviewed 45 out of 46 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
src/widgets/timelinepropertieswidget.ui Adds dynamic range display row.
src/widgets/timelinepropertieswidget.cpp Populates dynamic range from MLT transfer characteristics.
src/widgets/openglvideowidget.h Removes OpenGL preview widget declaration.
src/widgets/openglvideowidget.cpp Removes OpenGL shader preview implementation.
src/widgets/metalvideowidget.h Removes Metal preview widget declaration.
src/widgets/metalvideowidget.mm Removes Metal preview implementation.
src/widgets/d3dvideowidget.h Removes D3D preview widget declaration.
src/widgets/d3dvideowidget.cpp Removes D3D preview implementation.
src/videowidget.h Adds Qt Multimedia sink/frame APIs and HDR transfer signal.
src/videowidget.cpp Implements frame-to-QVideoFrame conversion, HDR color metadata, and sink delivery.
src/util.h Declares AVX2 CPU feature helper.
src/util.cpp Implements AVX2 detection.
src/settings.h Adds HDR preview/settings accessors.
src/settings.cpp Persists HDR preview geometry and HDR display/tone mapping settings.
src/qml/views/HdrPreview.qml Adds HDR preview window UI and controls.
src/qml/views/hdr_gain.frag Adds shader for HDR gain adjustment.
src/qml/modules/Shotcut/Controls/VuiBase.qml Adds main preview VideoOutput sink.
src/mltcontroller.h Adds transfer-characteristic state accessors.
src/mltcontroller.cpp Loads/detects HDR transfer characteristics from profiles/producers.
src/mainwindow.ui Moves External Monitor menu and adds Vulkan drawing action.
src/mainwindow.h Adds HDR preview window ownership and slot.
src/mainwindow.cpp Adds HDR preview action/window wiring and drawing-method changes.
src/main.cpp Updates Qt media/backend and graphics initialization.
src/macos.mm Adds macOS EDR headroom helpers.
src/macos.h Declares macOS EDR helper APIs.
src/hdrpreviewwindow.h Adds HDR preview window class API.
src/hdrpreviewwindow.cpp Implements HDR preview window playback, HDR gain, and platform handling.
src/docks/encodedock.ui Adds HDR metadata button.
src/docks/encodedock.h Adds HDR metadata state and handlers.
src/docks/encodedock.cpp Injects HDR transfer/mastering metadata into supported encoders.
src/dialogs/customprofiledialog.ui Adds dynamic range selector.
src/dialogs/customprofiledialog.h Adds color-space change slot.
src/dialogs/customprofiledialog.cpp Saves/loads HDR transfer characteristics for custom profiles.
src/CMakeLists.txt Adds HDR preview sources, shader build step, and Qt private dependency.
scripts/build-shotcut.sh Updates Linux/macOS packaging for Qt Multimedia and minimal backend.
scripts/build-shotcut-msys2.sh Updates Windows Qt version and deployed Qt Multimedia/Shapes modules.
MinimalMediaBackend/minimalmediaplugin.json Adds minimal media backend plugin metadata.
MinimalMediaBackend/minimalmediaplugin.cpp Implements minimal Qt Multimedia backend.
MinimalMediaBackend/CMakeLists.txt Adds build target for minimal media backend plugin.
CMakePresets.json Updates Qt version and enables minimal media backend in preset.
CMakeLists.txt Adds minimal backend option/subdirectory and Qt private lookup.
.github/workflows/build-windows.yml Updates Windows CI Qt package version.
.github/workflows/build-sdk-windows.yml Updates SDK Windows CI Qt package version.
.github/workflows/build-linux.yml Restricts package jobs to master branch.
.github/copilot-instructions.md Updates documented Qt version.
Comments suppressed due to low confidence (2)

src/docks/encodedock.cpp:931

  • Using the MaxCLL/MaxFALL values as the gate also suppresses mastering-display metadata when both content-light fields are intentionally left as “Not set”. The dialog still collects mastering primaries and min/max luminance, so SVT-AV1 exports can silently omit mastering-display metadata even though the user configured it.
                if ((m_hdrMaxCll > 0 || m_hdrMaxFall > 0)
                    && MLT.colorTrc() == QLatin1String("smpte2084")) {

src/docks/encodedock.cpp:999

  • Using the MaxCLL/MaxFALL values as the gate also suppresses master_display metadata when both content-light fields are intentionally left as “Not set”. The dialog still collects mastering primaries and min/max luminance, so exports can silently omit mastering-display metadata even though the user configured it.
                // Inject HDR10 mastering metadata for hevc_nvenc when the source is PQ.
                if (vcodec == "hevc_nvenc" && (m_hdrMaxCll > 0 || m_hdrMaxFall > 0)
                    && MLT.colorTrc() == QLatin1String("smpte2084")) {

Comment thread src/CMakeLists.txt
Comment thread src/main.cpp
Comment thread src/main.cpp Outdated
Comment thread src/main.cpp Outdated
Comment thread src/docks/encodedock.cpp
Comment thread src/CMakeLists.txt
Comment thread src/qml/views/HdrPreview.qml
Comment thread src/videowidget.cpp Outdated
Comment thread src/mainwindow.cpp
Comment thread MinimalMediaBackend/CMakeLists.txt
@ddennedy ddennedy merged commit 4962a15 into master May 24, 2026
4 checks passed
@ddennedy ddennedy deleted the qml-videowidget branch May 24, 2026 17:41
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.

2 participants