Home > linux > Capture screen and mic input using FFmpeg and ALSA

Capture screen and mic input using FFmpeg and ALSA

ffmpeg-logo

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.

#!/bin/sh
# simple command to capture your screen

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

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

captureX11()
{
        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}"
}

captureX11

Finally I created my first screencast using 'screencast.sh' script. Here is the video

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

About these ads
Categories: linux Tags: , , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: