2

I am trying to bring transition effect when I am joining the videos. I am getting output video but not getting proper transition effects.

My video length is as below

  • UKKT0069595Min_RmvAdVi_UntilLastSplit_1_4345.mp4 is 6 sec (00:06)
  • UKKT0069595Min_RmvAdVi_UntilLastSplit_2_9469.mp4 is 10 sec (00:10)
  • UKKT0069595Min_RmvAdVi_UntilLastSplit_3_3062 is 17 sec (00:17)
  • UKKT0069595Min_RmvAdVi_UntilLastSplit_4_5085.mp4 is 16 sec (00:16)
  • UKKT0069595Min_RmvAdVi_UntilLastSplit_5_2877.mp4 is 16 sec (00:16)
  • UKKT0069595Min_RmvAdVi_UntilLastSplit_6_6617.mp4 is 26 sec (00:26)
  • UKKT0069595Min_RmvAdVi_UntilLastSplit_7_9170.mp4 is 16 sec (00:16)
  • UKKT0069595Min_1623.mp4 is 1 min 23 sec (01:23)

Here are the new calculated offsets:

  • The first video plays from 0 to 6 seconds.
  • The second video starts at 6 and transitions at 6 - 0.5 = 5.5 seconds.
  • The third video starts at 10 and transitions at 10 +5.5 -1 = 14.5 seconds.
  • The fourth video starts at 17 and transitions at 17 +14.5- 1 = 30.5 seconds.
  • The fifth video starts at 16 and transitions at 16 +30.5- 1 = 45.5 seconds.
  • The sixth video starts at 26 and transitions at 26 +45.5- 1 = 70.5 seconds.
  • The seventh video starts at 16 and transitions at 16 +70.5- 1 = 85.5 seconds.
  • The eighth video starts at 83 and transitions at 83 +85.5- 1 = 167.5 seconds.

And here's the command I'm using:

ffmpeg -i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_1_4345.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_2_9469.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_3_3062.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_4_5085.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_5_2877.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_6_6617.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_7_9170.mp4 \
-i D:/development/copy//UKKT0069595Min_1623.mp4 \
-filter_complex "[0][1]xfade=transition=circleclose:duration=0.5:offset=5.5[V01]; \
[V01][2]xfade=transition=circleopen:duration=0.5:offset=14.5[V02]; \
[V02][3]xfade=transition=diagbl:duration=0.5:offset=30.5[V03]; \
[V03][4]xfade=transition=horzclose:duration=0.5:offset=45.5[V04]; \
[V04][5]xfade=transition=dissolve:duration=0.5:offset=70.5[V05]; \
[V05][6]xfade=transition=pixelize:duration=0.5:offset=85.5[V06]; \
[V06][7]xfade=transition=fadewhite:duration=0.5:offset=167.5,format=yuv420p[video]; \
[0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[A01]; \
[A01][2:a]acrossfade=d=0.5:c1=tri:c2=tri[A02]; \
[A02][3:a]acrossfade=d=0.5:c1=tri:c2=tri[A03]; \
[A03][4:a]acrossfade=d=0.5:c1=tri:c2=tri[A04]; \
[A04][5:a]acrossfade=d=0.5:c1=tri:c2=tri[A05]; \
[A05][6:a]acrossfade=d=0.5:c1=tri:c2=tri[A06]; \
[A06][7:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]" \
-map "[video]" -map "[audio]" -movflags +faststart D:/development/copy/UKKT0069595Min_FinalMergedFile_NotFromAction_2824_7.mp4

What am I doing wrong?

As per comment below below is the revised offset calculation: enter image description here

And the command modified is as below:

