如何在视频中仅旋转文字,而不旋转视频,使用FFmpeg命令。

huangapple go评论56阅读模式
英文:

how can i rotate text on video only without the video with ffmpeg commands

问题

我想要只旋转视频上的文本
这是我的代码

-i '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/tmp/.video/1687332725.289482_IMG_0136.MOV' -filter_complex 'crop=1181.25:2100.0:1089.375:0.0, drawtext=
                  text=Abdullah Muhammad
                  :fontsize=30
                  :x=300
                  :y=600
                  :box=1
                  :boxborderw=20
                  :boxcolor=Gold
                  ' -preset ultrafast -y '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/Library/Caches/1687332725.289482_IMG_0136_1689171861232.mp4';

我尝试过的是

-i '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/tmp/.video/1687332725.289482_IMG_0136.MOV' -filter_complex 'crop=1181.25:2100.0:1089.375:0.0, drawtext=
                  text=Abdullah Muhammad
                  :fontsize=30
                  :x=300
                  :y=600
                  :box=1
                  :boxborderw=20
            :boxcolor=Gold
            ,rotate=PI/6
                  ' -preset ultrafast -y '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/Library/Caches/1687332725.289482_IMG_0136_1689171861232.mp4';

期望结果

> 仅旋转文本

实际结果

> 文本和视频都被旋转

英文:

I want to rotate the text only on the video
here is my code

-i '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/tmp/.video/1687332725.289482_IMG_0136.MOV' -filter_complex 'crop=1181.25:2100.0:1089.375:0.0,            drawtext=
              text=Abdullah Muhammad
              :fontsize=30
              :x=300
              :y=600
              :box=1
              :boxborderw=20
              :boxcolor=Gold
              ' -preset ultrafast -y '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/Library/Caches/1687332725.289482_IMG_0136_1689171861232.mp4'

what i have tried

-i '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/tmp/.video/1687332725.289482_IMG_0136.MOV' -filter_complex 'crop=1181.25:2100.0:1089.375:0.0,            drawtext=
              text=Abdullah Muhammad
              :fontsize=30
              :x=300
              :y=600
              :box=1
              :boxborderw=20
        :boxcolor=Gold
        ,rotate=PI/6
              ' -preset ultrafast -y '/Users/me-mac/Library/Developer/CoreSimulator/Devices/F4189FE6-50EA-40B4-AE0F-F19074EE1488/data/Containers/Data/Application/7C214A2B-440B-468F-85F4-AE74CC4EC509/Library/Caches/1687332725.289482_IMG_0136_1689171861232.mp4'

expected result

> Text only to be rotated

actual result

> Text and video are rotated

答案1

得分: 1

ffmpeg -i "input.mp4" -filter_complex "
[0]crop=1000:700:0:0[v];
color=black[c];
[c][v]scale2ref[t][v];
[t]setsar=1,
colorkey=black,
drawtext=text='测试文字':fontsize=30:fontcolor=white:x=300:y=600,
rotate=PI/6:c=black@0[t];
[v][t]overlay=shortest=1
" output.mp4
英文:

draw text on blank video, rotate, then overlay:

ffmpeg -i "input.mp4" -filter_complex "
[0]crop=1000:700:0:0[v];
color=black[c];
[c][v]scale2ref[t][v];
[t]setsar=1,
colorkey=black,
drawtext=text='Test Text':fontsize=30:fontcolor=white:x=300:y=600,
rotate=PI/6:c=black@0[t];
[v][t]overlay=shortest=1
" output.mp4

huangapple
  • 本文由 发表于 2023年7月12日 22:44:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76671817.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定