Ffmpeg command to combine audio and images

I am trying to achieve something that, as I thought before, should be a simple task. Is there a ffmpeg command that can do the following:

convert audio.wav file to video. Add 100 images (img% d.png) to the video so that they "automatically" stretch to fill the entire length of the video.

I do not want to set the frame rate manually, because it either makes the sound forward, or is not enough.

I also do not want the following to happen, which happened when I used "loop_input":

A short video of created images was created, which was quickly reproduced and then repeated throughout the duration of the sound.

Please let me know the team.

Currently, I have tried the following, but this does not give me the desired results:

It does, but the video goes fast and the sound is not full:

ffmpeg -i img%d.png -i audio.wav -acodec copy output.mpg

This makes a short video that repeats for the full duration of the sound:

ffmpeg -loop_input -shortest -i img%d.png -i audio.wav -acodec copy output.mpg

It works almost, but "-r 4" makes the video slow and the sound goes forward. If I use "-r 5", the sound goes slowly and the video goes forward:

ffmpeg -r 4 -i img%d.png -i audio.wav -acodec copy -r 30 output.mpg
+5
source share
1 answer

measure the time of the audio track, and then use -t $ audio_duration.

this argument, along with "-loop 1", will stop mp4 at the time that matches the sound.

you can also try a 2-wire technique, including -vcodec libx264, as it works well when creating mp4.

and think about the following settings for your inputs and recording speed:

    -b:v 200k -bt 50k
0

All Articles