No bug report, more a feature request: Since the AMD driver was so bad with VAAPI deinterlacing, @wm4 implemented an auto copyback feature when --deinterlacing is triggered with --hwdec=vaapi.
Would it be possible to do the same for nvdec? @philipl implemented a cuda filter for ffmpeg, but afaik you need to build ffmpeg with full cuda build environment and under a proprietary license. Current situation is that deinterlacing fails when triggering --deinterlacing with --hwdec=nvdec.
Should be possible.
Don't know if it works, but if nvdec-copy works, there's no reason why it wouldn't.
Uh, it seems it doesn't try further after it doesn't find yadif_cuda?
[lavfi] filter 'yadif_cuda' not found or failed to allocate
[deint] Creating filter 'yadif_cuda' failed.
[deint] creating deinterlacer failed
[autoconvert] HW-downloading from cuda
Disabling filter userdeint because it has failed.
Normal yadif works with nvdec-copy.
Note that yadif_cuda doesn't require the cuda sdk and licensing problems anymore. You just need clang installed now and ffmpeg will use that instead.
Does it work now?
Yep, thanks for implementing!
@philipl That's good to know. Does ffmpeg's build config adapt automatically when clang is available? At least it doesn't work by just installing clang together with ffmpeg from the Arch repository. I'm not sure if maintainers would add clang as a hard dependency for ffmpeg just for this case. :(
It's a build time dependency - there's no runtime component. So if you have clang around at build time, it should work automatically if you're already building with --enable-cuda.
I can confirm that it works that way with clang as just a build dependency, very cool. I've always preferred yadif over d3d11va/vaapi implementations, so having it on the GPU is great.
Arch PKGBUILD contains --enable-gpl --enable-version3 and adding --enable-cuda worked without additional verbosity. Is this an indicator that it's still GPL3 compliant? I haven't found that information on the ffmpeg or CUDA licensing FAQ.
It is compliant - that's why the clang work was a big deal - it removed the cuda sdk dependency.
Great, then I'm going to propose enabling it for the Arch repo build.
Report to Arch:
https://bugs.archlinux.org/task/65521
@shinchiro Would it be possible to compile also the Windows builds that way?
Sorry to horn in, here. But I was recently testing different deinterlacing options, and found that several didn't work. Maybe someone could confirm, deny or correct me on these? As reported, yadif_cuda doesn't work, but also these:
Windows 10, RTX 2060

hwdec=cuda-copy
vd-lavc-o=deint=adaptive
gpu-api=opengl
hwdec=cuda
vd-lavc-o=deint=adaptive
And when using the variations of --d3d11vpp (mode=
I can provide logs, if required.
CUDA deinterlacing works for me. No idea if gpu-context=win is always automatically picked in this case.
I can confirm your findings that I could never spot noteable differences with the different d3d11vpp deinterlacers either (apart from some not working).
It won't work at all, for me. What parameters are you using? And are you using shinchiro's latest build?
Oh, disregard. It won't work in a profile. It has to run at launch. Will that be the same with --vf=yadif_cuda ?
No, it can be toggled by pressing d during playback by default.
Great! I look forward to testing it if @shinchiro can roll it in to his builds.
Is the old cuda full-stream decoder obsolete now (as far as the FFmpeg ecosystem goes)? This post processing it provides, like deinterlacing, seems to be fairly popular. Having Yadif is nice, but are the nvidia provided algorithms somehow available?
It's effectively obsolete, although we haven't declared it as such because there are a couple of edge cases.
I just thought I'd post screenshots for different deinterlacers, and alternate frames. In motion, the native cuda deinterlacer I think looks the best.
--vf=yadif --hwdec=d3d11va-copy


--vf=bwdif --hwdec=d3d11va-copy


--d3d11vpp --hwdec=d3d11va-copy


--vd-lavc-o=deint=adaptive --hwdec=cuda-copy


Does a --d3d11vpp option really exist?
Does a --d3d11vpp option really exist?
It appears to be, but none of the variations seem to work. While choosing between bob and adaptive for cuda give you very different results. Is it possible that --d3d11vpp is just using the inverse telecine on the Nvidia GPU?
Thankfully getting clang installed is relatively easy. Next build should yadif_cuda enabled.
@shinchiro
Thankfully getting clang installed is relatively easy. Next build should yadif_cuda enabled.
It works without issues, thank you!
It won't work for me with my RTX 2060
[ 0.224][i][vd] Using hardware decoding (nvdec-copy).
[ 0.224][v][vd] Decoder format: 720x576 [64:45] nv12 auto/auto/auto/limited/auto CL=mpeg2/4/h264
[ 0.224][v][vf] [in] 720x576 [64:45] nv12 bt.601/bt.601-625/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[ 0.224][v][vf] [userdeint] 720x576 [64:45] nv12 bt.601/bt.601-625/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[ 0.224][v][vf] [userdeint] (disabled)
[ 0.224][v][vf] [lavfi-yadif_cuda] 720x576 [64:45] nv12 bt.601/bt.601-625/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[ 0.224][d][ffmpeg] mpv_src_default_in: w:720 h:576 pixfmt:nv12 tb:1/1000000 fr:25/1 sar:64/45
[ 0.225][d][ffmpeg] auto_scaler_0: w:iw h:ih flags:'bilinear' interl:0
[ 0.225][d][ffmpeg] filter: auto-inserting filter 'auto_scaler_0' between the filter 'mpv_src_default_in' and the filter 'filter'
[ 0.225][e][ffmpeg] Impossible to convert between the formats supported by the filter 'mpv_src_default_in' and the filter 'auto_scaler_0'
[ 0.225][f][lavfi] failed to configure the filter graph
[ 0.225][e][vf] Disabling filter lavfi-yadif_cuda.00 because it has failed.
This is because you're using copy-back, while the cuda filter requires a hardware format.
I tried that, and hwdec was not enabled. I assumed it was because it didn't support MPEG2, but I appear to not be able to make nvdec work with anything... hmmm.... This is a separate issue...
gpu-api=opengl
hwdec=nvdec
vf=yadif_cuda
You are using vo=gpu? You have to.
You are using vo=gpu? You have to.
Yes, I just made a new issue report
--deinterlace?
Most helpful comment
Thankfully getting clang installed is relatively easy. Next build should yadif_cuda enabled.