Opened 12 years ago
Closed 5 years ago
#3317 closed defect (wontfix)
Drawtext+Alphamerge results in incorrect alpha value
| Reported by: | jnvsor | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avfilter |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
I was trying to create a video of a timer for use in other videos with a transparent background. There doesn't seem to be a transparent video source so I used alphamerge to achieve the same effect.
Unfortunately, drawtext with alphamerge results in a max alpha of 235 not 255.
Running the following 3 commands generates the 3 attatched files. Note that in alpha.png the text has 235 alpha, not 255, and that I can't reproduce without using drawtext directly.
# Drawtext to alphamerge ffmpeg -f lavfi -r 30 -t 10 -i "color=c=#FFFFFF" -f lavfi -r 30 -t 10 -i "color=c=#000000" -filter_complex "[1]drawtext=text="FFmpeg":fontcolor=white:fontsize=150:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf[text];[0][text]alphamerge[out]" -map "[out]" -vframes 1 -c:v png -pix_fmt rgba alpha.png # Saving the drawtext mask on it's own ffmpeg -f lavfi -r 30 -t 10 -i "color=c=#FFFFFF" -f lavfi -r 30 -t 10 -i "color=c=#000000" -filter_complex "[1]drawtext=text="FFmpeg":fontcolor=white:fontsize=150:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf[out]" -map "[out]" -vframes 1 -c:v png -pix_fmt rgba noalpha.png # And applying that mask (No bug here) ffmpeg -f lavfi -r 30 -t 10 -i "color=c=#FFFFFF" -i noalpha.png -filter_complex "[0][1]alphamerge[out]" -map "[out]" -vframes 1 -c:v png -pix_fmt rgba third.png
Attachments (3)
Change History (7)
by , 12 years ago
comment:1 by , 12 years ago
Please provide your failing command line together with the complete, uncut console output to make this a valid ticket.
comment:2 by , 12 years ago
$ ffmpeg -f lavfi -r 30 -t 10 -i "color=c=#FFFFFF" -f lavfi -r 30 -t 10 -i "color=c=#000000" -filter_complex "[1]drawtext=text="FFmpeg":fontcolor=white:fontsize=150:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf[text];[0][text]alphamerge[out]" -map "[out]" -vframes 1 -c:v png -pix_fmt rgba alpha.png
ffmpeg version N-59884-gfd334b9 Copyright (c) 2000-2014 the FFmpeg developers
built on Jan 18 2014 02:17:50 with gcc 4.8 (Debian 4.8.2-12)
configuration: --arch=amd64 --enable-pthreads --enable-libopencv --enable-librtmp --enable-libopenjpeg --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-runtime-cpudetect --enable-libvorbis --enable-zlib --enable-swscale --enable-libcdio --enable-bzlib --enable-libdc1394 --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-libpulse --enable-vdpau --enable-libvpx --enable-gpl --enable-x11grab --enable-libx264 --enable-libfreetype
libavutil 52. 62.100 / 52. 62.100
libavcodec 55. 48.101 / 55. 48.101
libavformat 55. 23.103 / 55. 23.103
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 1.100 / 4. 1.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, lavfi, from 'color=c=#FFFFFF':
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
Input #1, lavfi, from 'color=c=#000000':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
File 'alpha.png' already exists. Overwrite ? [y/N] y
Output #0, image2, to 'alpha.png':
Metadata:
encoder : Lavf55.23.103
Stream #0:0: Video: png, rgba, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 30 tbc (default)
Stream mapping:
Stream #0:0 (rawvideo) -> alphamerge:main
Stream #1:0 (rawvideo) -> drawtext
alphamerge -> Stream #0:0 (png)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.03 bitrate=N/A
video:3kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.641774%
comment:3 by , 10 years ago
| Component: | undetermined → avfilter |
|---|---|
| Reproduced by developer: | set |
| Status: | new → open |
Forcing rgba as format after drawtext filter fixes issue.
comment:4 by , 5 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | open → closed |



Alpha of text is 235 not 255