FFMPEG Advanced Techniques Pt1 - Advanced Filters

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
ladies and gentlemen on this particular channel we've taken a look at ffmpeg before on several different occasions in the past we've looked at ffmpeg as primarily a conversion so we've seen that it does you know some interesting things like cropping scaling and rotating but in fact this program is so much more than that ffmpeg can't do a whole lot of advanced features and in some cases can even actually edit a video this week let's take a look at some more advanced ffmpeg filters and operations hello and welcome back to another random Wednesday episode in this particular video we're gonna take a look at some of the more advanced filters that are present within ffmpeg so this video is gonna be quite short quite light I'm gonna be just introducing you to those effects as well as showing you a little bit of how to customize each one of them next week we're gonna actually take a look at some of the more advanced features within ffmpeg and this includes how to string multiple filters together and we're also gonna look at how we can actually use that a fan pack to properly edit a video submit cuts in them and throw away certain parts of the video so yeah without further ado let's jump into taking a look at our filters before we begin let's start with a very quick recap of ffmpeg syntax I'm just gonna very quickly go through what syntax there is if you need more detailed instruction about this you should check out the older video anyway this is what ffmpeg syntax generally looks like you want first used - I to specify your input file you can optionally include some filters using a filter string which I will talk about on a different slide and of course at the end of the day you do need to specify an output file name since this is all about filters let's spend more time looking at the filter string itself now you do actually have to type everything together on one but it's not very clear what it actually means so for the sake of clarity I'm gonna actually split this out into multiple lines you of course have to start with a dash VF which stands for video filters surround your entire fills our string by quotes and on the inside this is what you write first of all you have to start with a filter whatever the name of a filter is simply type it in and if you actually want to give it more settings which usually you do but then also add an equal sign to specify the settings you're gonna have to use basically a setting name equals to the value you want to set it to so yea it's basically a key value path you want to mention the setting name equals the value you want to set it to if you have multiple settings separate it with the colon character you can specify multiple filters as well and in order to separate them you want to use a comma so yeah in this case they're actually two filters as you can see one filter with its settings comma and the next filter so yeah that's essentially what the filter string syntax looks like so alright let's start by taking a look at our video editing filters now let's start with sharpening of course many cameras these days produce footage that you know it's a little bit soft so sharpening is always helpful as you can see this is a clean shot out of my DSLR camera and you can see that you know the edges are sort of blurry let's make use of the unsharp filter to make it better so let's look at very quick before and after before we continue no this is before this is after no you might argue that the changes are little subtle which I would tend to agree but if you look closely at the lines here well they do seem to be a little bit more clip to do this in ffmpeg you'll wanna make use of the unsharp filter now the basic command call is to simply use - filter and say on sharp by default a pretty decent job already done but of course we can actually change the filter size to make the effects even more apparent to do this you want to use LX and ly which actually specifies the filter size any horizontal and vertical directions by default both these values are set to 3 and that is the results you see on the far left bringing it up to 7 gives you the results in the center which of course appear sharper and bringing it up some more to 13 well mix it effects really prominent in fact a little bit too much so if you ask me apart from changing this you can also change the L a value which actually represents the intensity of the effect by default in a set to 1.0 which gives you the effects on the far left increasing it to 1.5 of course makes the effect stronger and interestingly if you would actually use a negative value you end up blurring the image what this means is the unsharp filter also doubles up as a blur filter if you ever have the need to do that all right let's move on to our next filter now of course the pictures coming straight out of your camera does not necessarily have to be you know really clear really nice and bright but that's why editing actually comes in where you can actually tweak up things like brightness contrast and saturation once again here's a before and after now I've done this operation on a JPEG image but you can of course as easily do this to a video now here's one thing that's good to tweak you can actually tweak the contrast of a video now in this particular case 1.0 actually means no change reducing this value gives you less contrast as you can see this image feel small well washed out and increasing the value beyond 1 gives you a more contrast II image you probably don't want to overdo this values around 1.3 are good a little bit more a little bit less will be fine but not too much more brightness well that's self-explanatory you make the image brighter or darker the faults at zero which means no change reducing the value in other words making ethical and zero makes the image darker and increasing it makes it brighter saturation is of course what you expect it defaults to one increasing it makes the colors more apparent and more vivid whereas decreasing the value makes the colors go closer to monochrome now you can also find gamma adjustments for example in this case I'm actually tweaking the gamma for you red channel once again at the first one and that means well it looks exactly like it used to reducing the value actually reduces the median amount of red creating a scientist looking image which is what we have right here on the Left increasing it increases the median amount of red of course giving us a reddish image of course using the EQ filter to tweak color might be a little bit counterintuitive so let's move on to take a look at the color balance tool which of course well is more suitable for this purpose now there are actually nine different settings in the color balance tool because well this is meant to be strictly a color adjustment so the cool thing is you can actually change the amounts of red green and blue 40 shadows mid-tones and highlights segments of the image separately this basically allows you to do full-on color grading you can do many cool effects as we'll see in a couple of slides now let's take a look at this one here basically what I've done is 40 red shadows I've actually reduced it a little and for the blue shadows I've increased it a little the net effects of doing this is that deep darkest parts of the image now take on a bluish tint you can actually see it well in a lot of these areas then the next thing I've done is forty highlights I've increased the red a little and decrease the blue a little you can ofcourse see this in the sky we're just now taking on a slight reddish color now here's another example on the same image now the shadows have been pushed towards green which you can of course see here and highlights have been pushed towards a very light purple and the van of course is still visible here one more example before we wrap this up all I've done here is significantly increased the red in the shadows and decrease the blue in the shadows as well you can actually see the reddish tint in a lot of these areas all right let us move on to the fun stuff and that would be the audio visualizations now in order to do this we actually have to tweak the command a little across the input is now an audio file but more crucially the filter now needs to be filter underscore complex now the first thing you'll probably want to do is to generate a wave form you can use the show waves filter to do this and they are basically you know two particularly different modes one being the line mode and the other being this center line mode as you can see in both these examples you can see sort of three different colors in fact the left channel is rendered in red the right channel is rendered in in green so when you actually see a yellowish orange color that is when the wave is actually present on both sides so yeah this is actually a very interesting way of picturing so you can of course use the size arguments to change up the size of the visualization if you don't actually use this the original size of the visualization can be quite small it can be quite low resolution so you are recommended to use this if required next up is frequency which of course is done using this particular filter and yeah the idea is this is a histogram showing you well the lowest frequencies on the left and highest frequencies all the way on the right again this method uses two different colors to show you the difference between the left and right channels now for both of these two techniques we've just seen you can actually change up the color and for both these filters the name of the arguments is the same and that is colours basically you have two right equal to and a set of colors separated by the pipe symbol what I'm assuming here is that you have a stereo input and therefore you can only supply two colors one for the left channel another for the right channel of course if you're recording something that has even more channels than that then of course feel free to add more colors here's a frequency graph showing you blue and purple for the left and right channels respectively as you can see the colors look something like this now here's another one that's more interesting I've actually included hex color codes instead of the names of colors and both of these methods actually work since these two colors actually sort of inverses of each other adding them together creates white and so that creates this very interesting effect here now moving away from the two visualization methods we've just seen here is a very interesting one called show cqt now I'm gonna go quiet and actually let you listen to the piano piece you know in conjunction with this visualization and I want you to take note of how this is essentially showing you which piano keys are being pressed cool huh now let's move on to our last audio visualization which is the vectorscope it's actually a vector scope plus the difference between the left and right channels actually plotting them on the vertical and horizontal axis and what he actually get at the end of the day is this very nice sort of radial pattern now for this you can actually tweak several different color settings which gives you very different results by changing our CGC and PC you're actually changing the contrast of the red green and blue channels in this particular case I've given a lot of contrast to the red and blue channels creating a purple kind of look this is the default settings which is mostly greenish and somewhat bluish and this is another variant which is mostly blue but this is not the only thing that influences the color you see over time the colors actually fade out and you can influence how quickly each color fades out to do this you want to use the RF GF and bf parameters and well the larger the number the faster a particular color fades out in this case I've actually made red fade out the slowest which is why most of the colors you see here is red this is the default which actually makes blue fade out the slowest which is why you see a lot of glue and yeah this is another variant in which Green disappears very quickly and that's why you see mostly purple left behind for even more visual interest you can actually change the draw mode to light by using the draw parameter and setting it to line you can more clearly see well the patterns that are actually drawn out but a differences in audio between the left and right channels alright let us move on to our last part which is video visualizations now this might seem a little bit strange I mean audio visualizations make sense because well you wanna turn audio into a form that is visible but as it turns out video data can be visualized in a different way as well let's start with the vectorscope know if you've been following the rest of my videos as well you will remember some time ago we actually talked about you know expressing digital data in analog forms and at the end we actually talked about using vector scopes to visualize video well we have an example right here essentially what this does is well all the colors are being shown in a circle and well whatever colors there are in the image is shown as lines that actually move in the appropriate direction of the color turns out you can generate this with ffmpeg using the vectorscope filter now by default if you were to just called defective scope filter the result this kind of boring looking well first of all it's very low resolution turns out to be really only way to fix this is to well change the format of the input video using a completely different filter so that's what I'm doing here I'm setting the format here to a slightly different one which generates a larger vector scope still this is monochrome not-so-fun you can actually use the mode setting to change it up to a different look since this is more colorful I think it you know sort of conveys the idea in a clearer manner but yeah of course well since this is color this is color for there are actually several different settings in between that I won't go into detail I think these two that I've shown here are the best looking after lot now you can also introduce one unknown as graticule and these are just little labels around the edge of the fact that scope let tell you what color each different angle actually corresponds to you can have these graticule appear in green or in the actual color they represents now as a little added bonus you know as our extra health filter well you can actually express the same idea in a slightly different manner using the CIE scope filter so this is just a different way of representing these same information but this looks more colorful in a way so you might want to use this instead let's move on to our last video visualization D waveform now this one doesn't seem to make a lot of sense until you actually see it alongside the actual video now I've had to do quite a bit of you know as a fansite trickery to get this one to work but essentially what's happening here is that well I've overlaid the original video on top of two different versions of the waveform as you can see when played back it turns out that the waveform at the bottom is actually showing the intensities of each column of the image well the way from on the left is showing the intensities of each row so yeah in a way this is just a brightness meter with a spatial component to it and to choose between the row mode or the column mode well just use the mode parameter on top of this setting you can actually also configure it to show color information and to do that you want to use the component setting now it feels like this is actually you know a bit mask of some kind and specifying components equal to seven means you want to show all three channels this is actually showing this as three different waveforms if you want you can also combine them all together by saying display equals overlay so yeah that is the waveform our last filter for today and they have it hopefully by just taking a look at least nine different filters available within ffmpeg well you are convinced that ffmpeg is more than just a conversion tool but it's also a pretty good editing and visualization tool that's all there is for this episode do of course states you involve follow up next week in which will actually talk about some advanced techniques including how to string multiple of those filters we've just seen together into one video again that's all there is for this particular video thank you very much for watching and next time you're watching 0-6 watts UTV thank you very much for watching if you like this video consider checking out the rest of my work on my channel alternatively you may be interested in a playlist of my earlier work on computing and computer science topics if you'd like to show me some monetary supports I am on patreon you can find a link to my campaign in the video description of course you can simply like this video or leave a comment I'll be sure to respond as soon as I can to keep in touch with my future uploads do subscribe to this channel and for even more updates check out the official Twitter account for this channel @ 0 6 1 2 TV thank you for your support
Info
Channel: 0612 TV w/ NERDfirst
Views: 53,925
Rating: undefined out of 5
Keywords: ffmpeg, filters, tutorial, ffmpeg filters, filtering, filter, editing, visualizations, visualization, showwaves, showfreqs, eq, unsharp, unsharp mask, mask, unsharpen mask, blur, sharpen, brightness, contrast, saturation, colorbalance, color balance, color grading, color correction, color, balance, grading, correction, avectorscope, showcqt, vectorscope, waveform
Id: M58rc7cxl_s
Channel Id: undefined
Length: 19min 37sec (1177 seconds)
Published: Tue Sep 27 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.