J
J
Johnem2020-07-18 15:17:30
Python
Johnem, 2020-07-18 15:17:30

Error when using ffmpeg via subprocess in python?

Hello, in this code:

import os
import subprocess

file = "Имя файла"
os.chdir("Путь до файла")
subprocess.call("ffmpeg -loop 1 -i {}.jpg -i {}.mp3 -c:v libx264 -c:a aac -movflags +faststart -shortest {}.mp4".format(file), shell=True)

This error occurs:
subprocess.call("ffmpeg -loop 1 -i {}.jpg -i {}.mp3 -c:v libx264 -c:a aac -movflags +faststart -shortest {}.mp4".format(a ), shell=True)
IndexError: Replacement index 1 out of range for positional args tuple

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-07-18
@Johnem

For each {} in format there must be a value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question