Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-02T21:39:24.417Z
Answers.Text: 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.
Answers.UserDisplayName: Hashim Aziz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-10T19:53:59.733Z
Answers.Text: @HashimAziz  Do you really input everything correct it should look like that [screenshot](https://imgur.com/ZUEQMcF), sorry for the inconvenient UI
Answers.UserDisplayName: Roman Ogoreltsev
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-16T18:05:08.277Z
Answers.Text: @RomanOgoreltsev I have tried and find that your website is very helpful. Thanks a lot!
Answers.UserDisplayName: blackr1234
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-11T13:37:29.563Z
Answers.Text: @RomanOgoreltsev thank you for this. It helps and worked for me. I couldn't even get ChatGPT to get it a working xfade code.
Answers.UserDisplayName: Panama Jack
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-25T07:56:02.423Z
Answers.LastActivityDate: 2021-02-25T07:56:02.423Z
Answers.UserDisplayName: Roman Ogoreltsev
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-06T06:11:36.307Z
Answers.Text: Have you submitted this to ffmpeg-devel for integration?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-06T08:27:27.453Z
Answers.Text: Official patch will be coming soon :)
Answers.UserDisplayName: fisch2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-24T12:09:56.807Z
Answers.Text: @fisch2 Any updates?
Answers.UserDisplayName: Hashim Aziz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T15:19:29.390Z
Answers.Text: Note, ffmpeg-concat requires Python.
Answers.UserDisplayName: abe1432181
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-02-11T05:48:02.667Z
Answers.Text: I installed Python on my Mac, but still it raise many error when installing `ffmpeg-concat`
Answers.UserDisplayName: János
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-05T22:31:31.283Z
Answers.LastActivityDate: 2018-04-04T22:46:42.327Z
Answers.LastEditDate: 2018-04-04T22:46:42.327Z
Answers.UserDisplayName: fisch2
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-01T05:44:17.110Z
Answers.Text: 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?
Answers.UserDisplayName: kraftydevil
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-29T13:04:47.677Z
Answers.Text: 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
Answers.UserDisplayName: Rajesh M
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-29T11:49:16.280Z
Answers.Text: Why would you overlay the first video over a black screen? It looks like waste of resources as it does nothing.
Answers.UserDisplayName: Alexander
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2016-01-25T11:42:54.127Z
Answers.LastActivityDate: 2020-10-28T04:09:06.540Z
Answers.LastEditDate: 2020-10-28T04:09:06.540Z
Answers.UserDisplayName: Gyan
Body: <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>
  
Tags: <ffmpeg>
Title: Concat two video files with fade effect using FFmpeg
UserDisplayName: mlibre
ThreadText: # 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**: @username_2  Do you really input everything correct it should look like that [screenshot](https://imgur.com/ZUEQMcF), sorry for the inconvenient UI  
  > **username_3**: @username_1 I have tried and find that your website is very helpful. Thanks a lot!  
  > **username_4**: @username_1 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](https://github.com/transitive-bullshit/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](https://github.com/transitive-bullshit/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](https://gl-transitions.com/) 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`  
  
  ---
  
  