[00:00]
hello this is Steph and welcome to my
[00:02]
channel again and today I'm going to
[00:04]
show you how to use the complex filters
[00:07]
uh better the filter complex using FM
[00:12]
pack first of all what are the filter
[00:14]
complex
[00:15]
um the filter is complex are the complex
[00:18]
filters filters complex is the options
[00:20]
that you have in a pack is uh that
[00:23]
category of filters that require uh
[00:26]
multiple inputs or multiple outputs
[00:30]
and we saw something in the past for
[00:32]
example the concatenation for example
[00:35]
with the GIF we saw the split so we have
[00:39]
a rough idea about what a complex filter
[00:42]
is and now we're going to see something
[00:45]
a bit better in detail
[00:48]
uh here we have Windows ready behind me
[00:52]
at the moment it's time to get started
[01:03]
okay here we are we have the terminal at
[01:06]
the top uh this is the windows terminal
[01:09]
so I changed from the CMD uh to this
[01:13]
Windows terminal it's super cool because
[01:15]
uh what you can do is also to
[01:18]
select the one that you want so not only
[01:21]
the command prompt that I'll be using
[01:23]
most of the times but the windows
[01:25]
Powershell develop compound prompt for
[01:27]
visual studio
[01:30]
um the
[01:32]
um
[01:33]
WSL windows subsystem for Linux I
[01:36]
install Ubuntu I have something with a
[01:39]
anaconda mini counter actually
[01:42]
um like to switch from one in the other
[01:46]
or having multiple tabs here it is a
[01:49]
super super cool and uh
[01:53]
I suggested if you would like to go on
[01:57]
um coding and using the command line so
[01:59]
here we have two videos
[02:02]
here on the left
[02:05]
where
[02:07]
so videos about Singapore every people
[02:09]
who follow me on Instagram uh I take
[02:12]
advantage to
[02:14]
give the my references about the social
[02:17]
media here
[02:19]
um
[02:20]
so um I've been to Singapore recently
[02:23]
and I would like to make a video about
[02:25]
Singapore I have a couple of videos here
[02:28]
play
[02:31]
Singapore one and this is uh the first
[02:35]
video
[02:38]
Singapore Marina Bay and the marina here
[02:44]
nice place to be and on the other we
[02:49]
have
[02:50]
Singapore
[02:55]
night
[02:57]
It's a Wonderful view accelerated view
[03:00]
of Singapore where the
[03:06]
cool so we would like to make a
[03:08]
Crossfade so it's it is a transition
[03:10]
from a video to another but in a linear
[03:16]
way so we don't want an Abrupt change
[03:18]
from one to the other it's not a
[03:19]
concatenation even if we did a
[03:21]
concatenation
[03:22]
advantage to show you
[03:25]
part about the concatenation here we use
[03:28]
the a filter complex actually but what
[03:30]
we would like to use is a so-called
[03:32]
Crossfade so here we have a
[03:36]
the
[03:37]
um the Crossfade filter there is a
[03:40]
called The X fade so the base code
[03:43]
stayed like this
[03:45]
and
[03:48]
what you would like to use is a F10 pack
[03:51]
minus I and the filter the freight and
[03:55]
the Fellas we want this input so here if
[03:59]
from Peg minus I single
[04:03]
one and then minus I single port two
[04:07]
these are the input files and then we
[04:09]
are immediately using the filter complex
[04:12]
so the filter complex is uh something
[04:15]
that accepts uh
[04:17]
multiple inputs multiple outputs and you
[04:20]
can also apply multiple filters here so
[04:24]
here we have for example the first input
[04:28]
and the second input so here we can put
[04:31]
zero and one like this so the input is
[04:35]
uh put it this way before the name of
[04:38]
the field name of the and
[04:44]
after
[04:46]
the equal sign we got to put the filter
[04:49]
configuration so here we've got to put
[04:51]
the parameter transition
[04:55]
here my transition I want to be a Fades
[04:58]
it's fading from a video to another
[05:01]
I got to set the duration of the fade in
[05:04]
this case it is one second
[05:07]
and also
[05:10]
um we got to put the offset what is the
[05:13]
offset the offset is the
[05:16]
um the time I want the first video to
[05:19]
start fading out so here in this case I
[05:22]
have a video that is more or less 10
[05:24]
seconds long so I can put it in the
[05:26]
middle five seconds
[05:28]
and in the end I can put the name of the
[05:31]
parameters so the name of the parameters
[05:33]
uh the code sorry the collect parameters
[05:37]
leave x264
[05:41]
preset
[05:43]
slow minus CR f
[05:47]
at 15 so not so so a fairly high quality
[05:52]
but not the super high quality in order
[05:54]
to keep this phase
[05:56]
the space contained and
[06:01]
then
[06:03]
we can put the name of the files in this
[06:05]
case we can say Singapore
[06:09]
xfader.np4 and let's see what happens
[06:14]
in this case we have an error what is
[06:16]
the the error here it says the first
[06:19]
input linked main time base do not match
[06:22]
the corresponding second input link X3
[06:25]
so we have the time base so the let's
[06:28]
say the internal clock with which we are
[06:30]
ticking the advancement from one frame
[06:33]
and the other that is uh not set
[06:36]
correctly here this is faster than this
[06:40]
this has nothing to do with the frame
[06:43]
rate is only the advancement in terms of
[06:46]
time stamp that is present within the
[06:48]
file so what it would like to do is uh
[06:50]
to set the time base to the
[06:54]
um
[06:54]
photo audio video time based it usually
[06:57]
is calculated with the frame rate if I'm
[07:00]
not wrong so this is the what I found
[07:02]
out so if you um
[07:04]
correct me but this is a calculated
[07:07]
based
[07:09]
audio and the video time based
[07:13]
and so what we can do is to apply this
[07:17]
before the Crossfade so what can we do
[07:20]
we are still or we can use the previous
[07:23]
command so we have the
[07:26]
Singapore one Singapore two files this
[07:30]
uh still accepts the two inputs so here
[07:34]
let's put a bit of space then later we
[07:36]
are packing everything back
[07:39]
so what shall we do with the first input
[07:41]
with the first input we said that we
[07:43]
want to set the time base in order to
[07:46]
put it to the audio video time based so
[07:49]
set TB
[07:51]
equals to a b t b
[07:54]
so capital letters and then we're going
[07:57]
to put the set PTS
[08:01]
to the B the beginning of the uh
[08:06]
as you can do so start PTS
[08:09]
in this case we need to give an output
[08:13]
name so in this case it can be out
[08:18]
zero
[08:19]
the output file zero and then we got to
[08:23]
put the uh
[08:26]
semicolon the semicolon separates the
[08:29]
different filters so we have a first
[08:33]
um
[08:34]
set TB
[08:36]
and the set BTS then we got this output
[08:41]
there is a
[08:43]
by semicolon to the second output and in
[08:46]
the set sorry the second input file
[08:47]
second input file needs the same thing
[08:50]
so in this case we have the set TV
[08:58]
set PTS
[09:00]
equal to the pts and start BTS
[09:06]
and in this case we're going to call
[09:08]
this out one so we have the output uh so
[09:13]
we got just to sum up
[09:16]
first input that we call the zero file
[09:19]
zero that passes through the set time
[09:23]
base set BTS and it exit as out zero
[09:29]
then we got the second that is called
[09:32]
one it's a right here second one then
[09:36]
it's going it's going through the same
[09:38]
thing so we've got the the set TB set
[09:41]
time base and the set pts and it's
[09:45]
called the out one so we got out zero
[09:48]
and out one after we have the out zero
[09:50]
and the out one we're going to merge
[09:52]
them together in order to obtain a
[09:53]
single output in this case there's a no
[09:57]
need to call the output
[09:59]
um
[10:01]
because
[10:02]
it's like a sink we put the output
[10:06]
unnamed it and here
[10:09]
we got to put the first input and the
[10:14]
first a second in sorry the first output
[10:17]
of the previous
[10:20]
pipe and the output of the second pipe
[10:24]
coming from the second file so here we
[10:26]
got to put out zero
[10:28]
and uh out
[10:33]
Crossfade transition and blah blah with
[10:36]
everything that we said before and let's
[10:38]
see if now it's working
[10:40]
it asks if you want to overwrite the
[10:42]
file and we click yes
[10:44]
and it seems the thing is working cool
[10:48]
so we wait a bit of time until this is
[10:51]
finished
[10:54]
and uh you will see the speed
[10:57]
yeah it is more or less recorded no
[10:59]
video and now it's time to play uh
[11:03]
Beautiful video so we've got the
[11:05]
Singapore X fade
[11:08]
and here we go with the first input
[11:13]
there is a transition from the first
[11:16]
video to the second
[11:17]
cool so I got to say that this thing
[11:21]
about the set time base is a bit uh
[11:24]
say not the forecast it's something that
[11:28]
I didn't know so
[11:30]
um
[11:31]
most normally this is a thing that you
[11:34]
shouldn't do but the
[11:37]
the Crossfade is the necessary one but
[11:40]
so we saw a slightly more complex filter
[11:43]
complex so-called filter graph
[11:46]
that
[11:47]
um
[11:50]
fine
[11:51]
that's fine feel the complex
[11:55]
okay we have our Crossfade video we just
[11:58]
created and now we are going to use it
[12:01]
to make a video with the rgmb together
[12:06]
all in a single video with a tiling so
[12:09]
original video red Channel green Channel
[12:11]
blue Channel
[12:14]
and we use a filtered complex so to
[12:16]
understand that how the filter complex
[12:19]
are working so we are using FM pack and
[12:23]
seeing Apple X fade.mp4 is our input
[12:26]
file here we can repeat the input
[12:30]
multiple times but we use the split
[12:32]
filter which is a bit more clever and so
[12:36]
it makes us understand better how the
[12:38]
filter graph is working so we have the
[12:42]
inputs and the outputs explained better
[12:45]
with a complex field you're going to use
[12:46]
so then we're going to use the filter
[12:49]
complex
[12:52]
we use the accent go to the new line the
[12:55]
triangle accent
[12:58]
and uh the next line would be the first
[13:02]
line of the filter so here we put the
[13:05]
quote and our input is the file so we
[13:11]
have the zero then we put a split the
[13:15]
split requires the outputs
[13:18]
parameter the outputs parameter we have
[13:21]
three channels so we have a one two and
[13:24]
three in this case uh how can we call
[13:26]
them we call them
[13:28]
um let's say uh V1
[13:32]
V2 and V3
[13:35]
so we have a
[13:39]
zero there is an input then B1 V2 V3
[13:42]
where that will be the input for the
[13:45]
next filters and what are the next
[13:47]
filters the next filters will be
[13:51]
so the filter is a loot RGB
[13:57]
if this stands for lookup table RGB in
[14:01]
this case we can make correspondences
[14:03]
between inputs and outputs uh
[14:06]
different channels in the RGB color
[14:08]
space and uh
[14:10]
so root RGB
[14:13]
this is a red channel so we got to put
[14:15]
the green at zero
[14:18]
and the blue at zero
[14:20]
and this will be our red Channel
[14:23]
and
[14:24]
colon
[14:26]
Uline
[14:29]
we have a steal the loot RGB where we
[14:33]
put in this case the red is zero and the
[14:36]
blue at zero since we want the the green
[14:39]
Channel
[14:43]
RG
[14:47]
okay and the third line will be V3
[14:53]
loot RGB equals to a red of zero and a
[15:00]
green of zero since we want the blue
[15:03]
Channel
[15:05]
and now we separate the three rgmp
[15:10]
then now we want to put on the top line
[15:14]
the input and the red channel so we put
[15:17]
a h stack horizontal stack of these two
[15:19]
inputs and the same thing will be done
[15:22]
at the bottom where the the green and
[15:24]
the blue channel so here the next will
[15:28]
be the input video Zero and a red
[15:34]
Channel
[15:36]
this case it is on each stack
[15:39]
equal to inputs
[15:42]
so this is the parameter that we need to
[15:45]
accept the H stack accepts the inputs
[15:48]
equals to two since we have the uh zero
[15:53]
and Dr and
[15:55]
we name it top
[15:58]
oh
[16:01]
okay and we do the same thing with the G
[16:06]
and the B
[16:09]
right here there is on each stack
[16:12]
with two inputs
[16:17]
and this will be our bottom
[16:21]
okay
[16:23]
and now the final filter uh the final
[16:26]
one will be a vertical stack so we put
[16:28]
the top and the bottom together
[16:31]
and so we have the top and we have the
[16:37]
bottom
[16:38]
with this stack equals to
[16:43]
inputs to the same as each stack to be
[16:46]
in the v stack go to two here we can
[16:50]
select if we wanted to give an output to
[16:54]
the output a name or not so here we can
[16:56]
for example put out
[16:59]
is a output but you got to keep in mind
[17:02]
that here we got to put a map
[17:04]
out
[17:06]
in this way if you want you can put it
[17:09]
in this case just to avoid since the
[17:11]
notation is quite long and putting
[17:14]
something like this is a bit more
[17:16]
um
[17:17]
shorter and won't stand back we
[17:19]
understand better what it's doing since
[17:21]
the output is one so it's okay
[17:25]
now it's time to put our options so
[17:28]
there is the lead backs 264
[17:31]
preset
[17:33]
let's put the slow
[17:37]
and as a constant rate Factor we put 18
[17:42]
so a fairly good quality but not the
[17:44]
maximum just to contain the size of the
[17:46]
file and finally we give a name
[17:49]
[Music]
[17:50]
to do it so we can it can be Singapore
[17:53]
it's fader RGB
[17:57]
as format we can put MKV let's see
[18:01]
how it can be
[18:04]
good uh I think everything is okay so to
[18:07]
sum up we have the splitting three
[18:09]
channels then we take the red green and
[18:13]
blue of the three Channel we just output
[18:15]
from the split then we have the
[18:19]
horizontal Stacks we put the two videos
[18:22]
together respectively the input and the
[18:25]
red channels
[18:27]
um then we have the green and the blue
[18:29]
together and then we
[18:31]
see if it is working and it's working
[18:34]
now we wait for the output to be
[18:36]
generated uh now maybe it is a
[18:41]
bit slow but the video is not that long
[18:44]
and we wait until the end of the
[18:46]
processing
[18:51]
[Music]
[19:01]
okay now the processing has finished and
[19:04]
now it's time to play the video so I
[19:06]
think that the video will be too big for
[19:09]
the screen so
[19:11]
um I'm trying to open it with the oclc
[19:18]
and here we go we have the input the red
[19:22]
channel the green Channel and the blue
[19:25]
as we wanted again if you would like to
[19:28]
take a look about how the complex
[19:30]
filters work and to build your
[19:32]
photograph so again we make a sum up
[19:36]
so to set your filter complex it should
[19:40]
be set with a filter from Flex
[19:45]
and then here we put the input
[19:50]
then the name of the filter
[19:53]
with its parameter iron one
[19:57]
uh equals to Value one then the second
[20:01]
value will be in the
[20:04]
uh
[20:05]
a colon then W2
[20:09]
Etc and here we put our output
[20:14]
if we generate from a single input
[20:17]
multiple outputs like the split filter
[20:19]
we put the out one and out to
[20:25]
so here we have all then
[20:29]
with a semicolon we decided what to put
[20:31]
in the next filter and here we put
[20:36]
out one
[20:39]
and
[20:41]
I'll
[20:42]
then we put the name of the filter and
[20:44]
so on and so forth so the fundamental
[20:46]
thing is
[20:48]
input here then output output or outputs
[20:54]
after the filter itself and we go on to
[20:58]
have a better picture about the filters
[21:02]
that we have here in contact we can go
[21:05]
with FM pack minus h
[21:09]
feel this no I'm sorry
[21:12]
if I met if I'm packed minus filters
[21:16]
will show the list of all the filters
[21:18]
that we have available if you want to
[21:21]
look for the filter of choice in Windows
[21:24]
you can use with a pipe fine Str
[21:28]
ucture let's find Str
[21:32]
Ike this
[21:33]
um let's say split
[21:37]
it will find the
[21:40]
dirt is up to you so here we have a
[21:42]
single video with a multiple video
[21:45]
outputs and here we have also
[21:49]
things regarding the audio so same thing
[21:52]
that we did with the video we can do it
[21:54]
with the audio so there's a cross fader
[21:57]
for the audio as well
[21:59]
it's called I think a cross fade check
[22:05]
across fader
[22:08]
um we have a Crossfade of two you've got
[22:10]
the audio streams and here we got the
[22:12]
the X faded ah we also have a x-fit
[22:15]
opens
[22:19]
parameters if I want to check we have
[22:22]
the final meters here we have X fader so
[22:26]
the thing is a FM pack minus h
[22:31]
ilton equals to Theta
[22:36]
and we can take a look at the
[22:44]
type okay it's a transition
[22:51]
who
[22:53]
okay so we saw something about the
[22:55]
filter complex
[22:57]
um I hope you enjoyed this one of the
[22:59]
most complicated things you can do with
[23:02]
fmpeg actually but it will help you a
[23:05]
lot in case you want to automate your uh
[23:09]
video generation process so if you would
[23:11]
like to make crossfades you want to make
[23:15]
fancy facts to your video
[23:17]
substantially sometimes you want to make
[23:20]
a slideshow of your vacation video
[23:23]
essentially you're doing something like
[23:24]
this or either you concatenate or you
[23:27]
Crossfade from one video to the other
[23:29]
there might be something else to say
[23:31]
about the cross fading if you want to do
[23:33]
it in a
[23:35]
good way so maybe it's a bit
[23:40]
uncomfortable to have the offset from
[23:44]
the beginning of the first video
[23:47]
um but knowing if you want to make a
[23:49]
concatenation with a Crossfade or
[23:51]
something but anyway this is a powerful
[23:54]
tool you can look yourself on how to do
[23:56]
it so it's like an overlay
[24:01]
anyway thank you very much if you reach
[24:02]
up to this point I hope you liked it if
[24:05]
you liked it like share and subscribe
[24:06]
and hit the notification Bell to be
[24:09]
always notified with the new video I'll
[24:12]
be releasing and um
[24:15]
I remember you to subscribe and follow
[24:17]
me on the social media uh I maintaining
[24:20]
and trying to maintain at least so
[24:22]
Instagram and Tick Tock uh for new
[24:25]
content
[24:27]
here and uh I hope to see you next time
[24:30]
with new content relative to multimedia
[24:33]
and much much more thank you very much
[24:36]
and ciao ciao
[24:43]
[Music]
[24:51]
foreign