How to create video cross fade filter?

Questions involving a Windows version of FFmpeg.
Post Reply
nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

How to create video cross fade filter?

Post by nickola »

Hello everybody,

I made some parts of video from pictures and searched in ffmpeg possibility cross-fade from 1 video to 2 video like across-fade filter. It is absent.
I tried use blend complex v-filter but got full oops from examples at blend filter.
I think I don't understand something.
To get vcross-fade i used:
blend=all_expr='A/T+(B/3)*T'
during 3 sec, but it made nothing, as an example:
blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'

How do it work?
How can I make video cross fade from two streams (video)?
Thank you for your time, Nikolai.

nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

Re: How to create video cross fade filter?

Post by nickola »

Ok, silent... of cause not using fade video filter plus overlay?
I tried = I cann't get alpha fade! from black fade work wonderful

ffmpeg -loop 1 -i locomotive.jpg -lavfi fade=in:0:75 -r 25 -t 10 out.mp4 do from black fade to picture Locomotive duration 3 sec on 10 sec part.

ffmpeg -loop 1 -i locomotive.jpg -lavfi fade=in:0:75:alpha=1 -t 10 out.mp4 do from black to pictures as first second went.
or
ffmpeg -loop 1 -i locomotive.jpg -lavfi fade=out:0:75:alpha=1 -t 3 out.mp4 must to do alpha fade on out 3 sec
and
ffmpeg -i mail.mp4 -i out.mp4 -lavfi overlay=repeatlast=0:alpha=premultiplied -r 25 cross_fade_main.mp4
where locomotive faded to main duration first 3 sec.

But I cann't get result... How can I get needed result?

richardpl
Posts: 62
Joined: Sat Aug 01, 2015 6:35 pm

Re: How to create video cross fade filter?

Post by richardpl »

Use xfade filter instead.

nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

Re: How to create video cross fade filter?

Post by nickola »

richardpl wrote:
Tue Feb 04, 2020 5:45 pm
Use xfade filter instead.
D:\Other\ffmpeg\421\bin>ffmpeg -h filter=xfade
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Unknown filter 'xfade'.

richardpl
Posts: 62
Joined: Sat Aug 01, 2015 6:35 pm

Re: How to create video cross fade filter?

Post by richardpl »

Stop using very old ffmpeg versions for once.

nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

Re: How to create video cross fade filter?

Post by nickola »

Oh! I found in documentation on v.4.2.2 (I have v.4.2.1) xfade filter.
Thank's. Tomorrow I'll try...

nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

Re: How to create video cross fade filter?

Post by nickola »

richardpl wrote:
Wed Feb 05, 2020 4:01 pm
Stop using very old ffmpeg versions for once.
Ok! I tried xfade filter with fade and circleclose transition on ffmpeg v4.2.2.
On input i used 1024x576 pix_fmt yuvj420p short video:
1. fade made crossfade duration 3 sec good, but ouput video had pix_fmt yuvj444p and documentation say on default ffmpeg create pix_fmt yuv420p. When i wrote pix_fmt option eq. yuvj420p output was in right.
2. circleclose on end of video was making excellent, but i had needing create 3 sec black video that close in black because xfade didn't work with image2 or nullsrc filters.

And I got a satisfaction on result, thank's very much.

nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

Re: How to create video cross fade filter?

Post by nickola »

richardpl wrote:
Tue Feb 04, 2020 5:45 pm
Use xfade filter instead.
Ok! All pointed transitions work wonderfull, i like distance & smoth* especially.
But wished try custom, and i cann't understand "plane", "A", "B", a*(x,y), b*(x,y), how used its i can create expression for custom transition effect?
Unfortunately example for this is absent.
Who can explain the method of creation custom transition by xfade filter?

richardpl
Posts: 62
Joined: Sat Aug 01, 2015 6:35 pm

Re: How to create video cross fade filter?

Post by richardpl »

It is not trivial, and results are very slow to process.

What kind of transition you actually seek?

nickola
Posts: 12
Joined: Thu Jan 16, 2020 2:17 pm

Re: How to create video cross fade filter?

Post by nickola »

richardpl wrote:
Wed Mar 25, 2020 3:40 pm
What kind of transition you actually seek?
for example:
1. Swiping the page right, left, up, down
2. Pop-up star with different number of angles, with possibility of rotation in hours\vs. hours
3. Explosion\break of the first one over the second one with spreading pieces

etc.

Post Reply