gpt4 book ai didi

ffmpeg - 如何覆盖多个旋转的文本和视频

转载 作者:行者123 更新时间:2023-12-04 23:02:56 25 4
gpt4 key购买 nike

我有 ffmpeg 的命令来旋转一个文本并将其覆盖到我的视频中,但是如果我要旋转多个文本怎么办?

ffmpeg -i input1.mp4 -filter_complex \
"color=black:100x100[c]; \
[c][0]scale2ref[ct][mv]; \
[ct]setsar=1, \
drawtext=fontfile=../../public/fonts/Roboto-Regular-webfont.ttf: \
text='Test Text':fontsize=36:fontcolor=white,split[text][alpha]; \
[text][alpha]alphamerge,rotate=30:ow=rotw(30):oh=roth(30):c=black@0[txta]; \
[mv][txta]overlay=x='min(0,-H*sin(30))+100':y='min(0,W*sin(30))+50':shortest=1" \
output_video.mp4

最佳答案

假设您要处理三个文本。

ffmpeg -i input1.mp4 -filter_complex \
"color=black:100x100[c]; \
[c][0]scale2ref[ct][mv]; \
[ct]setsar=1,split=3[t1][t2][t3]; \
[t1]drawtext=fontfile=../../public/fonts/Roboto-Regular-webfont.ttf: \
text='Test Text 1':fontsize=36:fontcolor=white,split[text1][alpha1]; \
[text1][alpha1]alphamerge,rotate=30:ow=rotw(30):oh=roth(30):c=black@0[txta1]; \
[t2]drawtext=fontfile=../../public/fonts/Roboto-Regular-webfont.ttf: \
text='Test Text 2':fontsize=36:fontcolor=white,split[text2][alpha2]; \
[text2][alpha2]alphamerge,rotate=45:ow=rotw(45):oh=roth(45):c=black@0[txta2]; \
[t3]drawtext=fontfile=../../public/fonts/Roboto-Regular-webfont.ttf: \
text='Test Text 3':fontsize=36:fontcolor=white,split[text3][alpha3]; \
[text3][alpha3]alphamerge,rotate=60:ow=rotw(60):oh=roth(60):c=black@0[txta3]; \
[mv][txta1]overlay=x='min(0,-H*sin(30))+100':y='min(0,W*sin(30))+50':shortest=1[mv1]; \
[mv1][txta2]overlay=x='min(0,-H*sin(45))+100':y='min(0,W*sin(45))+50':shortest=1[mv2]; \
[mv2][txta3]overlay=x='min(0,-H*sin(60))+100':y='min(0,W*sin(60))+50':shortest=1" \
output_video.mp4

您可能必须调整覆盖坐标以避免重叠。

关于ffmpeg - 如何覆盖多个旋转的文本和视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47218280/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com