<p>I have a set of transparent png images, each image having a coresponding wav audio file (the audio files are of different lengths): 1.png, 1.wav, 2.png, 2.wav, etc...
There is also a 10 seconds looping background video, back.mp4.</p>
<p>The video should be as such:</p>
<ul>
<li>an image fades-in for 2 seconds</li>
<li>the image is displayed while playing the coresponding audio</li>
<li>the image fades-out for 2 seconds</li>
</ul>
<p>... and so on for all the images/audio files.</p>
<p>Finally, all of this should be overlaid on top of back.mp4, which needs to loop until the end.</p>
<p>I need to achieve this with a filter_complex_script file (that is automatically generated), preferrably putting everything in the file (using movie/amovie instead of command line parameters to ffmpeg). It should be done also without having to calculate the lengths of the audio files.</p>
<p>I am struggling with this for days, and having problems with looping the image. Either the fade doesn't show, or the concatenation of the image with the audio gets endless.</p>
<p>Is it even possible to achieve?</p>

CC BY-SA 4.0
2023-12-14T04:29:46.623Z
using filter `fade=out:st=...`. it needs a start position of fading out, so you have to calculate length of audio. and so on for length of png.
Баяр Гончикжапов
CC BY-SA 4.0
2023-12-14T05:09:10.983Z
Details needed: what's the output framerate? Are all audio expected to be at least 4+ seconds long? Are all images the same resolution, will they have to be scaled, altered somehow?
Gyan
<ffmpeg>
ffmpeg multiple png fade in/out, audio and overlay with filter_complex_script
Robert Wallner
# ffmpeg multiple png fade in/out, audio and overlay with filter_complex_script

(Asked by: username_0 on 2023-12-13)

I have a set of transparent png images, each image having a coresponding wav audio file (the audio files are of different lengths): 1.png, 1.wav, 2.png, 2.wav, etc...
There is also a 10 seconds looping background video, back.mp4.

The video should be as such:

* an image fades-in for 2 seconds
* the image is displayed while playing the coresponding audio
* the image fades-out for 2 seconds

... and so on for all the images/audio files.

Finally, all of this should be overlaid on top of back.mp4, which needs to loop until the end.

I need to achieve this with a filter\_complex\_script file (that is automatically generated), preferrably putting everything in the file (using movie/amovie instead of command line parameters to ffmpeg). It should be done also without having to calculate the lengths of the audio files.

I am struggling with this for days, and having problems with looping the image. Either the fade doesn't show, or the concatenation of the image with the audio gets endless.

Is it even possible to achieve?

**Tags:** ffmpeg

> **Comments:**
> **username_1**: using filter `fade=out:st=...`. it needs a start position of fading out, so you have to calculate length of audio. and so on for length of png.  
> **username_2**: Details needed: what's the output framerate? Are all audio expected to be at least 4+ seconds long? Are all images the same resolution, will they have to be scaled, altered somehow?  

---

## 0 answers

