I'm trying to overlay some text emoticons on top of a video using ffmpeg.. This works fine for normal TTF's e.g.
ffmpeg -i video.mp4 -vf drawtext="Arial.ttf: text='YENTL 😎 Bresseleers ': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h-line_h)/2" -codec:a copy output.mp4 -y
I can use the OpenSansEmoji font which gets me closer to what I need..
ffmpeg -i video.mp4 -vf drawtext="OpenSansEmoji.ttf.ttf: text='YENTL 😎 Bresseleers ': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h-line_h)/2" -codec:a copy output.mp4 -y`
However when I try with a TTF file with coloured emoji's like emojione or Noto Color Emoji I get the below error:
[Parsed_drawtext_0 @ 0x7fd643700000] Could not set font size to 24 pixels: invalid module handle
[AVFilterGraph @ 0x7fd643608b80] Error initializing filter 'drawtext' with args 'fontfile=AppleColorEmoji.ttf: text=YENTL 😎 Bresseleers : fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h-line_h)/2'
Error opening filters!`
Any ideas?
For a dirty workaround one can manually adjust the emoji on top of a character like so
ffmpeg -i video.mp4 -i "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/237/smiling-face-with-sunglasses_1f60e.png" -filter_complex "[1:v]scale=24:24,format=argb,colorchannelmixer=aa=0.5[ovrl],[0:v]drawtext=text='YENTL O Bresseleers':fontcolor=white:fontsize=24:x='(w-text_w)/2':y='(h-text_h-line_h)/2'[text],[text][ovrl]overlay=main_w/2-46:main_h/2-20" -codec:a copy output.mp4 -y
and then remove the ,format=argb,colorchannelmixer=aa=0.5
part when the position is correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With