Capture screen and mic input using FFmpeg and ALSA


Hi there,

Recently, interesting commands appeared in commandlinefu about x11grab using ffmpeg. All are very interesting commands and they did what I expected in my Debian. But only one thing is missing. While creating a screencast, If I want to speak, that should appear in the capturing stream.

Thanks to alsa and ffmpeg, they have a way to capture my laptop’s in-built mic input. So I customized the existing commands which appeared in commandlinefu and created a small script.

# simple command to capture your screen

OUTPUT="${1:?[usage] OUTPUTFILE}"

        xwininfo -root |
        grep 'geometry' |
        awk '{print $2;}'

        ffmpeg -f alsa -itsoffset 00:00:02.000 -ac 2 -i hw:0,0 \
                -f x11grab -s $(getgeometry) -r 10 -i :0.0 \
                -sameq -f mp4 \
                -s wvga \
                -y "${OUTPUT}"


Finally I created my first screencast using ‘’ script. Here is the video

Atlast, I don’t want to install one more app to create screencast. FFmpeg is with me !!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s