Skip to content

ffmpeg 8 breaks VA-API / AMD Hardware decode #1591

@FrostKiwi

Description

@FrostKiwi

Describe the bug

Memories uses hwupload when doing hardware code of videos with VA-API / AMD Hardware Decoding.

I saw go-vod erroring out with this error:

2025/12/21 15:25:47 dxftlbuafug0-max: /run/current-system/sw/bin/ffmpeg -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -noautorotate -i /tank1/nextcloud/data/Vlad/files/InstantUpload/Camera/PXL_20251221_033358795.mp4 -copyts -fflags +genpts -vf "format=nv12|vaapi,hwupload,scale_vaapi=force_original_aspect_ratio=decrease:format=nv12,hwdownload,format=nv12,transpose=1,format=nv12|vaapi,hwupload" -map "0:v:0" "-c:v" h264_vaapi -global_quality 24 -map "0:a:0?" "-c:a" aac -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/dxftlbuafug0-740623306/max-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2025/12/21 15:25:47 ffmpeg-error: [hwupload @ 0x560218e84e00] A hardware device reference is required to upload frames to.
2025/12/21 15:25:47 ffmpeg-error: [AVFilterGraph @ 0x560218ef8380] Error initializing filters
2025/12/21 15:25:47 ffmpeg-error: Error opening output file -.
2025/12/21 15:25:47 ffmpeg-error: Error opening output files: Invalid argument
2025/12/21 15:25:47 dxftlbuafug0-max: ffmpeg exited with status: 234

I traced A hardware device reference is required to upload frames to. to a ffmpeg 7 vs ffmpeg 8 change, specifically https://patchwork.ffmpeg.org/project/ffmpeg/patch/[email protected]/ I think.

Making Memories use FFMPEG 7 worked for me, but updating to FFMPEG 8 causes this error.

Reading FFMPEG docs https://trac.ffmpeg.org/wiki/Hardware/VAAPI#Encoding it seems that the device for heupload has to be specified as well and somehow worked implicitly up until now or something. So I think there is some work to be done on memories' side to follow https://trac.ffmpeg.org/wiki/Hardware/VAAPI#DeviceSelection and the -init_hw_device thingy.

In https://memories.gallery/hw-transcoding/#bare-metal memories describes a test sudo -u www-data ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i 'sample.mp4' -vcodec h264_vaapi output-www-data.mp4, but that test does not reflect how memories actually uses ffmpeg. It's more akin to:
sudo -u nextcloud ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i 'sample.mp4' -vf "format=nv12|vaapi,hwupload,scale_vaapi=w=854:h=854:format=nv12" -vcodec h264_vaapi EncodeTest/output-www-data2.mp4 which works with ffmpeg 7, but does not work with ffmpeg 8.

By changing the test to sudo -u nextcloud ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i 'sample.mp4' -init_hw_device vaapi=foo:/dev/dri/renderD128 -filter_hw_device foo -vf "format=nv12|vaapi,hwupload,scale_vaapi=w=854:h=854:format=nv12" -vcodec h264_vaapi EncodeTest/output-www-data2.mp4 it works again with ffmpeg 8.

Steps To Reproduce

Run memories, open a video with AMD Hardware decode with FFMPEG 8.

Platform

- OS: NixOS 25.11 (Linux 6.6.119 x86_64)
- Browser: Any
- Memories Version: 7.7.0
- Nextcloud Version: 32.0.3.2
- PHP Version: 8.4.15

Screenshots

No response

Additional context

  • Any errors in the JS console?
  • Any errors in the Nextcloud server logs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions