---
title: 'Simple video recording and editing with ffmpeg on Linux'
source: 'https://youtube.com/watch?v=7yHYH7I4o9s'
video_id: '7yHYH7I4o9s'
date: 2026-06-15
duration_sec: 0
---

# Simple video recording and editing with ffmpeg on Linux

> Source: [Simple video recording and editing with ffmpeg on Linux](https://youtube.com/watch?v=7yHYH7I4o9s)

## Summary

FFmpeg is a powerful yet straightforward tool for audio and video manipulation. This video explains how to use FFmpeg for screen recording, mic recording, and post-processing, such as overlaying a phone video onto a screen recording. The creator demonstrates their custom scripts that automate these tasks, making editing faster and more efficient than using traditional video editing software.

### Key Points

- **Why FFmpeg over OBS** [00:00] — OBS is resource-intensive and overkill for simple screen and mic recording. FFmpeg is lightweight and runs exactly what is needed.
- **What is FFmpeg** [01:16] — FFmpeg is a collection of tools for audio and video manipulation, including recording, streaming, format conversion, and applying filters.
- **Basic FFmpeg recording command** [02:07] — FFmpeg commands follow an input-output pattern. For screen recording on X11, use '-f x11grab' with coordinates and resolution. Example: 'ffmpeg -f x11grab -s 1920x1080 -i :0.0+0,0 output.mkv'.
- **Adding audio to recording** [03:37] — Add audio input with '-f alsa -i default' to record mic along with screen. Use '-acodec pcm_s16le' for uncompressed audio.
- **Recording script with hotkey** [04:14] — A shell script toggles recording on/off with a hotkey. It records screen and audio separately (MKV and WAV) for backup. Uses date command for unique filenames.
- **Noise filter on mic** [05:45] — Apply audio filter 'afftdn' with noise floor -75 to reduce white noise. Adjust based on microphone.
- **FFmpeg resource: ffmprovisr** [07:52] — ffmprovisr is a cheat sheet site for FFmpeg commands, easier than the man page. Link provided in description.
- **Post-processing script overview** [08:42] — Script crops and flips phone video, removes audio, maps audio from WAV to screen recording, draws a gray box, overlays phone video onto screen recording using complex filtering, and outputs final video.
- **Avoid re-encoding** [09:23] — Use '-c copy' to avoid re-encoding when possible, saving time and reducing errors.
- **Drawing a box with drawbox filter** [09:43] — Use 'drawbox' filter with coordinates and color to create a gray box for the phone video overlay.
- **Complex filtering for overlay** [10:02] — Use complex filter to convert color spaces (e.g., 'colormatrix') before overlaying phone video onto screen recording.

### Conclusion

FFmpeg scripts can automate repetitive video editing tasks, making the process faster and more efficient. By using simple commands and filters, you can achieve professional results without heavy editing software.

## Transcript

so FFM Peg is very simple and very
powerful and it's actually a lot more
straightforward than you might realize I
use it exclusively for my screen
recording and mic recording and then I
also use it for the postprocessing of
taking this phone video here and
slapping it into the corner of the
screen and drawing a little gray box
around that that's done entirely with
FFM Peg bass scripts and I've got my
recording script here and then I have an
additional script that's just going to
take everything and slap it all together
and give me that final video that's
going to get uploaded so I I'm going to
go over today how these scripts work how
I use ffmpeg and also the basics of
recording and some of the filter options
with it as well um I want to start by
going over why I'm not using OBS because
OBS is kind of the standard for
recording and I've gotten you know
questions asking if I'm using OBS I'm
not using OBS it's a huge program and
I'm not saying it's bad but it is just
too much for what I need all I need to
do is record my screen and record my mic
and that's it and OBS is this big tool
meant for recording and live streaming
and all of this other stuff and I just
don't need something that resource
intensive and not to mention if I try to
run it on my ThinkPad it just lags out
it is that resource intensive whereas
FFM Peg can instead just run exactly
what I need which is just the singular
recording command that I need it to be
running so um if you don't already know
FFM Peg is essentially just a bunch of
tools for audio and video manipulation
um everything from recording and
streaming to converting between formats
to applying filters onto audio and video
so for example I have a D noise filter
on my mic that is getting applied live
as I'm recording and writing to that
file so that's pretty cool and there's a
whole bunch of stuff you can do with FFM
Peg and it it really shines when you
want to be running a bunch of things
many times over and you don't want to be
you know having to open up like editing
software or you know Ken live or
whatever to actually apply those edits
since I'm running the same things every
single video I make you know I always
have to take this phone and put it in
the corner of the screen and draw a
little box around it so why would I do
that manually in an editing program when
I can just have a shell script to do it
right anyways so to record with FFM Peg
I know the commands with FFM Peg can
kind of appear intimidating at first if
you've never done anything with them but
you can break them down always into
input and output it's always going to be
an input file and an output file so if I
want to record my screen here this
screen is going to be the input and the
video file that I'm writing to is going
to be the output so I would start by
adding this- f for format X11 grab since
I'm on X and I will put the Wayland
equivalent in the description um so-
fx11 grab and then I want my input to
actually just be the second monitor here
so I'm going to start with 0 0 since
that's the top coordinate of the first
Monitor and then I'm going to add on
1920 since my first monitor is 1920 x
1080 I'm just going to add on 1920 and
then uh comma zero and then I'm just
going to give it an output file which is
uh I don't know test. MKV um and the
only other thing I want to do is just
give give a video resolution um just as
a good practice it's um better to just
give it a resolution so that way you can
just ensure you're getting the right
resolution if I go ahead and press enter
we are now recording my screen and uh it
is actually that simple the only other
thing worth mentioning if you don't know
your screen dimensions just check with X
randar and um it actually goes ahead and
tells me uh plus 1920 that is um where
I'm going to shift over that's where the
display port display actually starts
anyway so I could just cue to quit out
of this recording and then I could check
on it with you know MPV or whatever you
normally use and um yeah we've got a
screen recording perfect so if I wanted
to have audio on that recording as well
um I could go ahead and instead run this
with an extra input as um a Alon device
so I could do F uh oops falsa and- I
default and that's just going to run
with the default input device which is
my mic if you have multiple inputs then
just check and make sure you're
selecting the right one but I only have
one so I can just go with default there
and that is now recording my screen with
my mic and that is the most simple way
to record with FFM Peg um that is as
simple as just recording with one
command but of course it would be a lot
simpler to have it just run with a
hotkey which is what I normally do hence
why this recording script here so this
recording script allows me to just call
it with the hotkey and then run it to
record it toggles on and off recording
and then it also adds this little thing
in dwm Block so I can actually see if
I'm recording or not um and I just have
this bound as a hotkey so I I literally
I'm just calling this shell script with
the hotkey so um the main thing going on
here is this record function the first
thing I want to do is toggle on my
microphone since I normally leave it off
so I first toggle it on um and then I
have my two different FFM Peg commands
and I have it in two commands just
because I do want a separate audio file
for backup purposes essentially just in
case I ever did need an exclusive audio
file um so my screen recording command
is what I pretty much just explained
with the only additions of I'm setting
the frame rate to be 30 frames per
second and I'm setting the codec to be
h264 so CV is just for video Codec um
and- qp0 is for lossless quality um the
codec is actually going to it's going to
be in this MPV uh MPV MKV container
format here um MKV and MP4 and a couple
other formats are all Container formats
so if you set the codec they all support
different codecs so if you want to
actually set the codec you can do that
it's not like the codec is be determined
by the file extension so anyways I'm
setting the codec and then I just have
the file that it's going to get written
to here um and the date command is just
ensuring that every file name is going
to be unique so I'm not you know
overwriting old recordings or anything
um and then with the audio recording
part it's just getting written to a wave
file but the only thing of Interest here
is the uh audio filter which is this is
what the noise filtering um as I'm
recording is so it's just using FFM
Peg's audio filter of AFF TDN which I
have noidea idea what that stands for
but it allows for a bunch of different
noise filtering options and I'm using
noise floor of -75 but obviously that's
the kind of thing where you would want
to adjust it to your particular
microphone um mine has like kind of a
lot of white noise in it so this just
gets rid of that and it's a lot clearer
with that so um anyways that gets
written to a wave file and what I'm
doing with both of these recordings is
it's actually getting uh the P IDs sent
to temporary files so that way I
actually can check whether I am
recording or not at the end here um by
seeing if the file exists so if that
recording file exists then when the
script is called it's going to end the
recording and exit the script or if that
file doesn't exist it's going to start
recording which allows me to have just
one hotkey and always toggle on and off
the recording state with that hotkey and
obviously every time it records it's
just going to start you know a new file
uh for that particular recording and the
last thing happening in this script is
just the dwm blocks icon up here and um
credit to Luke Smith as usual for the
idea of the kill signals with dwm blocks
I don't know if it was his idea in the
first place or if he got it from
somebody else but that is where I got
the idea from so credit where it's due
um anyways I'm using just custom kill
signals to kill the recording icon block
up here um and replace it as needed and
I've gone over that a million times so
I'll just link to another video in the
description where I go over the dwm
block stuff but um I don't know the last
thing I'm doing is just sending
notifications um when I start or end
recording and this is my recording
script so it leaves me with a-wave file
and a MKV file and from there what I
have to do is take this phone video pull
it off of the phone and then combine
everything together so I have a script
to do that um and essentially I just go
to the directory that has my video files
in it I I make a new directory for the
singular video that I'm working on SLAP
everything in the directory and then
just run this script and um actually
before I go over the script I wanted to
mention this page here uh FF improviser
I guess would be how you would say it um
and this is a really really good
resource I will put it in the
description um it's got a bunch of just
like cheat sheet stuff for how to do
stuff with FFM Peg I've relied on this
site a ton for figuring out how to do
stuff because if you don't want to read
through the super thick FFM Peg man page
um this is way easier you can just skip
to what you need and it explains
commands um really really helpful site
so I will put this in the description
but anyways on to my script here and
this is where I'm going to start talking
about filters in FFM Peg a little bit
since um that is what I'm doing the
entire process is just applying
different filters so that it can then
you know take this uh screen recording
uh crop it uh flip it out remove audio
apply it onto the screencast so anyways
the first thing I'm doing is taking this
screen recording this uh sorry not
screen recording this phone recording as
an input file um and applying a video
filter I'm applying first a crop and
then a horizontal flip and you can apply
multiple videos uh video filters at once
with FFM Peg so crop comma horizontal
flip the crop dimensions are just crop
Dimensions um and the last thing I'm
doing is just removing audio since I
don't need audio from the phone video
and that outputs to this cam. mov the
next thing I need to do is map my audio
from my wave file onto my screen
recording my MKV so I'm just taking
those both as input files I'm mapping
them together and oh this is this is
pretty important this codec here is just
set to copy uh so that way I don't
re-encode the video because it is best
to avoid re-encoding a video if you
don't have to um a to save time and B
the more you re-encode the more chance
for errors Etc you're getting so um
avoid re-encoding when possible um and
then I just end up with this applied.
MKV I'm then going to draw the gray box
in the corner and that's just a video
filter for draw box um I'm just giving
it coordinates and a color and it's
going to fill up the box and then I get
this box.
MKV um then I'm going to Overlay this uh
cam. mov that got you know cropped and
flipped Etc um that's going to get
overlaid onto the screen video and I'm
using complex filtering here so that
first of all I need to actually make
sure they are in the same color space um
which is pretty important because by
default my phone video here is in a
different color space than my screen
recording so I need to make sure they're
actually converted to the same color
space um so I'm doing that here and then
after that I overlay the uh phone
recording onto the screen recording and
then that just gets exported to this
final. MKV which is what gets uploaded
to YouTube and then I just remove the
extra stuff um from the process and I
send myself a notification and this is
how I edit my videos with FFM Peg um
it's a lot easier to be able to just go
into a directory and run a script as
opposed to having to you know open up a
program like Kaden live and then import
all the files and you know rearrange
everything and then render it out it's a
lot easier just to run a script so this
is where FFM Peg really shines if you
have any sort of repetitive acction
actions that you're doing over and over
in editing you may well be able to just
replace it with FFM Peg scripts but
anyways I hope you enjoyed this video
and I'll see you next time peace
