At 6/21/2015 11:11 AM, you wrote:
On 6/21/15, [email protected] <[email protected]> wrote:
> 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.
Currently it is limited to intra-channel operations, maybe i will add
feature to access other channels data too.
OK thanks. I was beginning to suspect such, & started pursuing a
different path: using the geq filter on the spectrum overlay video to
selectively change the alpha on the black pixels to 0.
geq=r='r(X,Y)':g='g(X,Y)':b='b(X,Y)':a='if(gte(r(X,Y)+g(X,Y)+b(X,Y),50),255,0)'
Then I can replace the blend filter with a simple overlay.
Some simplification may be possible by using YUV space instead of
RGB, but I wasn't sure if the alpha channel was available for the YUV
formats. I'll probably experiment more later, but in the meantime
this seems to work great.
_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user