[FFmpeg-trac] #3317(undetermined:new): Drawtext+Alphamerge results in incorrect alpha value

FFmpeg trac at avcodec.org
Sat Jan 18 13:24:47 CET 2014


#3317: Drawtext+Alphamerge results in incorrect alpha value
-------------------------------------+-------------------------------------
             Reporter:  jnvsor       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3317>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list