Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.