1

enter image description hereI am using the command below to drawtext with rotation. This works but when set fontcolor=black It becomes transparent color. I am not understanding the reason.

ffmpeg -i input.mp4 -filter_complex "color=black:100x100[c];[c][0]scale2ref[ct][mv];[ct]setsar=1,drawtext=fontfile='font.ttf':text='Test Text':fontsize=36:line_spacing=3:box=1:boxcolor=red@1:fontcolor=black,split[text][alpha];[text][alpha]alphamerge,rotate=45:ow=rotw(45):oh=roth(45):c=black@0[txta];[mv][txta]overlay=x='min(0,-H*sin(45))+100':y='min(0,W*sin(45))+50':shortest=1" output_video.mp4
1

The method in my old answer was a workaround due to a limitation in drawtext filter at the time of writing. It's easier now.

You're getting transparent text because the textcolor is used to set both the color as well as its opacity intensity, and since black represents 0, the text disappears.

Anyway, it's simpler after ffmpeg 3.1

ffmpeg -i input.mp4 -filter_complex "color=black@0:100x100,format=yuva420p[c];[c][0]scale2ref[ct][mv];[ct]setsar=1,drawtext=fontfile='font.ttf':text='Test Text':fontsize=36:line_spacing=3:box=1:boxcolor=red@1:fontcolor=black,rotate=45:ow=rotw(45):oh=roth(45):c=black@0[txta];[mv][txta]overlay=x='min(0,-H*sin(45))+100':y='min(0,W*sin(45))+50':shortest=1" output_video.mp4

  • thanks a lot for your help. – Tulshi Das Jan 12 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.