How can I convert an FFmpeg command line to python code

276 Views Asked by At

I'm trying to combine an image with an audio file and convert them to mp4. I found this command line and I used it. It works perfectly.

ffmpeg -loop 1 -i 01_Prologue.png -i 01_Prologue.wav -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4

I want to use python because I want to combine multiple images with multiple audio files

I used this code to combine the same audio and image files but it gave me a blank video file.

import ffmpeg

input_still = ffmpeg.input("image.jpg")
input_audio = ffmpeg.input("audio.wav")

(
ffmpeg
.concat(input_still, input_audio, v=1, a=1)
.output("output.mp4")
.run(overwrite_output=True)
)

I'm guessing that is because I didn't add the filters to the code, and the problem happened.

but how to do it?

0

There are 0 best solutions below