iizukanao / picam

Audio/video recorder for Raspberry Pi with language agnostic API
GNU Lesser General Public License v2.1
488 stars 78 forks source link

Audio sounds in slow motion #183

Open Regradert opened 1 year ago

Regradert commented 1 year ago

Hello. I have recently purchased another audio card for my Raspberry Pi, a Sound Blaster Play! 3 but the audio sounds like it's playing in slow motion. I have tried changing the samplerate and there is no difference, I have also adjusted different bitrates and nothing.

I have two cards, with the previous one it sounds perfectly, but with this one it sounds like this and it's very strange. I have made a test audio recording outside of Picam:

arecord -f S16_LE -c 2 -d 10 -r 44100 --device="hw:1,0" /home/pi/test.wav

And it sounds perfect, no slow motion sound, but with Picam I have this problem. What could be happening?

iizukanao commented 1 year ago

Does your sound card's microphone have any special specifications compared to a regular USB microphone? One alternative is to create a virtual ALSA device instead of use hw:1,0 directly.

Regradert commented 1 year ago

Hi mate @iizukanao The microphone is a normal minijack, with the other card I have it works perfectly. The other card is this one, it's a very basic one but it works fine, I also have a micro usb and it works fine too. It is rare that Creative has this problem:

https://www.mytrendyphone.es/images2/USB-Sound-Card-14052015-01-p.jpg

I am going to try to create a virtual device as you say and I will tell you about it. Thank you very much.

brainrecall commented 1 year ago

I had the same issue, and a virtual device fixed it.

For those who are looking how to do this, create a file at ~/.asoundrc

Then add the following:

pcm.blaster {
  type plug
  slave {
    pcm "hw:2,0"
    channels 2
  }
  route_policy sum
}

Adjust the hw:2,0 line to match your sound card number.

Then reboot, and use --alsadev blaster for picam.

tmqian commented 5 months ago

Hello! Thanks so much for developing and supporting this awesome app! I am also having the same issue with slow audio.

I tested the mic with arecord -f S16_LE -c 2 -d 10 -r 44100 --device="hw:1,0" /home/pi/test.wav as above, and the file sounds normal.

So it is something about picam. I am using HLS.

The above virtual device fix doesn't work for me. I find that my .asoundrc gets deleted during/after reboot. The next time I try to run with --alasdev blaster there is no audio at all.

This is my picam command sudo /home/pi/picam/picam -o /run/shm/hls --samplerate 44100 --channels 2 –audiobitrate 96000 --time --vfr --autoex --alsadev blaster > ~/picam.log 2>&1

T-Vandehey commented 5 months ago

Hi, I also have been having the same issues the last few days of playing around with this library. Super down-pitched or slowed down audio, while the video is great.

I don't think that virtual sound device works in the same way anymore with the new pi OS bookworm. I see it get deleted on boot also. If anyone knows an alternative workaround for the issue, please let us know.

I am using this USB soundcard and 2 channel mics: Andrea Communications C1-1021450-100 USB-SA