Skip to content

Fix: Correct hardware filter chaining for QSV/VAAPI to prevent video corruption#25

Open
DeRoelO wants to merge 2 commits into
Unmanic:masterfrom
DeRoelO:master
Open

Fix: Correct hardware filter chaining for QSV/VAAPI to prevent video corruption#25
DeRoelO wants to merge 2 commits into
Unmanic:masterfrom
DeRoelO:master

Conversation

@DeRoelO

@DeRoelO DeRoelO commented Apr 29, 2026

Copy link
Copy Markdown

This PR addresses a known issue with Intel Hardware Acceleration (QSV and VAAPI) where transcoded files could result in a corrupted "half-green" screen.

Key changes:

Filter Chain Optimization: Removed redundant hwupload calls in the "Pure HW path". Previously, hwupload was being applied to frames already residing in hardware memory (QSV/VAAPI surfaces), which caused buffer corruption and visual artifacts.
QSV Stability Tweak: Reduced the default look_ahead_depth from 100 to 40. A depth of 100 was causing instability and crashes on several Intel iGPU generations (especially mobile and older desktop models) when processing high-resolution content.
Redundant VPP Removal: Simplified the hardware filter chain to avoid unnecessary VPP (Video Post-Processing) steps when the format is already correct, further reducing the chance of driver-related glitches.
These changes significantly improve the reliability of hardware-accelerated transcoding for Intel users without sacrificing quality.

@Josh5 Josh5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please fix these up and rebase of the master branch.

Comment thread lib/encoders/qsv.py
plugins.qsv.py

Written by: Josh.5 <jsunnex@gmail.com>
Written by: DeRoelO (Based on Josh.5)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure you are the author of this file 🤔. I thought I was?

Comment thread lib/encoders/vaapi.py
plugins.vaapi.py

Written by: Josh.5 <jsunnex@gmail.com>
Written by: DeRoelO (Based on Josh.5)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are not the author of this file.

Comment thread plugin.py
plugins.plugin.py

Written by: Josh.5 <jsunnex@gmail.com>
Written by: DeRoelO (Based on Josh.5)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are not the author of this file.

Comment thread info.json
@@ -1,5 +1,5 @@
{
"author": "Josh.5",
"author": "DeRoelO",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are not taking ownership as the maintainer of the official plugin. You are still more than welcome to fork and maintain your own version and change the author this info.json file there, but I would recommend keeping the original author cited in it also.

Comment thread lib/encoders/vaapi.py
# Pure HW path - frames stay in VAAPI memory
chain = [f"format={target_fmt}|vaapi", "hwupload"]
# We skip hwupload as it would attempt to upload hardware frames as software frames.
chain = ["format=vaapi"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change drops the target pixel-format handling from the pure hardware path. I don't think it is correct to drop the target_fmt constraint entirely. From what I know, doing this means that 10-bit/HDR-oriented paths that depend on p010le vs nv12 can stop being enforced.

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