[FFmpeg-devel] [PATCH] lavfi: Add VAAPI deinterlacer
Mark Thompson
sw at jkqxz.net
Sun Jan 8 21:31:53 EET 2017
On 08/01/17 19:12, Mark Thompson wrote:
> (cherry picked from commit ade370a4d7eab1866b6023c91c135d27c77ca465)
> ---
> One minor fixup for allocation due to differences in the lavfis, otherwise unchanged.
>
> configure | 1 +
> libavfilter/Makefile | 1 +
> libavfilter/allfilters.c | 1 +
> libavfilter/version.h | 2 +-
> libavfilter/vf_deinterlace_vaapi.c | 630 +++++++++++++++++++++++++++++++++++++
> 5 files changed, 634 insertions(+), 1 deletion(-)
To offer a bit more information about this:
It is adding a filter to dinterlace video on the GPU using VAAPI. This works on both Intel (i965) and AMD (mesa) (and might work on Nvidia with mesa, not tested). On Intel it is able to run a bit faster than the encoder, so you can deinterlace 1080i video to 1080p at >200fps with plausible quality on any normal desktop or mobile chip.
The available modes are dependent on the driver being used. By default it picks the highest numbered mode available (a proxy for "most advanced", though this isn't necessarily the best choice), or you can use the "mode" option to set a particular deinterlacing mode explicitly ("bob", "weave", "motion_adaptive", "motion_compensated").
It's easiest to use when taking input from a VAAPI hwaccel and sending to a VAAPI encoder:
./ffmpeg_g -y -vaapi_device /dev/dri/renderD128 -threads 1 -hwaccel vaapi -hwaccel_output_format vaapi -i in.mp4 -an -vf 'format=nv12|vaapi,hwupload,deinterlace_vaapi' -c:v h264_vaapi out.mp4
But you can also make use of hwupload/hwdownload to use it in other cases:
./ffmpeg_g -y -vaapi_device /dev/dri/renderD128 -threads 1 -i in.mp4 -an -vf 'format=nv12,hwupload,deinterlace_vaapi' -c:v h264_vaapi out.mp4
./ffmpeg_g -y -vaapi_device /dev/dri/renderD129 -threads 1 -hwaccel vaapi -hwaccel_output_format vaapi -i in.mp4 -an -vf 'format=nv12|vaapi,hwupload,deinterlace_vaapi,hwdownload,format=nv12' -c:v libx264 out.mp4
./ffmpeg_g -y -vaapi_device /dev/dri/renderD128 -threads 1 -i in.mp4 -an -vf 'format=nv12,hwupload,deinterlace_vaapi,hwdownload,format=nv12' -c:v libx264 out.mp4
Thanks,
- Mark
More information about the ffmpeg-devel
mailing list