How to record audio with ffmpeg on linux?

I realise this is a bit old. Just in case anyone else is looking:

ffmpeg -f alsa -ac 2 -i default -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg

This way it will use the default device to record from. You were also missing a -i before the video capture device - /dev/device0

If you want to get more specific you should take a look in /proc/asound. Check the cards, devices, pcm files and the card subdirectories. You should be able to glean enough information there to be able to make an educated guess; e.g hw:1,0 or hw:2,0

The documentation may provide further clues:

  • http://www.alsa-project.org/main/index.php/DeviceNames

The same goes for the webcam - it may not be /dev/video0, perhaps you have an external webcam plugged in and its at /dev/video1 - Have a look in the /dev directory and see whats available


solved !

ffmpeg -f pulse -ac 2 -i default -f x11grab -r 30 -s 1920x1080 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 0 -y /media/t/TBVolume/desktop/output.mkv