[FFmpeg-user] Alpha not working as expected with geq filter

Robert Krüger krueger at lesspain.de
Tue May 21 18:45:20 CEST 2013


Hi,

I am trying to generate a test file using nullsrc and the geq filter
to obtain an image that has color and alpha channel values defined by
equations like so:

ffmpeg -f lavfi -i nullsrc=s=256x256:d=0.01 -vf
scale,geq='r=255*(X/W):g=255*(Y/H):b=255*((X/W)*(Y/H)):alpha_expr=255*(1-Y/H)'
-pix_fmt rgba -y ~/tmp/generated-sd-alpha.png

The generated png file does not contain any transparent pixels as far
as I can see and I wonder what I have done wrong. I found trac ticket
#2520 which has some similarities but it is marked as fixed. Full
command line and output:

ffmpeg -f lavfi -i nullsrc=s=256x256:d=0.01 -vf
scale,geq='r=255*(X/W):g=255*(Y/H):b=255*((X/W)*(Y/H)):alpha_expr=255*(1-Y/H)'
-pix_fmt rgba -y ~/tmp/generated-sd-alpha.png
ffmpeg version N-53322-gb1bbd71 Copyright (c) 2000-2013 the FFmpeg developers
  built on May 21 2013 16:18:03 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --enable-gpl
  libavutil      52. 33.100 / 52. 33.100
  libavcodec     55. 10.101 / 55. 10.101
  libavformat    55.  7.100 / 55.  7.100
  libavdevice    55.  1.100 / 55.  1.100
  libavfilter     3. 68.101 /  3. 68.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'nullsrc=s=256x256:d=0.01':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 256x256
[SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x7f9438803e00] No accelerated colorspace conversion found
from yuv420p to gbrp.
[swscaler @ 0x7f943881dc00] No accelerated colorspace conversion found
from yuv420p to gbrp.
[swscaler @ 0x7f9438825400] No accelerated colorspace conversion found
from yuv420p to gbrp.
Output #0, image2, to '/Users/krueger/tmp/generated-sd-alpha.png':
  Metadata:
    encoder         : Lavf55.7.100
    Stream #0:0: Video: png, rgba, 256x256 [SAR 1:1 DAR 1:1], q=2-31,
200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:145kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.014851%

Thanks in advance,

Robert


More information about the ffmpeg-user mailing list