master-of-zen/Av1an

[Q] Hardware accel for decoding

barolo opened this issue · 6 comments

Is it possible to insert something like this into av1an chain?
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i ./input.mkv -vf 'scale_vaapi=w=1280:h=720,hwdownload,format=p010le'
this gives me three times the fps that I get from av1an [with same svt-av1 config]

The solution would be for av1an to add another param like abav1's "--enc-input" which is placed before ffmpeg's -i. For example, with ab1av1 I'm using '--enc-input hwaccel=d3d11va' which transforms into a '-hwaccel d3d11va' ffmpeg param before -i

This probably would be easy enough to implement, and would offload work to the gpu - so a big +1 for this feature request :-)

Edit: I don't know how/if hw decoding scales with a lot of parallel workers...

The thing is, i just want the decoder part, hw encoder would be nice but my current gpus don't have it so...

The thing is, i just want the decoder part, hw encoder would be nice but my current gpus don't have it so...

It would have to be enabled for each possible --chunk-method ...

@gitoss Where should I put it in the case of lsmash? Vaporsynth stuff is totally alien to me.

@gitoss Where should I put it in the case of lsmash? Vaporsynth stuff is totally alien to me.

My guess: To be able to work without split files (i.e. direct lsmash, bestsource or ffms2 mode) the change has to be somewhere the av1an source - I have no idea where, never bothered to learn Python or look at the py files.

Or you could load the video through a bare bones Vapoursynth script, enabling hw decoding in the respective line in the vpy file (sample w/o hw decoding param).

from vapoursynth import core
clip = core.bs.VideoSource(source='video.mkv')
clip.set_output()

@gitoss Where should I put it in the case of lsmash? Vaporsynth stuff is totally alien to me.

My guess: To be able to work without split files (i.e. direct lsmash, bestsource or ffms2 mode) the change has to be somewhere the av1an source - I have no idea where, never bothered to learn Python or look at the py files.

Or you could load the video through a bare bones Vapoursynth script, enabling hw decoding in the respective line in the vpy file (sample w/o hw decoding param).

from vapoursynth import core
clip = core.bs.VideoSource(source='video.mkv')
clip.set_output()

Av1an uses Rust doesn't it? I might be able to do it. We'll see.