[0:00] Sometimes in our computing life, we actually make use of software without realizing that [0:05] we're using a particular piece of software - And one very good example of this is FFMPEG! [0:11] FFMPEG is actually a command line utility and its job is to do file format conversion. [0:17] And, in that process, it can also do a number of cool things. [0:21] Now, because of the license of FFMPEG, it is actually included in certain other pieces [0:26] of software, you know, to do its job in the background and as a result you may or may [0:31] not realize that it's actually there, but in fact it is! [0:35] So what we're gonna do today is we're not only gonna give FFMPEG the recognition it [0:40] deserves, we're gonna learn how to actually use it from the command line, that is the [0:45] plain, vanilla FFMPEG running on your computer from scratch! [0:50] So yeah, I hope this interests you! [0:52] After learning how to use FFMPEG I've actually found it quite useful and indispensable in [0:57] many situations, so yeah, I hope you think the same! [1:00] You're watching another random Wednesday episode on 0612 TV! [1:14] Hello and welcome back to another random Wednesday episode! [1:17] So FFMPEG! [1:19] A very interesting tool - Let's begin by learning how to install it, we'll then move on to the [1:25] basics, and then to some more interesting things you can do with this piece of software. [1:31] Of course, as it turns out, it is much more than a file format converter, but yeah, like [1:36] I said, we'll see it when the time comes. [1:39] First of course is how do we install this program? [1:42] Well, you can find a download link in the video description, it will send you to the [1:46] download page on the official FFMPEG site. [1:49] You'll realize right off the bat that things are a little bit complicated because there [1:54] are three different versions of FFMPEG you can choose from. [1:57] But, they do tell you that if you've no idea what you're supposed to do here just pick [2:02] the static version, so that's what we're gonna do! [2:05] Basically the idea is the static version contains all of FFMPEG in one .exe file, which, for [2:12] our purposes is the most convenient! [2:15] So I would recommend that as well. [2:17] Go ahead and download the latest version for whatever bitness your computer is, and you'll [2:23] realize that what you end up with is an archive. [2:27] Open the archive in an archive manager of some sort. [2:30] If you don't have one you can check out PeaZip, which I will also link to in the video description. [2:35] Within the archive, enter the "bin" folder, and look for FFMPEG. [2:40] That's really the only file you need, so extract that to some location that you can remember, [2:46] and we can begin converting! [2:48] Now, if you intend to use FFMPEG from anywhere on your computer, you might want to, you know, [2:55] save it somewhere important, like in a Program Files folder, and then link to it using the [3:01] PATH variable. [3:02] So what you're seeing onscreen right now are the steps I've used to do that. [3:06] I do actually have things set up this way because well, it's just easier for me. [3:12] Of course, this step is optional so if you don't want to do that, then make sure FFMPEG [3:16] is in the same folder as the video files you want to work with. [3:22] With that out of the way, let's move on to the fun part, and that is to actually convert [3:27] files with FFMPEG! [3:29] Now, previously to this I know I mentioned videos repeatedly, but as it turns out FFMPEG [3:35] can also work with images and audio! [3:38] Basically, well, it's a command line utility you just tell it what file to process and [3:43] what kind of output you want, and it just does it! [3:47] That's how amazing it is! [3:48] So, let's actually try a very simple example first of taking a video file and converting [3:55] it from .avi to .mp4. [3:56] Now, what you're seeing here is a folder in which I have staged the files I want to work [4:02] with throughout this video. [4:03] You can open a command line very quickly on a windows computer by first making sure no [4:08] files are selected, then hold down shift, right click empty space, and then click on [4:14] "Open Command Window Here". [4:17] That's convenient because the command window opens in that particular folder, so you can [4:21] get started right away. [4:23] Here's what FFMPEG syntax looks like - You start off by saying FFMPEG, then you say -i, [4:31] which means "I'm about to specify an input file", and then, you go ahead and specify [4:36] the input file! [4:38] So what we wanna do here is we wanna convert an AVI file to MP4. [4:42] So simply all you have to do is to actually press space, and type out the new name of [4:47] the file, making sure that the extension is MP4. [4:49] Hit enter, and, well, off it goes! [4:54] FFMPEG is now converting an AVI file to MP4, by just looking at the file extension of the [5:00] filename you gave it. [5:02] That is how simple FFMPEG actually is, and a lot of the time when we want to convert [5:07] between different file formats, that's really all you need to do. [5:11] But well, the time will come when you wanna do something more complex, and that is where [5:16] the command switches start to come in. [5:19] Probably the first thing that concerns you would be the quality of the file. [5:24] You would probably want to be able to tweak up the quality and what I'm gonna show you [5:29] here works for MP4 and AVI respectively. [5:33] Let's start with AVI. [5:35] Now, there is a factor in image compression called the quantizer that actually affects [5:41] file quality, and it is linked to how it should choose a bitrate, when it comes to variable [5:47] bitrate encoding, but we won't go into too much detail about that. [5:52] Basically, all you need to know is that the quantizer is a number. [5:56] The smaller the number, the higher the quality. [5:59] Of course, the higher the quality, the higher the file size, so there's a trade-off you [6:03] need to work with. [6:04] To set the quantizer for an output AVI file, all you have to do is well, you call FFMPEG, [6:10] you specify the input, and then you type -q, followed by a number. [6:16] This number is of course the quality setting you want. [6:19] Numbers between 20 and 30 is common, but if you want a very high quality video, you can [6:24] go as low as a single digit. [6:27] If you want it to be lower quality you can go as high as 50. [6:31] Experiment! [6:32] You'll be able to see the difference in the different settings you choose. [6:36] Do note that this only works when you're writing a file with a .avi extension. [6:41] If you're doing this for MP4 files, then you'll want to specify the -crf value instead! [6:48] So instead of -q you'll need to type -crf, and then enter your number. [6:53] I think this exists on a slightly different scale from the -q flag, so yeah, be careful [6:59] of that. [7:00] The values are not necessarily the same! [7:02] Once again, experiment! [7:04] You know, look at the file size, look at the quality and decide whether you want to bump [7:08] it up or down. [7:10] If you prefer finer control, you can also specify the exact bitrate of the output file. [7:16] Now, bitrates work for both audio and video in a file, so you'll probably want to tell [7:21] it whether you want to tell it whether you want this to work on the video channel, or [7:24] the audio channel. [7:25] And to specify this, you'll want to enter a colon, and then type v or a, depending on [7:31] which stream you want to target. [7:33] Then, give it a number. [7:35] For example, if I want the video quality to be 1000k, which is actually quite low, well, [7:41] you can do that. [7:42] I can even specify both audio and video bitrates at the same time, and that will fix the two [7:48] bitrates of the two different streams. [7:51] This is of course only if you want finer control. [7:53] So yeah, for the vast majority of use cases I'd say you know, what you've learnt so far [7:59] covers your bases, but let's say we want to go a step further - Let's take a look at FFMPEG [8:05] filters just for fun! [8:07] Now, here's the deal - FFMPEG actually comes bundled with a whole bunch of different filters! [8:13] And they all have various effects on the video itself. [8:16] What I've done is, through the whole list of video and audio filters, I've picked a [8:20] total of five to go through with you. [8:23] Two of them are for audio, and the remaining three are for video, and these are the things [8:28] you'd probably do the most often. [8:30] So yeah, let's take it from the top. [8:33] We're going slideshow mode again because we've overrun! [8:36] Let's quickly jump through the five filters. [8:39] First, let's tweak the volume. [8:42] To do this, simply add the following flag to the FFMPEG call. [8:46] The flag itself says we want to use a filter on the audio channel, and its parameter says [8:51] that we want to call the volume filter, with a setting of two. [8:56] The number we provide is actually a multiplier. [8:59] So when we say volume=2, we are actually doubling the volume. [9:03] You can of course use decimal volumes, including values smaller than 1 to reduce the volume. [9:09] Next, channel remapping. [9:12] Sometimes we accidentally record with a mono mic into a stereo track, causing the sound [9:17] to only go to the left channel. [9:19] We can easily fix this by mapping the audio from the left input channel to both the output [9:24] channels. [9:26] That's what this command call means! [9:28] The left channel is 0 and the right channel is 1. [9:31] So what we're doing here is mapping the input left channel to the output left channel, and [9:36] then the input left channel to the output right channel, thus creating an audio track [9:41] that has sound on both sides. [9:44] Let's move on to the video filters. [9:47] First cropping. [9:48] The syntax looks like this. [9:51] Notice how we say -filter:v because we now want to target video. [9:56] We then say crop, and specify up to four parameters. [10:00] The first two are width and height, which specify the width and height of the output. [10:05] The two remaining parameters are optional, and they specify the upper left corner of [10:09] the cropping. [10:11] If unspecified, the cropping is centered. [10:14] You can use arithmetic for this as well. [10:16] For example, this statement means that we want to crop the video to 2/3 of its original [10:21] size. [10:22] The variables in_w and in_h are available, referring to the input width and height respectively. [10:30] Next, video scaling. [10:33] This looks very similar to the first two parameters of the crop filter. [10:37] Use w and h to set the width and height of the output. [10:41] You can also arithmetic like with cropping. [10:44] The variables in_w and in_h are also available here. [10:49] In addition, if you'd like proportional scaling, you can specify -1 for one of the input parameters. [10:57] Its value will be determined from the length you do provide. [11:01] Finally rotation. [11:04] Simply say rotate= and specify your angle. [11:07] Unfortunately your angle needs to be specified in radians. [11:11] Luckily it's not that hard, since you can just multiply by the constant PI/180. [11:15] So the following statement refers to a clockwise rotation of 45 degrees. [11:23] The result of this operation looks something like this. [11:27] And there you have it! [11:28] We've actually gone through a pretty comprehensive beginners guide to installing and using FFMPEG. [11:34] And we've even taken a look at some complex features, in the form of some filters, but [11:40] I've barely scratched the surface! [11:43] Like I said, FFMPEG has a whole host of filters and if you want to look at the full list, [11:48] I will include the link in the video description so you can find out more. [11:52] That's all there is for this particular episode, it does look like I've overrun a bit so sorry [11:57] about that, but hopefully you've found this video insightful anyway! [12:01] Thank you very much for watching, and until next time, you're watching 0612 TV with NERDfirst.net.