<p>I've created a little site recently for generating the FFmpeg CLI command to create xfade + acrossfade command for several videos. Check it out maybe you find it useful.</p>
<p><a href="https://romander.github.io/ffmpeg-script-generator/" rel="noreferrer">https://romander.github.io/ffmpeg-script-generator/</a></p>
<p>Add also you can check source code or contribute</p>
<p><a href="https://github.com/Romander/ffmpeg-script-generator" rel="noreferrer">https://github.com/Romander/ffmpeg-script-generator</a></p>

CC BY-SA 4.0
2021-03-02T21:39:24.417Z
This is a great idea but it doesn't seem to produce working code. [This](https://pastebin.com/sMhzCKL1) is what I get after entering two inputs.
Hashim Aziz
CC BY-SA 4.0
2021-03-10T19:53:59.733Z
@HashimAziz  Do you really input everything correct it should look like that [screenshot](https://imgur.com/ZUEQMcF), sorry for the inconvenient UI
Roman Ogoreltsev
CC BY-SA 4.0
2022-06-16T18:05:08.277Z
@RomanOgoreltsev I have tried and find that your website is very helpful. Thanks a lot!
blackr1234
CC BY-SA 4.0
2024-06-11T13:37:29.563Z
@RomanOgoreltsev thank you for this. It helps and worked for me. I couldn't even get ChatGPT to get it a working xfade code.
Panama Jack
CC BY-SA 4.0
2021-02-25T07:56:02.423Z
2021-02-25T07:56:02.423Z
Roman Ogoreltsev
<p><a href="https://github.com/transitive-bullshit/ffmpeg-concat" rel="nofollow noreferrer">ffmpeg-concat</a> is the easiest way to accomplish what you want and allows you to use a bunch of sexy OpenGL transitions, with the default being crossfade.</p>

<p><a href="https://github.com/transitive-bullshit/ffmpeg-gl-transition" rel="nofollow noreferrer">ffmpeg-gl-transition</a> is a custom ffmpeg filter which allows you to use GLSL to smoothly transition between two video streams. This filter is significantly easier to use and customize than the alternatives listed here.</p>

<p>This filter supports a large <a href="https://gl-transitions.com/" rel="nofollow noreferrer">list</a> of transition types, with the default being crossfade.</p>

<pre><code>./ffmpeg -i 0.mp4 -i 1.mp4 -filter_complex "gltransition=duration=4:offset=1.5" out.mp4
</code></pre>

CC BY-SA 3.0
2017-12-06T06:11:36.307Z
Have you submitted this to ffmpeg-devel for integration?
Gyan
CC BY-SA 3.0
2017-12-06T08:27:27.453Z
Official patch will be coming soon :)
fisch2
CC BY-SA 4.0
2021-08-24T12:09:56.807Z
@fisch2 Any updates?
Hashim Aziz
CC BY-SA 4.0
2022-01-24T15:19:29.390Z
Note, ffmpeg-concat requires Python.
abe1432181
CC BY-SA 4.0
2023-02-11T05:48:02.667Z
I installed Python on my Mac, but still it raise many error when installing `ffmpeg-concat`
János
CC BY-SA 3.0
2017-12-05T22:31:31.283Z
2018-04-04T22:46:42.327Z
2018-04-04T22:46:42.327Z
fisch2
<p>Your present command specifies stream copy. Since you wish to alter the video frames during the transition, that won't work.</p>
<p>It can be done if you know the duration of the two videos and the duration of fade. Also, for the command below, the resolutions of the two videos should be the same.</p>
<pre><code>ffmpeg -i first.ogg -i second.ogg \
-filter_complex \
&quot;color=black:WxH:d=Video1Length+Video2Length-FadeDuration[base]; \
 [0:v]setpts=PTS-STARTPTS[v0]; \
 [1:v]format=yuva420p,fade=in:st=0:d=FadeDuration:alpha=1, \
      setpts=PTS-STARTPTS+((Video1Length-FadeDuration)/TB)[v1]; \
 [base][v0]overlay[tmp]; \
 [tmp][v1]overlay,format=yuv420p[fv]; \
 [0:a][1:a]acrossfade=d=FadeDuration[fa]&quot; \
-map [fv] -map [fa] \
output.ogg
</code></pre>
<p>Replace:</p>
<p><code>WxH</code> with the resolution of the videos i.e. <code>640x360</code></p>
<p>And:</p>
<p><code>Video1Length</code>, <code>Video2Length</code>, and <code>FadeDuration</code> with their value in seconds.</p>

