I'm using a Raspberry pi B+ and a DAC+ ADC pro HAT to do long running recordings via the 3.5mm minijack. But I'm experiencing some issues with dropped samples resulting in massive stuttering and haven't figured out where the problem is.
I was using a command like following:
ffmpeg -loglevel debug -f alsa -acodec pcm_s16le -ac 2 -ar 48000 -i hw:0,0 ...
Also a lot of variations of parameters for acodec, ar or eg. -thread_queue_size 1024 with very similar result ( stuttering )
The error messages that I see in the output are:
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[alsa @ 0x55a23fe800] ALSA buffer xrun.peed=0.691x
My current "workaround" including piping arecord to ffmpeg is kind of stable but still doesn't allow me to eg. record with more than 48000:
arecord --dump-hw-params -v --buffer-size=192000 -D default -c $CHANNELS -r $SAMPLE_RATE -fS16_LE | \
ffmpeg -re -i - \
Preferably I would not use such workarounds and rely ffmpeg directly.
Are there any working examples on how to record good quality audio via ffmpeg + alsa? Or do you have an alternative approach that has proven to be reliable for capturing audio via ffmpeg in combination with hifiberry hardware? In particular for long running recording sessions eg. 24h . Are there certain configuration parameters that I'm not aware and might need to be provided to ensure propper recording?
I'm using Balena OS balenaOS 2.80.3+rev1
Linux 5.4.83-v8 aarch64
ffmpeg version 4.1.6-1~deb10u1
arecord: version 1.1.8
ALSA Information Script v 0.4.64
Happy to provide more clarifications / information