Opened 4 years ago
Last modified 4 years ago
#8724 new enhancement
chromakey does not observe existing transparency
Reported by: | Gavin | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avfilter |
Version: | git-master | Keywords: | chromakey, alpha |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
The chromakey filter does not observe the existing alpha transparency in the source AVFrame when generating the output.
How to reproduce:
% ffmpeg -i video.mxf -i green_screen4.png -filter_complex "[1:v]chromakey=color=0x00ff00:similarity=0.24:blend=0.01[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mp4 ffmpeg version git-2020-06-08-d29aaf1 (Windows nightly automated build)
I have created a test image (attached):
- There is a transparent circle in each of the 4 corners of the image
- There is a semi-transparent pink circle in the middle of the image.
Compare the input image to the output image and note the differences.
Attachments (2)
Change History (8)
by , 4 years ago
Attachment: | green_screen4.png added |
---|
follow-up: 2 comment:1 by , 4 years ago
And why it should? Use two chromakeys and blend filter with or mode for alpha plane.
comment:2 by , 4 years ago
Replying to richardpl:
And why it should? Use two chromakeys and blend filter with or mode for alpha plane.
I'm not experienced with chroma key, so I'll turn that around and ask why it shouldn't respect alpha transparency? That is not meant to be a witty retort.
Can you please elaborate on the solution you propose? I don't understand.
comment:3 by , 4 years ago
Priority: | normal → wish |
---|---|
Type: | defect → enhancement |
comment:4 by , 4 years ago
I believe I have the necessary changes to make this work. I'll submit in the next few hours using the correct channels.
comment:5 by , 4 years ago
Here is a workaround using blend on the alpha channel
(using "gray" as the background and your chromkey arguments)
ffmpeg -f lavfi -i color=c=gray:s=640x400 -i green_screen4.png -filter_complex "[1:v]extractplanes=a[origa];[1:v]chromakey=color=0x00ff00:similarity=0.24:blend=0.01,format=gbrap,split[ckout1][ckout2];[ckout1]extractplanes=a[cka];[origa][cka]blend=all_mode=darken,format=gbrap[blend];[ckout2][blend]mergeplanes=0x00010210:gbrap[merge]" -map [merge] merge.png
by , 4 years ago
Attachment: | 0001-avfilter-vf_chromakey-The-chromakey-filter-preserves.patch added |
---|
Proposed patch
comment:6 by , 4 years ago
I have submitted a patch to the devel mailing list for review. Patch is now attached to ticket.
Green screen test clip with semi-transparency