summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMohamed Khaled Mohamed <mohamedpower_50@hotmail.com>2022-07-05 17:48:53 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2022-07-10 17:20:15 +0200
commitb1648150b2fdd1e4dba9fc05d08ee6fea13798c9 (patch)
treecf8f45b976d7be7fd8f4efd8780d3f6dc5930387 /doc
parent538cbaf18e1fc7147dcf39474141041df37e0412 (diff)
avfilter: add chromakey_cuda filter
GSoC'22 libavfilter/vf_chromakey_cuda.cu:the CUDA kernel for the filter libavfilter/vf_chromakey_cuda.c: the C side that calls the kernel and gets user input libavfilter/allfilters.c: added the filter to it libavfilter/Makefile: added the filter to it cuda/cuda_runtime.h: added two math CUDA functions that are used in the filter Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/filters.texi43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 603b0ff3f8..40f21fb34c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8599,6 +8599,7 @@ The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
+@anchor{chromakey}
@section chromakey
YUV colorspace color/chroma keying.
@@ -8651,6 +8652,48 @@ ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_compl
@end example
@end itemize
+@section chromakey_cuda
+CUDA accelerated YUV colorspace color/chroma keying.
+
+This filter works like normal chromakey filter but operates on CUDA frames.
+for more details and parameters see @ref{chromakey}.
+
+@subsection Examples
+
+@itemize
+@item
+Make all the green pixels in the input video transparent and use it as an overlay for another video:
+
+@example
+./ffmpeg \
+ -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
+ -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
+ -init_hw_device cuda \
+ -filter_complex \
+ " \
+ [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
+ [1:v]scale_cuda=format=yuv420p[base]; \
+ [base][overlay_video]overlay_cuda" \
+ -an -sn -c:v h264_nvenc -cq 20 output.mp4
+@end example
+
+@item
+Process two software sources, explicitly uploading the frames:
+
+@example
+./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
+ -f lavfi -i color=size=800x600:color=white,format=yuv420p \
+ -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
+ -filter_complex \
+ " \
+ [0]hwupload[under]; \
+ [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
+ [under][over]overlay_cuda" \
+ -c:v hevc_nvenc -cq 18 -preset slow output.mp4
+@end example
+
+@end itemize
+
@section chromanr
Reduce chrominance noise.