[FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration

highgod0401 highgod0401 at gmail.com
Sat Oct 10 07:23:41 CEST 2015

From: Timo Rothenpieler
Date: 2015-10-09 16:41
To: FFmpeg development discussions and patches
CC: highgod0401
Subject: Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration
> Using this sample: https://btbn.de/files/chromakey_sample.mp4
> ffmpeg -f lavfi -i color=c=black:s=1280x720 -i chromakey_sample.mp4 -an
> -c:v libx264 -preset veryfast -crf 18 -shortest -filter_complex
> "[1:v]chromakey=0x70de77:0.1:0.2:0:1[ckout];[0:v][ckout]overlay[out]"
> -map "[out]" -y output.mkv
> The last parameter to the chromakey filter enables opencl acceleration.
> Hi,
> Could you please send the patch as attachments? I merge the code, but some compile errors occur.
> Thanks
> Best regards

You can pull from my github, the patches are in the chromakey branch:


If you want just the chromakey patch itself:



I downloaded and merged the patch again, but the error still exists as follow:

$ git am opencl_chromakey.patch
Applying: avfilter/vf_chromakey: Add OpenCL acceleration
fatal: corrupt patch at line 380
Patch failed at 0001 avfilter/vf_chromakey: Add OpenCL acceleration
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

I check the code,
These codes are in the patch of corrupt patch at line 380.
@@ -192,6 +368,7 @@ AVFilter ff_vf_chromakey = {
     .priv_size     = sizeof(ChromakeyContext),
     .priv_class    = &chromakey_class,
     .init          = initialize_chromakey,
+    .uninit        = uninitialize_chromakey,
     .query_formats = query_formats,
     .inputs        = chromakey_inputs,
     .outputs       = chromakey_outputs,
the following codes are the latest ffmpeg master branch codes.
AVFilter ff_vf_chromakey = {
    .name          = "chromakey",
    .description   = NULL_IF_CONFIG_SMALL("Turns a certain color into transparency. Operates on YUV colors."),
    .priv_size     = sizeof(ChromakeyContext),
    .priv_class    = &chromakey_class,
    .init          = initialize_chromakey,
    .query_formats = query_formats,
    .inputs        = chromakey_inputs,
    .outputs       = chromakey_outputs,
I think this is the reason why the conflict occurs.

Could you please fix it?


Best regards

More information about the ffmpeg-devel mailing list