TubeSum ← Transcribe a video

FFmpeg Tutorial for Beginners: Mastering the Command Line

Transcribed Jun 14, 2026 Watch on YouTube ↗
Beginner 5 min read For: Beginners interested in learning command-line multimedia processing with FFmpeg.
3.2K
Views
76
Likes
4
Comments
2
Dislikes
2.5%
📈 Moderate

AI Summary

FFmpeg is a free, open-source command-line tool for processing audio and video files. It can convert formats, resize video, extract audio, compress media, and apply filters. This tutorial covers basic syntax, common options, and practical examples for video and audio manipulation.

[00:00]
What is FFmpeg?

FFmpeg is a free and open-source software project with libraries and programs for handling video, audio, and other multimedia files and streams.

[00:47]
Basic Syntax

The command structure is: ffmpeg [global options] [input options] -i input_file [output options] output_file.

[01:16]
Common Options

Key options include -i (input file), -f (force format), -y (overwrite), -n (never overwrite), -c:v (video codec), -r (frame rate), -s (frame size), -b:v (video bitrate), -c:a (audio codec), -b:a (audio bitrate), -ar (audio sampling rate), -ac (audio channels), and -an (disable audio).

[03:01]
Video Conversion Examples

Convert MP4 to MKV with H.264 and AAC: ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mkv. Resize to 720p: ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4. Change frame rate to 30 fps: ffmpeg -i input.mp4 -r 30 -c:a copy output.mp4.

[04:06]
Advanced Video Operations

Extract clip without re-encoding: ffmpeg -i input.mp4 -ss 00:01:30 -to 00:02:45 -c copy output.mp4. Add watermark: ffmpeg -i input.mp4 -i logo.png -filter_complex overlay=10:10 output.mp4. Create GIF: ffmpeg -i input.mp4 -vf fps=10,scale=320:-1 -t 5 output.gif.

[05:06]
Audio Operations

Extract audio to MP3: ffmpeg -i input.mp4 -vn -c:a mp3 -b:a 192k output.mp3. Replace audio track: ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -map 0:v:0 -map 1:a:0 output.mp4. Double volume: ffmpeg -i input.mp4 -filter:a volume=2.0 output.mp4.

[06:06]
Streaming and Recording

Stream to RTMP: ffmpeg -i input.mp4 -c:v libx264 -c:a aac -f flv rtmp://server/live/stream. Record screen on Linux: ffmpeg -f x11grab -s 1920x1080 -i :0.0 -r 30 output.mp4. Record webcam on Linux: ffmpeg -f v4l2 -i /dev/video0 -t 60 webcam_capture.mp4.

[07:15]
Pro Tips

Use -c copy to avoid re-encoding. Preview with -t 10. Check codecs with ffmpeg -codecs. Reduce verbosity with -hide_banner. Always verify output quality.

FFmpeg is a versatile tool for multimedia processing. Mastering its command-line options allows efficient conversion, editing, and streaming of audio and video files.

Clickbait Check

95% Legit

"Title accurately reflects the beginner-friendly tutorial content with practical command examples."

Mentioned in this Video

Tutorial Checklist

1 00:47 Understand basic syntax: ffmpeg [global options] [input options] -i input_file [output options] output_file.
2 01:16 Learn common options: -i (input), -f (format), -y (overwrite), -n (no overwrite), -c:v (video codec), -r (frame rate), -s (frame size), -b:v (video bitrate), -c:a (audio codec), -b:a (audio bitrate), -ar (audio sample rate), -ac (audio channels), -an (disable audio).
3 03:01 Convert video format: ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mkv.
4 03:26 Resize video to 720p: ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4.
5 03:47 Change frame rate to 30 fps: ffmpeg -i input.mp4 -r 30 -c:a copy output.mp4.
6 04:06 Extract clip without re-encoding: ffmpeg -i input.mp4 -ss 00:01:30 -to 00:02:45 -c copy output.mp4.
7 04:28 Add watermark: ffmpeg -i input.mp4 -i logo.png -filter_complex overlay=10:10 output.mp4.
8 04:46 Create GIF: ffmpeg -i input.mp4 -vf fps=10,scale=320:-1 -t 5 output.gif.
9 05:06 Extract audio to MP3: ffmpeg -i input.mp4 -vn -c:a mp3 -b:a 192k output.mp3.
10 05:30 Replace audio track: ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -map 0:v:0 -map 1:a:0 output.mp4.
11 05:50 Double volume: ffmpeg -i input.mp4 -filter:a volume=2.0 output.mp4.
12 06:06 Stream to RTMP: ffmpeg -i input.mp4 -c:v libx264 -c:a aac -f flv rtmp://server/live/stream.
13 06:34 Record screen on Linux: ffmpeg -f x11grab -s 1920x1080 -i :0.0 -r 30 output.mp4.
14 06:53 Record webcam on Linux: ffmpeg -f v4l2 -i /dev/video0 -t 60 webcam_capture.mp4.

