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