CC BY-SA 4.0
2019-03-01T05:44:17.110Z
what about adding a third, fourth, or nth video? I conceptualize this by running the above on first.ogg and second.ogg, producing output1.ogg. Then I would run the script with output1.ogg and third.ogg to get output2.ogg (and so on up to output[n-1].ogg). Is this efficient or is there a better way to do it all at once?
kraftydevil
CC BY-SA 4.0
2019-11-29T13:04:47.677Z
I tried to use "ffmpeg-gl-transition" and followed all instruction for my mac. The transition works. However, I loose audio on my second video for some reason. My command was: fmpeg -i input1.mp4 -i input2.mp4 -filter_complex "gltransition=duration=4:source=ZoomInCircles.glsl" -y out.mp4
Rajesh M
CC BY-SA 4.0
2020-10-29T11:49:16.280Z
Why would you overlay the first video over a black screen? It looks like waste of resources as it does nothing.
Alexander
CC BY-SA 4.0
2016-01-25T11:42:54.127Z
2020-10-28T04:09:06.540Z
2020-10-28T04:09:06.540Z
Gyan
<p>Is there any way to concat two video files with a fading effect using FFmpeg?</p>
<p>Something like this:</p>
<pre><code>ffmpeg -f concat -i input.txt -c copy &quot;--with:fade:out-in&quot; output.ogg
</code></pre>

<ffmpeg>
Concat two video files with fade effect using FFmpeg
mlibre
# Concat two video files with fade effect using FFmpeg

(Asked by: username_0 on 2016-01-25)

Is there any way to concat two video files with a fading effect using FFmpeg?
Something like this:
ffmpeg -f concat -i input.txt -c copy "--with:fade:out-in" output.ogg

**Tags:** ffmpeg


---

## 3 answers

### Answer by username_6 on 2016-01-25. Score: 11 | Accepted answer

Your present command specifies stream copy. Since you wish to alter the video frames during the transition, that won't work.
It can be done if you know the duration of the two videos and the duration of fade. Also, for the command below, the resolutions of the two videos should be the same.
ffmpeg -i first.ogg -i second.ogg \
-filter_complex \
"color=black:WxH:d=Video1Length+Video2Length-FadeDuration[base]; \
 [0:v]setpts=PTS-STARTPTS[v0]; \
 [1:v]format=yuva420p,fade=in:st=0:d=FadeDuration:alpha=1, \
      setpts=PTS-STARTPTS+((Video1Length-FadeDuration)/TB)[v1]; \
 [base][v0]overlay[tmp]; \
 [tmp][v1]overlay,format=yuv420p[fv]; \
 [0:a][1:a]acrossfade=d=FadeDuration[fa]" \
-map [fv] -map [fa] \
output.ogg

Replace:
WxH with the resolution of the videos i.e. 640x360
And:
Video1Length, Video2Length, and FadeDuration with their value in seconds.

> **Comments:**
> **username_9**: what about adding a third, fourth, or nth video? I conceptualize this by running the above on first.ogg and second.ogg, producing output1.ogg. Then I would run the script with output1.ogg and third.ogg to get output2.ogg (and so on up to output[n-1].ogg). Is this efficient or is there a better way to do it all at once?  
> **username_10**: I tried to use "ffmpeg-gl-transition" and followed all instruction for my mac. The transition works. However, I loose audio on my second video for some reason. My command was: fmpeg -i input1.mp4 -i input2.mp4 -filter_complex "gltransition=duration=4:source=ZoomInCircles.glsl" -y out.mp4  
> **username_11**: Why would you overlay the first video over a black screen? It looks like waste of resources as it does nothing.  

---

### Answer by username_1 on 2021-02-25. Score: 6

I've created a little site recently for generating the FFmpeg CLI command to create xfade + acrossfade command for several videos. Check it out maybe you find it useful.

<https://romander.github.io/ffmpeg-script-generator/>

Add also you can check source code or contribute

<https://github.com/Romander/ffmpeg-script-generator>

> **Comments:**
> **username_2**: This is a great idea but it doesn't seem to produce working code. [This](https://pastebin.com/sMhzCKL1) is what I get after entering two inputs.  
> **username_1**: @HashimAziz  Do you really input everything correct it should look like that [screenshot](https://imgur.com/ZUEQMcF), sorry for the inconvenient UI  
> **username_3**: @RomanOgoreltsev I have tried and find that your website is very helpful. Thanks a lot!  
> **username_4**: @RomanOgoreltsev thank you for this. It helps and worked for me. I couldn't even get ChatGPT to get it a working xfade code.  

---

### Answer by username_5 on 2017-12-05. Score: 5

ffmpeg-concat is the easiest way to accomplish what you want and allows you to use a bunch of sexy OpenGL transitions, with the default being crossfade.
ffmpeg-gl-transition is a custom ffmpeg filter which allows you to use GLSL to smoothly transition between two video streams. This filter is significantly easier to use and customize than the alternatives listed here.
This filter supports a large list of transition types, with the default being crossfade.
./ffmpeg -i 0.mp4 -i 1.mp4 -filter_complex "gltransition=duration=4:offset=1.5" out.mp4

> **Comments:**
> **username_6**: Have you submitted this to ffmpeg-devel for integration?  
> **username_5**: Official patch will be coming soon :)  
> **username_2**: @username_5 Any updates?  
> **username_7**: Note, ffmpeg-concat requires Python.  
> **username_8**: I installed Python on my Mac, but still it raise many error when installing `ffmpeg-concat`  

---