Study Flashcards (13)

What is FFmpeg?

easy Click to reveal answer

FFmpeg is a free and open-source software project for handling video, audio, and other multimedia files and streams.

00:17

What is the basic syntax of an FFmpeg command?

easy Click to reveal answer

ffmpeg [global options] [input options] -i input_file [output options] output_file

00:47

What does the -i option do in FFmpeg?

easy Click to reveal answer

It specifies the input file.

01:20

What does the -c:v option set?

medium Click to reveal answer

It sets the video codec.

01:38

How do you resize a video to 720p while keeping the original audio?

medium Click to reveal answer

ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4

03:26

How do you extract a clip from 1:30 to 2:45 without re-encoding?

hard Click to reveal answer

ffmpeg -i input.mp4 -ss 00:01:30 -to 00:02:45 -c copy output.mp4

04:06

How do you add a watermark to a video?

hard Click to reveal answer

ffmpeg -i input.mp4 -i logo.png -filter_complex overlay=10:10 output.mp4

04:28

How do you extract audio from a video to MP3 at 192 kbps?

medium Click to reveal answer

ffmpeg -i input.mp4 -vn -c:a mp3 -b:a 192k output.mp3

05:06

How do you replace the audio track in a video?

hard Click to reveal answer

ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -map 0:v:0 -map 1:a:0 output.mp4

05:30

How do you double the volume of a video's audio?

medium Click to reveal answer

ffmpeg -i input.mp4 -filter:a volume=2.0 output.mp4

05:50

How do you stream a video to an RTMP server?

hard Click to reveal answer

ffmpeg -i input.mp4 -c:v libx264 -c:a aac -f flv rtmp://server/live/stream

06:06

What command records the screen on Linux at 30 fps?

hard Click to reveal answer

ffmpeg -f x11grab -s 1920x1080 -i :0.0 -r 30 output.mp4

06:34

What is a pro tip to avoid re-encoding and save time?

medium Click to reveal answer

Use -c copy when possible.

07:19

💡 Key Takeaways

📊

FFmpeg Definition

Defines the core tool being taught, essential for beginners.

00:17
🔧

Basic Command Syntax

Foundational knowledge for all FFmpeg commands.

00:47
🔧

Common Options Overview

Lists essential flags for controlling input/output and codecs.

01:16
🔧

Clip Extraction Without Re-encoding

Demonstrates a fast, efficient method for trimming videos.

04:06
💡

Pro Tips for Efficiency

Provides practical advice to save time and improve workflow.

07:15

✂️ Creator Tools: Viral Hooks

AI-generated clip ideas for Shorts based on the transcript

What is FFmpeg?

44s

Quickly explains what FFmpeg is and its key features, hooking beginners.

▶ Play Clip

FFmpeg Basic Syntax

56s

Shows the simple command structure with a real example, making it easy to follow.

▶ Play Clip

Common FFmpeg Options

55s

Lists essential options like -i, -c:v, -r, -s, which are crucial for beginners.

▶ Play Clip

Audio Options in FFmpeg

55s

Demonstrates practical audio commands like extracting audio and converting codecs.

▶ Play Clip

Convert & Resize Video

60s

Shows real-world examples like converting to MKV and resizing to 720p, highly useful.

▶ Play Clip

[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]

⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.