Discussion:
[SoX-users] Several beginner q's about Sox encoding (mp3/aac)?
christina zou
2017-02-21 03:43:36 UTC
Permalink
Hi,

I have a Raspberry Pi running Debian Jessie, as well as a MEMS I2S mic and
a Pi Camera. My mic records 32bit raw PCM audio. I am trying to stream
video and audio to Youtube Live. I am using Sox for audio recording and
encoding.

YouTube Live only accepts mp3 or aac encoded audio.

I have installed sudo apt-get install libsox-fmt-mp3, so my Sox is able to
encode mp3.

I am using this command to record and encode audio:

rec --buffer 2000000 -c 1 -r 44100 -b 32 test.mp3

/usr/bin/rec WARN formats: mp3 can't encode to 32-bit

Input File : 'mic_mono' (alsa)

Channels : 1

Sample Rate : 44100

Precision : 32-bit

Sample Encoding: 32-bit Signed Integer PCM
-------
1. I get the warning: " mp3 can't encode to 32-bit" - what should I do
about this?
2. My resultant MP3 file has small clicks and popping noises throughout. I
know this is not a problem with my mic, as I've produced AAC encoded audio
with FFMPEG that was perfectly clean. Any idea why this is happening?
3. Is it possible to compile SOX with AAC encoding support? I want to try
AAC encoding to see if that eliminates the clicks and pops.
harsh kurra
2017-02-21 06:06:46 UTC
Permalink
*3. Is it possible to compile SOX with AAC encoding support? I want to try
AAC encoding to see if that eliminates the clicks and pops .*

I used FAAD2 AAC <http://www.audiocoding.com/downloads.html> decoder to add
support for .m4a or any AAC format in SOX for my own personal use on
windows platform.

The code is available on Bitbucket repo <https://bitbucket.org/hkurra/sox>.
Post by christina zou
Hi,
I have a Raspberry Pi running Debian Jessie, as well as a MEMS I2S mic and
a Pi Camera. My mic records 32bit raw PCM audio. I am trying to stream
video and audio to Youtube Live. I am using Sox for audio recording and
encoding.
YouTube Live only accepts mp3 or aac encoded audio.
I have installed sudo apt-get install libsox-fmt-mp3, so my Sox is able
to encode mp3.
rec --buffer 2000000 -c 1 -r 44100 -b 32 test.mp3
/usr/bin/rec WARN formats: mp3 can't encode to 32-bit
Input File : 'mic_mono' (alsa)
Channels : 1
Sample Rate : 44100
Precision : 32-bit
Sample Encoding: 32-bit Signed Integer PCM
-------
1. I get the warning: " mp3 can't encode to 32-bit" - what should I do
about this?
2. My resultant MP3 file has small clicks and popping noises throughout. I
know this is not a problem with my mic, as I've produced AAC encoded audio
with FFMPEG that was perfectly clean. Any idea why this is happening?
3. Is it possible to compile SOX with AAC encoding support? I want to try
AAC encoding to see if that eliminates the clicks and pops.
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
https://lists.sourceforge.net/lists/listinfo/sox-users
--
Thanks

Harsh kurra ¯\(ツ)/¯
Erich Eckner
2017-02-21 05:52:49 UTC
Permalink
Hi,
Post by christina zou
I have a Raspberry Pi running Debian Jessie, as well as a MEMS I2S mic and
a Pi Camera. My mic records 32bit raw PCM audio. I am trying to stream
video and audio to Youtube Live. I am using Sox for audio recording and
encoding.
I doubt, your microphone really records 32 bit (even more expensive
equipment usually records 24 bit "only"). The data stream is 32 bit (as
is sox' internal stream), but the actual data is only less - maybe 24 or
16 bit.
Post by christina zou
YouTube Live only accepts mp3 or aac encoded audio.
I have installed sudo apt-get install libsox-fmt-mp3, so my Sox is able to
encode mp3.
rec --buffer 2000000 -c 1 -r 44100 -b 32 test.mp3
/usr/bin/rec WARN formats: mp3 can't encode to 32-bit
Input File : 'mic_mono' (alsa)
Channels : 1
Sample Rate : 44100
Precision : 32-bit
Sample Encoding: 32-bit Signed Integer PCM
-------
1. I get the warning: " mp3 can't encode to 32-bit" - what should I do
about this?
Some settings can't be encoded into mp3. In the past I've hit the limit
for sample rate (48k) - it seems, the bit depth is also limited.
Try reducing it to a sane value (see above).
Post by christina zou
2. My resultant MP3 file has small clicks and popping noises throughout. I
know this is not a problem with my mic, as I've produced AAC encoded audio
with FFMPEG that was perfectly clean. Any idea why this is happening?
This is probably due to a slow cpu / computing intensive encoding. I had
same issue with an old laptop and some other recording tool, when
recording to mp3, but not to wav.
I'm not sure how to circumvent this. Probably a Raspi is too slow at all?
Post by christina zou
3. Is it possible to compile SOX with AAC encoding support? I want to try
AAC encoding to see if that eliminates the clicks and pops.
I have no idea about this, but maybe it's possible.

Regards,
Erich
unosonic
2017-02-21 08:16:27 UTC
Permalink
Post by christina zou
I have a Raspberry Pi running Debian Jessie, as well as a MEMS I2S mic and
a Pi Camera. My mic records 32bit raw PCM audio.
32bit of dynamics probably does not exist on earth or in the
universe.
Post by christina zou
1. I get the warning: " mp3 can't encode to 32-bit" - what should I do
about this?
try -b 16
Post by christina zou
2. My resultant MP3 file has small clicks and popping noises throughout. I
sounds like a (typical) pi-problem. Try low latency kernel, good power supply,
external USB2 mic, not running too much at the same time, etc.
I've had some success with an external sound board (cirrus/wolfson).

bests, u.
Alexander Stephen Thomas Ross
2017-02-22 11:00:10 UTC
Permalink
Im pretty sure youtube is more flexible in audio formats it accepts.
maybe they dont say... idk but i think i uploaded vids with pcm audio
and maybe even flac. give flac in mkv container ago.

Loading...