Victor Basso
Victor Basso

Reputation: 5796

Crackling sound when recording audio with ffmpeg

I'm trying to record from a microphone and webcam on MacOS with the following command:

ffmpeg -f avfoundation -framerate 30 -i "0:0" ~/recorded.mp4

My result has crackling in the audio.

I'm familiar with this problem when you use a DAW: you solve it by increasing the sample buffer. The idea is that audio samples coming from your interface/mic are not coming in a consistent or fast enough rate, so the missing samples being filled with zeroes causes the crackling sound. To avoid missing samples you want the recording software to wait longer for samples accumulating in a buffer before they're processed.

How can you configure such buffer for ffmpeg?

Upvotes: 5

Views: 2247

Answers (2)

Chris Spiegl
Chris Spiegl

Reputation: 363

It seems to me that giving the -aq 0 audio quality parameter reduces this issue.

ffmpeg -f avfoundation -i 0:0 -acodec pcm_f32le -ar 48000 -aq 0 output.wav

Upvotes: -1

Devin Roth
Devin Roth

Reputation: 53

Version 4.3 seems to have this issue. Try with 4.2.

Upvotes: 1

Related Questions