On Sun, 15 Mar 2020, Ted Park wrote:

I think colorkey filter can still do this. Basically you want the converse of what color keying does right? It should work the same (that is the opposite) way, and you just have to invert the alpha value.

I'm not quite sure what you mean by invert the alpha value. I think you mean invert the color I'm using... ie, if want to KEEP colors very close to e6e65c (I've refined the color since my first post), then the "invert" of that would be 1919A3 (at least according to an "opposite color tool" I found).

So... after some experimenting...

colorkey sort of works if I use the "invert" color and max similarity and blend values:

  colorkey=color=0x1919A3:similarity=1:blend=1

But the yellow box is pretty faint and there's still too much of the video still visible. NOTE: this ONLY works if I use ffplay, not ffmpeg (see below).

try using colorkey or colorhold with higher similarity values first.

colorhold does seem to work, but as Dan Bridges points out...

On Sun, 15 Mar 2020, Dan Bridges wrote:

Note, this filter will only make the discriminated stuff gray, not black
or transparent.  Perhaps someone else will be able to help.

Yes... that's what I see.  If I use this:

  colorhold=color=0xe6e65c:similarity=0.25:blend=0.5

Then the "yellow box" stays yellow and everything else becomes gray scale... like I'm watching a black and white video. But I don't want ANY video... I ONLY want the yellow box floating around the screen.

Now I did find something that works (colorhold + chromakey)

  
colorhold=color=0xe6e65c:similarity=0.25:blend=0.0,chromakey=color=black:similarity=.1

but this ONLY works if I use ffplay, so perhaps I'm not using it correctly.

**IF** I use ffplay, then this does (mostly) what I want:

  ffplay -i test.mkv -vf 
"colorhold=color=0xe6e65c:similarity=0.25:blend=0.0,chromakey=color=black:similarity=.1"

I ONLY see the yellow box (although it's a bit spotty), but pretty much all of the rest of the video is completely black. That's what I want.

BUT, if I use ffmpeg:

  ffmpeg -i test.mkv -vf 
"colorhold=color=0xe6e65c:similarity=0.25:blend=0.0,chromakey=color=black:similarity=.1"
 test-highlight.mkv

Then it behaves as if the chromakey filter isn't used at all. If fact, the above produces the same output (as far as I can tell) as this:

  ffmpeg -i test.mkv -vf "colorhold=color=0xe6e65c:similarity=0.25:blend=0.0" 
test-highlight.mkv

How can I get the same results with ffmpeg that I see with ffplay?

I have similar results using only colorkey with the inverted color. ie, using this (sort of) works:

  ffplay -i test.mkv -vf "colorkey=color=0x1919A3:similarity=1:blend=1"

but this doesn't seem to do anything (at least visibly):

  ffmpeg -i test.mkv -vf "colorkey=color=0x1919A3:similarity=1:blend=1" 
test-highlight.mkv


Here's the complete output for ffmpeg colorhold,chromakey:

$ ffmpeg -i test.mkv -vf 
"colorhold=color=0xe6e65c:similarity=0.25:blend=0.0,chromakey=color=black:similarity=.1"
 test-highlight.mkv
ffmpeg version N-96974-g425b6a9a2c Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-nonfree 
--enable-static --disable-shared --disable-debug --enable-libass 
--enable-libfdk-aac --enable-libfontconfig --enable-libfreetype 
--enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis 
--enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl 
--enable-libbluray --enable-libcdio
  libavutil      56. 42.100 / 56. 42.100
  libavcodec     58. 75.100 / 58. 75.100
  libavformat    58. 41.100 / 58. 41.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:01:27.36, start: 0.000000, bitrate: 2479 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 720x480 [SAR 32:27 
DAR 16:9], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      ENCODER         : Lavc58.54.100 libx264
      DURATION        : 00:01:27.333000000
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      ENCODER         : Lavc58.54.100 ac3
      DURATION        : 00:01:27.356000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (ac3 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
[swscaler @ 0x2447600] No accelerated colorspace conversion found from yuv420p 
to argb.
[libx264 @ 0x21ea280] using SAR=32/27
[libx264 @ 0x21ea280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x21ea280] profile High 4:4:4 Predictive, level 3.0, 4:4:4, 8-bit
[libx264 @ 0x21ea280] 264 - core 157 r2980 34c06d1 - H.264/MPEG-4 AVC codec - 
Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 
fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 
nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 
b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 
keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf 
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'test-highlight.mkv':
  Metadata:
    encoder         : Lavf58.41.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 720x480 
[SAR 32:27 DAR 16:9], q=-1--1, 30 fps, 1k tbn, 30 tbc (default)
    Metadata:
      DURATION        : 00:01:27.333000000
      encoder         : Lavc58.75.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, 
stereo, fltp (default)
    Metadata:
      DURATION        : 00:01:27.356000000
      encoder         : Lavc58.75.100 libvorbis
frame= 2620 fps= 45 q=-1.0 Lsize= 6972kB time=00:01:27.35 bitrate= 653.9kbits/s speed= 1.5x video:5839kB audio:1076kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.828422%
[libx264 @ 0x21ea280] frame I:11    Avg QP:20.07  size: 12820
[libx264 @ 0x21ea280] frame P:665   Avg QP:23.54  size:  6011
[libx264 @ 0x21ea280] frame B:1944  Avg QP:28.26  size:   946
[libx264 @ 0x21ea280] consecutive B-frames:  0.6%  1.1%  0.6% 97.7%
[libx264 @ 0x21ea280] mb I  I16..4:  6.1% 79.0% 14.9%
[libx264 @ 0x21ea280] mb P  I16..4:  1.0%  3.7%  1.3%  P16..4: 15.8% 11.1%  
6.7%  0.0%  0.0%    skip:60.4%
[libx264 @ 0x21ea280] mb B  I16..4:  0.1%  0.4%  0.0%  B16..8: 17.4%  2.3%  
0.4%  direct: 1.0%  skip:78.4%  L0:48.7% L1:43.0% BI: 8.3%
[libx264 @ 0x21ea280] 8x8 transform intra:66.9% inter:68.0%
[libx264 @ 0x21ea280] coded y,u,v intra: 45.1% 0.9% 0.3% inter: 8.8% 0.1% 0.0%
[libx264 @ 0x21ea280] i16 v,h,dc,p: 61% 31%  4%  4%
[libx264 @ 0x21ea280] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 13% 29%  4%  4%  6%  
3%  6%  4%
[libx264 @ 0x21ea280] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 27% 12%  4%  6%  7%  
5%  6%  4%
[libx264 @ 0x21ea280] Weighted P-Frames: Y:0.3% UV:0.2%
[libx264 @ 0x21ea280] ref P L0: 39.3% 13.3% 36.0% 11.3%  0.1%
[libx264 @ 0x21ea280] ref B L0: 68.3% 25.3%  6.4%
[libx264 @ 0x21ea280] ref B L1: 90.3%  9.7%
[libx264 @ 0x21ea280] kb/s:547.63
_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to