Skip to content

Fix QSV encoder initialization on Intel systems by using VAAPI backend#21

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-hardware-acceleration-synology-nas
Draft

Fix QSV encoder initialization on Intel systems by using VAAPI backend#21
Copilot wants to merge 4 commits intomainfrom
copilot/fix-hardware-acceleration-synology-nas

Conversation

Copy link

Copilot AI commented Dec 22, 2025

Intel QSV encoders on Synology NAS (and other Linux systems) were failing with "Error while opening enc" despite hardware detection passing and /dev/dri devices being mounted. QSV on Linux requires VAAPI as a backend—the code was using standalone initialization which fails on most Intel systems.

Changes

QSV initialization pattern changed:

# Before: standalone initialization (fails on most systems)
init_flags = ["-init_hw_device", "qsv=hw", "-hwaccel", "qsv", ...]

# After: VAAPI-backed initialization (Intel recommended approach)
vaapi_device = hw_info.get("vaapi_device") or "/dev/dri/renderD128"
init_flags = [
    "-init_hw_device", f"vaapi=va:{vaapi_device}",
    "-init_hw_device", "qsv=hw@va",  # Derive QSV from VAAPI
    "-hwaccel", "qsv", ...
]

worker/app/hw_detect.py

  • _check_intel_qsv(): Returns (available, device_path) tuple; initializes VAAPI first then derives QSV
  • detect_hw_accel(): Stores vaapi_device in hw_info when QSV is detected
  • map_codec_to_hw(): Both explicit and fallback paths now use VAAPI-backed QSV init

worker/app/startup_tests.py

  • test_encoder_init(): QSV encoders now receive hw_flags for proper device initialization

README.md

  • Added Synology NAS support section with device mapping examples
  • Added QSV troubleshooting steps

Impact

  • QSV encoders will now initialize correctly on Intel Celeron J3455 and similar systems
  • Encoder tests should show PASS for h264_qsv, hevc_qsv
  • 10-30x encoding speedup vs CPU fallback
Original prompt

This section details on the original issue you should resolve

<issue_title>hardware accelleration on synology nas</issue_title>
<issue_description>Hi, just got the container up and running on a synology ds 1019+ which runs a Intel Celeron J3455, which supports qsv. i have included the following in my compose:

devices:
- /dev/dri/renderD128:/dev/dri/renderD128
- /dev/dri/card0:/dev/dri/card0
- /dev/dri/:/dev/dri/

but i am getting the following in 8mb:

Image

any clue what i might be doing wrong?

thanks</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Dec 22, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 3 commits December 22, 2025 03:34
- QSV on Linux requires VAAPI as backend, not standalone initialization
- Updated _check_intel_qsv() to init VAAPI first, then derive QSV from it
- Changed QSV init from `-init_hw_device qsv=hw` to `-init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device qsv=hw@va`
- Store vaapi_device in hw_info when QSV is detected
- Updated map_codec_to_hw() to use correct QSV initialization in both code paths
- Updated startup_tests.py to pass hw_flags to QSV encoder tests
- Should fix "Error while opening enc" on Synology NAS with Intel Celeron J3455

Co-authored-by: JMS1717 <43321848+JMS1717@users.noreply.github.com>
- Added Synology NAS Support section under Intel Arc / Integrated Graphics
- Included specific docker-compose device mapping example for Synology
- Added troubleshooting steps for QSV on Synology NAS
- Documented that QSV now uses VAAPI backend for proper initialization
- Added encoder test verification steps

Co-authored-by: JMS1717 <43321848+JMS1717@users.noreply.github.com>
- Remove trailing whitespace after comment
- Remove unused error handling block
- Update comment to reflect QSV is now handled separately

Co-authored-by: JMS1717 <43321848+JMS1717@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix hardware acceleration issues on Synology NAS Fix QSV encoder initialization on Intel systems by using VAAPI backend Dec 22, 2025
Copilot AI requested a review from JMS1717 December 22, 2025 03:39
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.

hardware accelleration on synology nas

2 participants