tl;dr: how to use a bash ffmpeg command in python
So I'm trying to take one JPEG image and an audio file as input and generate a video file of the same duration as the audio file (by stretching the still image for the whole duration).
So, I found these: https://superuser.com/questions/1041816/combine-one-image-one-audio-file-to-make-one-video-using-ffmpeg
So, I now have the code for the merging:
ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4
Then I want to use that in python but unable to figure out how to port this to ffmpeg-python or ffpy.
I found this: Combining an audio file with video file in python
So, I tried the same thing as him:
cmd = 'ffmpeg -loop 1 -i image.jpg -i message.mp3 -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4'
subprocess.check_output(cmd, shell=True)
subprocess.call(cmd, shell=True)
But I got "returned non-zero exit status 1"
. So what did I do wrong?