[FFmpeg-user] Distorted audio in screencast

Cecil Westerhof Cecil at decebal.nl
Fri Apr 18 08:28:09 CEST 2014


Op Thursday 17 Apr 2014 22:04 CEST schreef LANGLOIS Olivier:

>
>> -----Original Message-----
>> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
>> bounces at ffmpeg.org] On Behalf Of Cecil Westerhof
>> Sent: Thursday, April 17, 2014 1:42 PM
>> To: ffmpeg-user at ffmpeg.org
>> Subject: [FFmpeg-user] Distorted audio in screencast
>>
>> I have a problem with a zooming sound:
>> https://www.facebook.com/photo.php?v=619250241480694
>>
>> I did not have this in the past as far as I know. But this can also
>> be because in the past I only used the microphone of the web-cam
>> (and on another computer). Which is a Logitech, Inc. Webcam Pro
>> 9000.
>>
>> The command I use is:
>> ffmpeg -async 1                         \
>> -f alsa                          \
>> -i "plughw:1"                    \
>> -f x11grab -s "800x600"          \
>> -r 25                            \
>> -i :0.0                          \
>> -acodec libmp3lame               \
>> -ac 1                            \
>> -ar 22050                        \
>> -ab 64k                          \
>> -qscale:video 4                  \
>> testing.avi
>>
>> Also sometimes the audio is a little out of sync and there are
>> sometimes sharp sounds. What should I change?
>>
> ffmpeg inputs are opened sequentially. I have found that opening
> slow input devices first could help with AV sync. OTOH, if I
> understand correctly your setup, you display a webcam output on
> screen and grab that with x11grab.

Correct, I use this because I want to integrate some graphics in  my
video. Up till now I found this the best way (for me).

But it is probably the problem, because when I use:
    ffmpeg -async 1                \
           -f alsa                 \
           -i plughw:1             \
           -acodec libmp3lame      \
           -ac 1                   \
           -ar 22050               \
           -ab 64k                 \
           $(date +%F_%T).mp3

It sounds OK. But when I do the previous command, my computer is not
very busy. So I do not really understand the problem. Is there a way
to easily mix the video from my camera with the audio from my webcam
and then also replace some parts of the video with video? That would
really solve my problem.


> This for sure add some latency in
> the video signal. There must be a way to manually add a ts offset on
> the cmdline to compensate for that.
>
> I think that your sharp sounds are caused by saturation. If you had
> ALSA buffer overruns, ffmpeg would report it and it sounds more like
> clipping. There are 2 things that I can think that you can play with
> fix this problem:
>
> 1. Check your mic preamp level with the alsamixer app.

This gives:
    This sound device does not have any playback controls. 


> 2. Use "hw:1" instead of "plughw:1" to let ffmpeg do the signal adaptation.

That gives:
    [alsa @ 0x149caa0] cannot set channel count to 2 (Invalid argument)
    hw:1: Input/output error


> What plughw is doing is to ask ALSA to adapt device hw params to
> what the app is asking (sampling rate, bits per sample, etc). You
> could check if ffmpeg is handling this better.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list