Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to record desktop audio and video in an automated way. So I wrote a small multithreaded python script which basically does the following steps:

# 1.) Grab desktop audio
AUDIO_SRC=`LANG=c pactl list | grep -A2 '^Source #' | grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1`
parec --format=s16le --rate=44100 --channels=2 --device=$AUDIO_SRC out.raw

# 2.) Grap screen
ffmpeg -f x11grab -s 1024x768 -r 10 -b 2000k -i :0 out.avi

# 3.) Convert raw audio to wav
sox --norm -s -b 16 -L -r 44100 -c 2 out.raw out.wav highpass 65 lowpass 12k

# 4.) Join audio & video to flv file
ffmpeg -y -i out.avi -r 10 -sameq -i out.wav -async 1 -f flv movie.flv

Screen grabbing and audio recording are executed parallel. The problem is, that the audio of movie.flv is always delayed by about 15 seconds. Many thanks in advance.

share|improve this question

You must log in to answer this question.

Browse other questions tagged .