如何用2张图片创建图像ffmpeg

时间:2017-12-16 16:43:56

标签: image ffmpeg subprocess pipe

我希望使用2张或更多图像创建一个独特的图像,将我作为参数传递的所有图像组合在一起。我开始用2个参数证明。

    firstpart = "/home/princebot/mazos/cartas/CannonCard.png"
    secondpart = "/home/princebot/mazos/cartas/FireballCard.png"
    a = subprocess.Popen(["ffmpeg","-i", firstpart, "-filter_complex", "scale=120:-1,","-i", secondpart, "-filter_complex","hstack" , "output.png"],stdout=subprocess.PIPE)
    a.communicate()[0].decode('utf-8')

并且合并图像不会创建。

1 个答案:

答案 0 :(得分:0)

假设您的比例将输出适当的大小:

a = subprocess.Popen(["ffmpeg","-i", firstpart, "-i", secondpart, "-filter_complex","[0]scale=120:-1[s];[s][1]hstack" , "output.png"],stdout=subprocess.PIPE)