YouTube screen capture with audio using FFMPEG

Related: YouTube Live streaming with FFMPEG

YouTube screen capture with audio is simple, cross-platform and stable using nothing more than FFmpeg. This procedure avoids annoying third party packages that might have viruses.

Consider this easy-to-use Python script for YouTube FFmpeg screen capture with audio.

The following details are not normally needed–just use the easy Python script above

YouTube screen capture with audio


ffmpeg \
-video_size 1024x720 \
-framerate 10 \
-f x11grab -i :0.0+100,200 \
-f pulse -ac 2 -i default \
-acodec libmp3lame -ar 48000 \

audio config explained

-f pulse -ac 2 -i default sends stereo audio with the default PulseAudio device.

DO NOT USE -ac 1 even with monaural audio as you’ll get lots of errors like

non-monotonous DTS in output stream 0:1;

You can list PulseAudio devices with

pactl list sources

You can control audio sources via


-acodec libmp3lame -ar 44100 encodes audio as MP3 with a 44.1 kHz sampling frequency (passing audio up to about 22 kHz, which is CD-quality).

video config explained

-framerate 10 -f x11grab -i :0.0+0,0 screengrab at 10 fps, starting in the upper left hand corner, send a 1024x720 pixel video. If your screen resolution is more than 1024x720, there would be unsent regions at the bottom and/or right side.

Compile FFMPEG

Most Linux distros have old FFMPEG versions. You can compile your own current stable FFMPEG by

git clone

sudo apt-get install autoconf automake build-essential libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libfdk-aac-dev libx264-dev yasm libmp3lame-dev libopus-dev libvpx-dev libx265-dev

./configure --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-libpulse

make -j4

make install


FFMPEG desktop capture

FFMPEG compilation

Leave a Comment