[FFmpeg-user] Remove everything but a single color (range)

Hans Carlson forbyta at gmx.com
Tue Mar 17 01:37:47 EET 2020


Can anyone explain to me why this displays only the yellow bar with 
everything else black:

   ffplay -f lavfi -i 'smptehdbars=duration=5' -vf "colorhold=color=0xbcc906:similarity=0.25,chromakey=color=black:similarity=.2"

but this displays all bars in gray scale except the yellow bar which is 
in color:

   ffmpeg -f lavfi -i 'smptehdbars=duration=5' -vf "colorhold=color=0xbcc906:similarity=0.25,chromakey=color=black:similarity=.2" TEST-smptehdbars-yellow-only.mkv

What I want is ONLY the yellow bar and everything else black, as in the 
ffplay command.  How can I get the same thing with ffmpeg?

Or an alternate way to accomplish the same thing.

Complete output for ffmpeg command:

$ ffmpeg -f lavfi -i 'smptehdbars=duration=5' -vf "colorhold=color=0xbcc906:similarity=0.25,chromakey=color=black:similarity=.2" TEST-smptehdbars-yellow-only.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, lavfi, from 'smptehdbars=duration=5':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x40bcd80] No accelerated colorspace conversion found from yuv420p to argb.
[libx264 @ 0x40b0140] using SAR=1/1
[libx264 @ 0x40b0140] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x40b0140] profile High 4:4:4 Predictive, level 1.3, 4:4:4, 8-bit
[libx264 @ 0x40b0140] 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-smptehdbars-yellow-only.mkv':
   Metadata:
     encoder         : Lavf58.41.100
     Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 1k tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.75.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[Parsed_smptehdbars_0 @ 0x406e580] EOF timestamp not reliableitrate=   2.8kbits/s speed=3.97x 
frame=  125 fps=0.0 q=-1.0 Lsize=       5kB time=00:00:04.88 bitrate=   7.9kbits/s speed=7.58x 
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 44.947208%
[libx264 @ 0x40b0140] frame I:1     Avg QP:13.57  size:   552
[libx264 @ 0x40b0140] frame P:31    Avg QP: 9.23  size:    23
[libx264 @ 0x40b0140] frame B:93    Avg QP:12.67  size:    15
[libx264 @ 0x40b0140] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
[libx264 @ 0x40b0140] mb I  I16..4: 73.7% 15.3% 11.0%
[libx264 @ 0x40b0140] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
[libx264 @ 0x40b0140] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0: 0.0% L1:100.0% BI: 0.0%
[libx264 @ 0x40b0140] 8x8 transform intra:15.3%
[libx264 @ 0x40b0140] coded y,u,v intra: 5.6% 0.3% 0.2% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x40b0140] i16 v,h,dc,p: 76% 20%  4%  0%
[libx264 @ 0x40b0140] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25%  7% 68%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x40b0140] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 55% 24% 20%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x40b0140] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x40b0140] kb/s:4.20


More information about the ffmpeg-user mailing list