gpt4 book ai didi

python - 如何将 ffmpeg 命令转换为 ffmpeg python 代码

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

如何将以下代码转换为 python?我这样做有问题..

ffmpeg -i /Users/Aaron/lol.mp4 -filter:v "crop=9/16*ih:ih" /Users/Aaron/Desktop/lol1.mp4
非常感谢您的帮助!

最佳答案

您可以进行子流程调用:

import subprocess

def crop(input_file, output_file, x, y):
subprocess.call(['ffmpeg', '-i', input_file, '-filter:v', 'crop={}/{}*iw:ih'.format(x, y), output_file])

crop('/Users/Aaron/lol.mp4', '/Users/Aaron/Desktop/lol1.mp4', 9, 16)

关于python - 如何将 ffmpeg 命令转换为 ffmpeg python 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69409769/

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