[00:00]
Welcome to the world of
[00:02]
FFmpeg. FFmpeg is a powerful command
[00:04]
line tool used for processing audio and
[00:07]
video files. This tool is a versatile
[00:10]
solution for handling multimedia
[00:14]
files. So what exactly is
[00:17]
FFmpeg? FFmpeg is a free and open-source
[00:20]
software project. It includes a suite of
[00:23]
libraries and programs. It's designed
[00:26]
for handling video, audio, and other
[00:28]
multimedia files and streams. Some of
[00:31]
its key features include the ability to
[00:33]
convert between different file formats,
[00:36]
resize and scale video, extract audio
[00:38]
from video, compress media files, and
[00:41]
even apply filters and
[00:44]
effects. Now, let's dive into the basic
[00:47]
syntax of
[00:48]
FFmpeg. The command structure generally
[00:51]
looks like this. ffmpeg followed by
[00:54]
global options then input options along
[00:56]
with the input file and finally output
[00:59]
options with the desired output file. A
[01:02]
simple example of this would be
[01:04]
ffmpeg
[01:06]
input.mpp4
[01:08]
output.webm. This command converts a
[01:10]
video from mp4 format to webbm format.
[01:16]
Let's explore some common FFmpeg options
[01:20]
for input and output. - I specifies the
[01:23]
input file. - F is used to force a
[01:26]
specific input or output file format. -
[01:29]
Y overwrites output files without asking
[01:32]
for confirmation and -ash N ensures that
[01:35]
output files are never overwritten. When
[01:38]
working with video, - C: V sets the
[01:40]
video codec. - R adjusts the frame rate
[01:44]
specified in hertz.
[01:46]
- S sets the frame size using width by
[01:48]
height or an
[01:50]
abbreviation and -B colon V sets the
[01:52]
video bit
[01:55]
rate. Now let's consider some of the
[01:57]
audio options available in
[01:59]
FFmpeg. Dash C is sets the audio codec.
[02:04]
-ash B cols the audio bit rate dash A R
[02:08]
sets the audio sampling rate dash C sets
[02:11]
the number of audio channels and -ash A
[02:14]
disables audio recording as an example
[02:17]
the command ffmpeg- i
[02:20]
inputmpp4- c
[02:23]
aac-b a 192k output to mp4 converts
[02:27]
audio to the AAC codec at 192 kilobits
[02:31]
per second. Another example,
[02:34]
ffmpeg- i
[02:37]
input.mpp4-vn c ampp3
[02:41]
output.mpp3 extracts audio from a video
[02:43]
into the mp3 format. Finally, the
[02:46]
command ffmpeg-
[02:49]
iinput.wav-
[02:54]
ar44,100-ac2output.wav converts the
[02:55]
audio to 44.1 kohertz stereo audio.
[03:01]
Let's explore some practical video
[03:03]
conversion examples. To convert video
[03:06]
from MP4 to MKV container format using
[03:09]
H.264 video codec and AAC audio codec,
[03:13]
you can use the command
[03:14]
ffmpeg-
[03:16]
input.mpp4- CV
[03:20]
libx264- C AAC output MKV. To resize a
[03:26]
video to 720p resolution, that is
[03:31]
1,280x720 while keeping the original
[03:33]
audio stream unchanged, you can use the
[03:35]
command ffmpeg- i input mp4-
[03:42]
s,280x720- c a copy output mp4. To
[03:47]
change the frame rate of a video to 30
[03:49]
frames per second while preserving the
[03:50]
original audio, use the command
[03:53]
ffmpeg- i
[03:55]
input.mpp4- r30- c a copy
[04:01]
output.mpp4. Let's explore some advanced
[04:04]
video operations.
[04:06]
To extract a clip from 1 minute 30
[04:08]
seconds to 2 minutes 45 seconds from the
[04:10]
input video without re-encoding which
[04:12]
makes it faster. You can use the command
[04:15]
ffmpeg- i input mp4- ss
[04:19]
0001 col
[04:24]
30-2000245- copy output mp4. To add a
[04:28]
watermark such as a logo.png png to the
[04:31]
top left corner of the video positioned
[04:33]
at 1010. You can use the command ffmpeg-
[04:37]
iinput.mpp4-
[04:39]
logo.png-filter complex overlay equals
[04:42]
10 col 10
[04:44]
output.mpp4. To create a GIF from the
[04:46]
first 5 seconds of a video at 10 frames
[04:48]
per second, scale to 320 pixels width,
[04:52]
you can use the command
[04:53]
ffmpeg-input.mpp4-vf
[04:55]
mp4-vf quotes fps= 10 scale equals
[04:59]
320-1
[05:04]
quotes-toutput.gif. Now let's look at
[05:06]
some common audio operations you can
[05:08]
perform with
[05:09]
ffmpeg. To extract audio from a video
[05:12]
file and convert it to MP3 format at 192
[05:15]
kilobits per second bit rate, you can
[05:17]
use the command
[05:19]
ffmpeg- i input
[05:22]
atmpp4-vn c
[05:25]
ampp3-b a 192k output mp3. To replace
[05:30]
the original audio track in a video with
[05:32]
a new audio file, you can use the
[05:34]
command ffmpeg-
[05:37]
iide.mpp4- idio.mpp3. MP3- C col v copy-
[05:42]
mapap 0 col v
[05:45]
0-map 1 col a 0 output mp4 to double the
[05:50]
volume of the audio track in a video
[05:52]
file. You can use the command ffmpeg-
[05:56]
iinput.mpp4-filter col a quotes volume
[05:58]
2.0 quotes
[06:02]
output.mpp4. Let's explore streaming and
[06:05]
recording
[06:06]
functionalities. To stream a video file
[06:08]
to an RTMP server like YouTube or Twitch
[06:11]
using h.264 video and AAC audio, you can
[06:15]
use the command ffmpeg- i input mp4- cv
[06:21]
libx264- c
[06:23]
aac- fvv
[06:29]
rtserver
[06:30]
slive slream. To record the screen on
[06:34]
Linux at 30 frames per second, use the
[06:36]
command
[06:38]
ffmpeg-fx11
[06:46]
grab-s1920x180-0.0-r30output.mpp4. Note
[06:48]
that for Windows, you should use
[06:50]
-fgdigra- desktop instead. To record
[06:53]
from a webcam for 60 seconds on Linux,
[06:56]
you can use the command
[06:59]
ffmpeg-f4l2-
[07:01]
i/dv/
[07:03]
video0-t webcam_captured mp4. On
[07:08]
Windows, use -fdow- i video equals
[07:11]
camera name
[07:13]
instead. Here are some pro tips to
[07:15]
enhance your ffmpeg experience. Use -ash
[07:19]
copy when possible to avoid re-encoding
[07:22]
and save time. Preview commands with
[07:25]
-ash tend to process just the first 10
[07:28]
seconds. Check available codecs with
[07:32]
ffmpeg-codeex. Use dashhide banner to
[07:35]
reduce output
[07:36]
verbosity. Always check the output file
[07:39]
to ensure the desired quality and format
[07:41]
were achieved. For learning resources,
[07:44]
refer to the official documentation at
[07:46]
ffmpeg.org/document.
[07:48]
or/documentation html the ffmpeg wiki at
[07:54]
track.fmpeg.org/wiki the man pages which
[07:56]
can be accessed by typing man ffmpeg in
[07:58]
the terminal and the help command
[08:01]
ffmpeg-h or for specific options
[08:04]
ffmpeg h filter equals scale. Also don't
[08:08]
forget to check community forms and
[08:10]
stack overflow for specific use cases.
[08:14]
If you like this video, hit that like
[08:17]
button and don't forget to
[08:19]
subscribe. Visit codelucky.com for more
[08:22]
such useful content.
[08:27]
[Music]