[FFmpeg-user] Need more info on blend filter

compname at verizon.net compname at verizon.net
Sun Jun 21 19:10:10 CEST 2015


I'm trying to overlay a spectrum analyzer display over another 
video.  I want the analyzer bars to show on top of the other video, 
but nothing else.  The spectrum analyzer video consists of blue bars 
on a black background.  I tried the following filter:

[base_vid][spec]blend=all_expr='if(gte(B,10),B,A)':all_opacity=1,format=rgba[out]

This "almost" works in that I get the desired effect more or less, 
but there are some pixels on the edge of the blue bars that turn 
different colors.  I think this is because the blend filter makes its 
comparison on each channel individually.  The pixel format for 
base_vid & spec is rgba.  In order to have a successful transparent 
overlay, I need to have the comparison on B made on the luminance 
only.  So I changed the pix_fmt for base_vid & spec to yuvj444p, 
which then lets me compare c0 (luminance) in the blend filter.  The 
problem is I need to have the luminance of B control the other 3 
channels as well.  I don't see how this can be done given what's 
given in the ffmpeg-filters manual.  What I really need is something like this:

[base_vid][spec]blend=c0_expr='if(gte(B,10),B,A)':c1_expr='if(gte(c0,10),B,A)':c2_expr='if(gte(c0,10),B,A:c3_expr=(gte(c0,10),B,A:all_opacity=1,format=yuvj444p[out]

(yes I did try it - doesn't work :(  )

Is there a way to do this, or is blend limited to intra-channel 
operations?  Thanks. 



More information about the ffmpeg-user mailing list