Check Video Info with FFMPEG
35sShows how to instantly get detailed metadata of any video file using a simple command.
▶ Play Clip
[00:00] hello i'm denchi and in today's video
[00:02] i'm going to be showing you how to use
[00:04] ffmpeg with some basic examples so i'll
[00:06] just get rid of a bunch of files here
[00:08] real quick
[00:09] and just pretend i only have one file
[00:11] here outro.mp4 now if i double click on
[00:14] this and i play it back
[00:16] [Music]
[00:18] you'll notice just the outro from all my
[00:20] videos and
[00:21] yeah that's what i use is my outro let's
[00:23] say i want to convert it
[00:24] to an mkv for example well i have a
[00:27] program named
[00:28] ffmpeg and if you're running linux and
[00:30] you have a desktop environment installed
[00:32] this is already on your system including
[00:34] all the codecs that are going to need to
[00:36] do all the conversions
[00:38] so let's say i want to convert this file
[00:39] so i'm going to do ffmpeg-i
[00:42] outro so i means input and if i don't
[00:45] give it any
[00:45] any other parameters and just press
[00:47] enter it will give me information on the
[00:50] file
[00:50] so as you can see here it tells me that
[00:52] um stream00
[00:54] it's using the hevc encoder which is a
[00:57] modern functional
[00:58] encoder you 420p like pixel format
[01:01] it's at 1920 by 1080 in terms of
[01:03] resolution it's at 60fps
[01:05] and all of the stuff for audio it's
[01:06] using aac it's a 48
[01:09] 000 hertz sample rate stereo and 128
[01:13] kilobytes per second as the bit rate um
[01:15] so yeah all of that stuff
[01:17] now let's say i want to convert it to an
[01:18] mkv without
[01:20] any parameters fmpeg defaults to a bunch
[01:22] of stuff that it has pre-built in it
[01:24] i can just tell it to convert it to
[01:26] outro dot mk so it might take a little
[01:28] bit of time because this is
[01:30] a 20 second long video but eventually
[01:32] after i've done running this command so
[01:34] outro that mp4
[01:35] auto mkv just specifying i want it to go
[01:38] from this is my input to just this
[01:40] output
[01:40] i get an output and if i double click
[01:42] and play this
[01:45] you'll see it's it's pretty much the
[01:46] same thing now what if i want to specify
[01:48] a different encoder so
[01:50] this used h264 as the encoder because by
[01:53] default
[01:54] ffmpeg will try to use h64 when
[01:56] converting things to mkv
[01:58] let's say i want to use um h265 or hevc
[02:03] i can do dash c v
[02:07] and specify lib x265
[02:10] as my video codec same for audio if i
[02:13] want to use aac for example which is
[02:15] higher quality
[02:15] lossless audio i can do dash c colon a
[02:20] aac i can give them more options
[02:23] so for example i want to scale the video
[02:25] i can do dash
[02:26] s and like 1280 x 720
[02:30] that's 720p let's say i want to give it
[02:33] a rate i'll i'll keep this for now
[02:35] in the meantime before i talk about more
[02:37] options i'm going to quickly um
[02:40] run this and cancel it so i have it
[02:41] saved i'm going to talk about how to
[02:44] actually get the encoder list so
[02:46] you saw me write out lib x265 how do i
[02:48] know what all the encoders are well if
[02:50] you want to see all the encoders
[02:51] you do ffmpeg dash encoders
[02:54] and that will print them all out if i
[02:56] want all of those to go to like a file
[02:58] just do ffmpeg
[03:00] encoders and send them over to like i
[03:02] don't know
[03:02] [Music]
[03:04] encoders.txt so there you go
[03:06] and it will create encoders.txt you can
[03:08] look through these uh
[03:09] and there's all the encoders you can
[03:11] possibly use on a system
[03:12] now not all of these might work with
[03:14] your system maybe you don't have the
[03:15] hardware for some of the some of these
[03:17] or your processors too old or
[03:19] or maybe they're just not supporting
[03:20] enough that certain things downloaded or
[03:22] something like that
[03:22] but most of these should work and the
[03:25] reason all of these are here is because
[03:26] video comes in many variations so the
[03:28] one i use
[03:29] was let's see if i can spot it here we
[03:31] are uh lib
[03:33] x265 so this is s265 also known as hevc
[03:38] uh h264 this is the nvidia version but
[03:41] up here
[03:41] we got h64va api so that's the version
[03:44] for um video accelerated stuff
[03:47] um and then somewhere up there here we
[03:50] are you'll find
[03:50] libx 264 so that's h64 so that's the
[03:53] actual you know
[03:54] standard codec anyway but this isn't
[03:57] what's important now let's go back to
[03:58] where we were uh before i think i need
[04:00] to go
[04:00] uh wait a second you know open up the
[04:03] main toolbar
[04:04] and not maintain sorry uh settings uh
[04:07] show tabs go back to the previous file i
[04:09] was in
[04:10] this one anyway so back to what i was
[04:12] talking about before
[04:13] let's say i want to take i don't know
[04:16] let's just delete this file let's say i
[04:17] want to take
[04:18] outro that mp4 and convert it uh with
[04:21] what i was doing before
[04:23] uh this um i want to use aac as my audio
[04:26] codec
[04:27] x265 as my video codec basically the
[04:29] best ones out there pretty much
[04:31] and i want the resolution to be 720p
[04:34] let's say i want to
[04:35] change the audio rate so rate colon
[04:38] a and i give it something like 44
[04:42] 100 a common audio rate uh just
[04:45] give it a couple spaces so things are a
[04:46] little bit more evenly formatted here
[04:48] um spaces don't matter let's say i want
[04:50] to change the
[04:51] video bit rate dash b the one megabyte
[04:55] at most it can reach one megabyte per
[04:57] second
[04:57] most likely won't but if i really want
[04:59] to uh or let's say i want the audio
[05:01] bitrate to be something i can do
[05:03] dash b a and bitrate audio and set it to
[05:05] 192 kilo
[05:06] kilobytes per second or kilohertz no not
[05:09] killer it's kilobytes per second
[05:11] um now setting video like uh bitrates is
[05:14] pretty pointless when you're using
[05:15] something like x365 or h264 all that
[05:17] stuff because there's already an inbuilt
[05:19] utility for it it's called
[05:20] crf and it's much better it's uh very
[05:23] varying the bit rate
[05:24] uh based off a number you give it so the
[05:26] lower the number is
[05:27] the better the quality will be but the
[05:28] bigger the following follows
[05:30] so let's say i want it to be 24. 24 is a
[05:34] good number uh i
[05:35] most of my videos are you know 20 i set
[05:37] the crf rate to 24 when i compress them
[05:39] including this one it's 24. and um
[05:43] you know as you can see it looks pretty
[05:44] good if you need higher quality
[05:46] 20 but like it's pretty
[05:48] indistinguishable like a little bit
[05:49] maybe with more noisy video but you know
[05:52] for most video it's perfectly fine
[05:53] anyway moving on let's say i want to
[05:56] change the duration as well this video
[05:58] i can do dash ss to declare what i
[06:00] wanted to start i wanted to start at
[06:01] well zero hours zero minutes zero
[06:04] seconds
[06:05] and zero milliseconds and let's say i
[06:07] want it to end so dash
[06:08] t at zero hours zero minutes
[06:12] and zero five seconds and zero
[06:14] milliseconds
[06:15] i can also that's pretty much it no so
[06:18] i'm going to do after outside mp4 i'm
[06:19] going to use x265 i'm going to set my
[06:21] codec to aac for audio
[06:24] i'm going to scale it down to 720p
[06:26] change the audio bitrate to
[06:27] 44 100. i use crf 24 so you know pretty
[06:31] good quality for
[06:32] h.265 and stuff set my bitrate of audio
[06:35] to 192 kilobytes per second
[06:37] uh start the video at zero zero just the
[06:40] beginning of the video
[06:41] and end it at five seconds so let's
[06:42] press enter and let it work
[06:49] since it only had to do five seconds it
[06:50] was relatively quick and if we play this
[06:52] back
[06:56] as you can see it lasts five seconds
[06:58] it's in 720p and
[06:59] everything has been applied so ffmpeg is
[07:02] a really powerful tool when you want to
[07:03] mask convert files because you could
[07:04] just write a script and and mass convert
[07:06] every single mp4 file to
[07:08] a different format or every single mp4
[07:10] file compress it to something else or or
[07:12] something like that
[07:13] and let's say i want to take this
[07:15] outro.mp4 file
[07:16] and turn it into audio well that's the
[07:18] same concept dash i
[07:20] altered it before if i want to specify a
[07:22] specific audio codec i guess i don't
[07:23] know
[07:23] lib opus or something but i'm just going
[07:26] to say outro dot wav
[07:28] let's just turn it into a waff instantly
[07:30] done there you go australia double click
[07:32] that
[07:34] and as you can see it plays back because
[07:36] i've converted it to audio
[07:37] and here right before i end this video
[07:39] because i've talked about all the main
[07:40] options
[07:40] let's do a fun little experiment let's
[07:42] transform this outdoor.web and this
[07:44] image into a video
[07:45] so i'm going to take out that wav and
[07:48] essentially mix it with this image so
[07:49] i'm going to do ffmpeg
[07:51] dash i outro
[07:54] and then dash i image.png and i'm going
[07:58] to specify
[08:00] a specific codec so let's say i want
[08:03] libx265 relatively good the crf
[08:06] i don't know 20
[08:10] 20 20 is pretty good in terms of quality
[08:12] images are a little bit messed up when
[08:13] it comes to this kind of stuff
[08:15] and let's say i want um something like
[08:18] uh
[08:19] audio codecs okay i might want to
[08:21] specify a bitrate for audio though so
[08:23] i'm going to do b
[08:24] a and set it to 192 kilohertz so let's
[08:27] press enter on this
[08:29] and oh yeah i forgot to set an output
[08:31] file so wait a second i'm going to
[08:33] specify i want it to be
[08:34] outro image dot mp4 press
[08:37] enter and just let it convert there you
[08:38] go it's already done double click on
[08:40] this
[08:41] and as you can see it's the image with
[08:43] the audio it's just you know the image
[08:45] playing back in it and it has the audio
[08:47] from uh outro dot uh wove which is just
[08:50] you know just the raw
[08:51] 20 second audio and it mixes it with
[08:54] this image so if you've ever wanted to
[08:55] just have a still image
[08:56] and you're talking you can make that
[08:58] pretty easily in the file itself is
[09:00] negligible in terms of sizes it's
[09:01] minuscule it's 489 kilobytes so if you
[09:05] ever need to make a video where it's
[09:06] just like
[09:06] an image and that's all you can do that
[09:08] pretty easily with this
[09:10] so anyway thanks for watching my video
[09:11] on how to use you know ffmpeg with some
[09:13] basic options
[09:14] i'll have all a bunch of examples in the
[09:16] description if you want to take a look
[09:17] at them i'll just have this entire thing
[09:19] in the description actually
[09:20] um and yeah ffmpeg is a really useful
[09:23] tool i recommend if you're into video
[09:24] stuff
[09:25] you learn how to use it uh the best
[09:27] encoders for video
[09:28] are at the moment lib x265
[09:32] best encoder for audio is aac because
[09:34] high quality
[09:35] x265 is you know as long as you set your
[09:37] crf rate appropriately it's going to be
[09:39] perfectly fine in terms of quality
[09:40] might be a little slow because
[09:42] processors and stuff um if you need to
[09:44] deal with
[09:45] something like nvidia and coding you can
[09:47] do obviously what was it called um
[09:50] nvenk uh underscore hevc that's another
[09:54] codec you can use but it's it's or
[09:56] actually i think it's hebc underscore
[09:58] and bank
[09:59] and it's it's fast but it isn't as
[10:02] precise because
[10:03] gpus aren't like perfect like processors
[10:05] when it comes to video and
[10:06] the file sizes will be larger and it
[10:08] won't be as you know good
[10:09] it won't be as high quality video but
[10:11] yeah that's pretty much it
[10:13] thanks for watching my video goodbye
[10:25] [Music]
[10:35] you
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.