Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Audio format where silence would not affect file size

Tags:

audio

mp3

ogg

m4a

I'm looking for an audio format where a silence of a couple of hours at the beginning does not affect the overall file size. Has anyone any idea which one to use and what settings I have to use? I tried m4a, ogg and mp3 so far with no luck. An audio sample with 4 hours of silence in the beginning leads to a 400 MB file in some formats.

like image 416
Benjamin Paap Avatar asked Oct 06 '16 08:10

Benjamin Paap


People also ask

Which audio format consumes less space?

Advanced Audio Coding or AAC files (also known as MPEG-4 AAC), take up very little space and are good for streaming, especially over mobile devices.

What factors affect the file size of an audio file?

A number of factors can affect the size of a sound file and the quality of its playback. These include the sample rate, sample resolution and the way that the file is compressed. When you speak or play music into a microphone, the microphone takes the sound waves and converts them into a voltage.

Is MP3 or WAV better?

In general, WAV files are better quality than MP3 files, but this isn't always the case if the WAV file has been compressed. A lossless WAV file is always best for recording and for carrying high-quality audio files. MP3 files are not bad quality but WAV is more elite.

What takes up less space MP3 or WAV?

MP3 files are between five and 10x smaller than WAV files, which means they take up less space on your storage device. That's the whole point of compressed files! There are a few benefits of using smaller files: Pay less to store your audio.


1 Answers

Of course, dealing with it programmatically would be the more sensible and SO way, something like SoX and the silence/pad effects. After all, any bit of silence is identical to any other bit of silence, trying to compress it is a bit of waste of effort.

Having said that, I was a little curious about this myself so I had a go at comparing how well the different codecs fared at compressing pure digital silence.

I created two test files. The first was a 44.1kHz 16bit 30 minutes long stereo WAVE file containing uncorrelated brown noise at -10.66 dBFS RMS. The second file was the same, except padded with 210 minutes of silence, making the total duration 240 minutes (or 4 hours). Next I encoded the files to various lossy and lossless codecs and looked at the size difference between the padded and unpadded files to gauge how efficiently the silence was encoded.

enter image description here

 codec    noise  noise.silence      diff  ratio
   wav    317.5         2540.0    2222.5    8.0
he-aac     14.6          116.5     101.9    8.0
vorbis     36.4          237.1     200.7    6.5
   mp3     38.2          217.2     179.0    5.7
  opus     27.0           81.6      54.6    3.0
   tta    213.8          544.1     330.3    2.5
   aac     54.0          131.7      77.7    2.4
    wv    211.3          444.1     232.8    2.1
  alac    212.5          393.7     181.2    1.9
  flac    211.5          404.8     193.3    1.9
   als    209.7          384.2     174.5    1.8
   ofr    209.3          356.9     147.6    1.7

Codecs used:

Lossless
wav:    WAVE
tta:    True Audio v3.4.1
wv:     WavPack v4.80.0 (wavpack -x)
alac:   Apple Lossless
ofr:    OptimFROG v5.100 (ofr --preset 2)
als:    MPEG-4 Audio Lossless Coding v23 (mp4alsRM23 -a -b -o50)
flac:   Free Lossless Audio Codec v1.3.1 (flac -8)

Lossy vbr
mp3:    LAME MP3 v3.99.5 (lame -h -V2)
opus:   Opus v1.1.2 (opusenc --bitrate 128 --framesize 40)
aac:    Advanced Audio Codec v2.0 (afconvert -f 'm4af' -d aac -q 127 -s 3 -u vbrq 100)
vorbis: Vorbis aoTuV b5.5 (oggenc -q 5)

Lossy cbr
he-aac: High-Efficiency AAC v1 (afconvert -f 'm4af' -d aach -q 127 -s 0 -b 64000)
like image 138
AkselA Avatar answered Oct 08 '22 22:10

AkselA