ffmpeg -i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_1_4345.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_2_9469.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_3_3062.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_4_5085.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_5_2877.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_6_6617.mp4 \
-i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_7_9170.mp4 \
-i D:/development/copy//UKKT0069595Min_1623.mp4 \
-filter_complex "[0][1]xfade=transition=circleclose:duration=0.5:offset=5.5[V01]; \
[V01][2]xfade=transition=circleopen:duration=0.5:offset=15[V02]; \
[V02][3]xfade=transition=diagbl:duration=0.5:offset=31.5[V03]; \
[V03][4]xfade=transition=horzclose:duration=0.5:offset=47[V04]; \
[V04][5]xfade=transition=dissolve:duration=0.5:offset=72.5[V05]; \
[V05][6]xfade=transition=pixelize:duration=0.5:offset=88[V06]; \
[V06][7]xfade=transition=fadewhite:duration=0.5:offset=170.5,format=yuv420p[video]; \
[0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[A01]; \
[A01][2:a]acrossfade=d=0.5:c1=tri:c2=tri[A02]; \
[A02][3:a]acrossfade=d=0.5:c1=tri:c2=tri[A03]; \
[A03][4:a]acrossfade=d=0.5:c1=tri:c2=tri[A04]; \
[A04][5:a]acrossfade=d=0.5:c1=tri:c2=tri[A05]; \
[A05][6:a]acrossfade=d=0.5:c1=tri:c2=tri[A06]; \
[A06][7:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]" \
-map "[video]" -map "[audio]" -movflags +faststart D:/development/copy/UKKT0069595Min_FinalMergedFile_NotFromAction_2824_7.mp4

Effects are still not working correctly.

3
  • You appear to be forgetting to take into account that the transition overlap will reduce each output by 0.5 secs. You must take this into account when setting the proceeding offsets
    – Sark
    Commented Jun 30 at 18:06
  • I have updated revised command with revised offset and it is still not working. I have updated command in main question. Please advise.
    – D.B.
    Commented Jul 1 at 16:33
  • Have updated answer. Added working, tested command
    – Sark
    Commented yesterday

1 Answer 1

0

Calculate as follows:.

The first column below shows the original duration of the first four inputs.

These accumulate over time, as shown in the second column.

Each transition duration of 0.5 seconds per fade also accumulates over time, as shown in the third column.

When we deduct the accumulated transition duration from the accumulated input times, we determine each offset. As shown in column four.

enter image description here

If we apply this to the first four inputs, we would require just three transitions (there is always one less transition than there are inputs). We can therefore calculate the total output time as follows:

49 - 1.5 = 47.5 secs.

49 = Total accumulated input duration.

1.5 = Total accumulated transitions duration for three transitions.

Edit

The following command applies three transitions to four inputs. Because the audio streams are slightly shorter than their corrosponding video streams, the apad filter is applied.

Tested and working, with audio remaining in sync.

ffmpeg -i a06.mp4 -i b10.mp4 -i c17.mp4 -i d16.mp4 -filter_complex [0][1]xfade=transition=circleclose:duration=0.5:offset=5.5[V1];[V1][2]xfade=transition=circleopen:duration=0.5:offset=15[V2];[V2][3]xfade=transition=diagbl:duration=0.5:offset=31.5,format=yuv420p[VIDEO];[0:a]apad=whole_dur=6[A1];[1:a]apad=whole_dur=10[A2];[2:a]apad=whole_dur=17[A3];[3:a]apad=whole_dur=16[A4];[A1][A2]acrossfade=d=0.5:c1=tri:c2=tri[A01];[A01][A3]acrossfade=d=0.5:c1=tri:c2=tri[A02];[A02][A4]acrossfade=d=0.5:c1=tri:c2=tri[AUDIO] -map [VIDEO] -map [AUDIO] -movflags +faststart out.mp4

5
  • Revised command updated in the above comment. Please review and advise. transition is still not working.
    – D.B.
    Commented Jul 2 at 16:38
  • Even it is not working for 2 videos. trying circleclose transition: ffmpeg -i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_1_4345.mp4 -i D:/development/copy/UKKT0069595Min_RmvAdVi_UntilLastSplit_2_9469.mp4 -filter_complex "[0][1]xfade=transition=circleclose:duration=0.5:offset=5.5,format=yuv420p[video];[0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]" -map "[video]" -map "[audio]" -movflags +faststart D:/development/copy/video_5370_circleclose.mp4
    – D.B.
    Commented Jul 2 at 16:56
  • I have updated advised calculation in the main question with revised command. Effects are still not working. Please advise.
    – D.B.
    Commented 2 days ago
  • I tried your working command. circleclose and circleopen etc. transition is still not working. Is there a way I can share sample video?
    – D.B.
    Commented yesterday
  • @DB It appears from your other post that the code does work, just a bad choice of transition effect for similar clips, and the effect not being easily perceived. Have you tried it with one of the wipe transitions? This would be clearer to see when clips are very similar
    – Sark
    Commented 19 hours ago

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .