File increases in size when exporting to same format

I’m using audacity in Linux Mint 19 and when I export to m4a the file increases in size from around 20 it goes to 60mb. It didn’t happen when I used audacity before in Linux Mint 18.3. I don’t know which version of audacity I used before, now I use v2.2.1.

https://forum.audacityteam.org/t/files-double-in-size-when-compressed/51245/4

What happens if you do that?

Koz

That’s an unusual format for audio, it’s more commonly used for video. Why do you need m4a audio files?

I’m not a Linux user and I rarely use M4A/AAC…

File size is directly related to bitrate. Bitrate in kbps is kilo_bits_ per second. So if you know there are 8 bits in a byte, and you know the bitrate and the playing-time you can calculate file size. This works for any audio or video format. (With the exception that embedded artwork or other metadata increases file size without affecting the audio/video bitrate… Embedded artwork can throw-off your calculations.)

So a higher bitrate gives you a bigger file and it can give you better quality (since less information is thrown-sway). But of course, you can’t improve the quality by re-encoding to a higher bitrate.*

Depending on the encoder you can select the desired bitrate** or there may be a “quality” setting and the encoder will choose the required bitrate. With variable bitrate, the bitrate is adjusted moment-by-moment so file size is related to the average bitrate.



\

  • Whenever you re-encode (lossy-to-lossy) you are doing additional “damage”. But re-encoding to a higher bitrate may minimize the additional damage. (AAC/MA4 is supposed to be less-damaged re-encoding than MP3.)

** I forget the details but there’s a bug in one of the FFMPEG AAC or M4A encoders so you may have difficulty selecting/changing the bitrate with Audacity.

I’ve gone to Edit → Preferences → Quality and I’ve selected:
Default Sample Format: 16-bit
Real-time Conversion
Sample Rate Conversion: Low Quality
Dither: None

High-quality Conversion
Sample Rate Conversion: Low Quality
Dither: None

After that I exported with format options → quality=80 and it gave 162 mb for an originally 20 mb file of 1 hour 25 minutes.



I don’t actually want to re-encode the audio I just opened it in audacity, cut some parts. I took it from 1 hour 45 minutes to 1 hour 25 minutes, then I export it to the same format. It shouldn’t be modifying the bitrate although it obviously is or else it would have a lower size than at the start. I don’t think I’m doing anything differently is something from audacity. Maybe I should download an older version so I can use it as before without this problem?

Then Audacity is not the right application. In order to perform all the editing and processing features that Audacity provides, it is necessary for the audio to be uncompressed. Therefore Audacity always decodes audio on import. This cannot be avoided with Audacity.

To avoid quality loss, you need to export from Audacity in a lossless format, such as WAV, AIFF or FLAC, but these all give very big files.

Then I do want to re-encode the audio and I don’t mind the quality loss, I just want it to have a similar or lower file size when editing a m4a file and I do not care what the final file type is, it can be mp3 or whatever, but I don’t want it to triple in size.

I got this info from the original file:

mediainfo my-audio.m4a
General
Complete name : my-audio.m4a
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (isom/mp42)
File size : 17.7 MiB
Duration : 1 h 41 min
Overall bit rate mode : Constant
Overall bit rate : 24.5 kb/s
Encoded date : UTC 2017-10-23 17:15:45
Tagged date : UTC 2017-10-23 17:15:45
com.android.version : 7.0

Audio
ID : 1
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : mp4a-40-2
Duration : 1 h 41 min
Bit rate mode : Constant
Bit rate : 24.0 kb/s
Channel(s) : 1 channel
Channel positions : Front: C
Sampling rate : 16.0 kHz
Frame rate : 15.625 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 17.4 MiB (98%)
Title : SoundHandle
Language : English
Encoded date : UTC 2017-10-23 17:15:45
Tagged date : UTC 2017-10-23 17:15:45

That is very useful - I was about to ask you for that :wink:

That is an extremely low bit rate (very low quality, very high compression, very small file size).

That’s also very helpful. I think your best option will be to export as MP3.

First, let’s fix your Preference settings:

Preferences > Quality:
Set them the same as shown here: https://manual.audacityteam.org/man/quality_preferences.html

Before exporting, set the “Project Rate” to 16000 (lower left corner of the main Audacity window).

Export as MP3 and select:
Bit rate mode = constant
Quality = 24 kbps
(Channel mode is irrelevant for mono projects - I assume that your tracks are mono).

Do expect some loss of sound quality - 24 kbps is a very low bit rate.
(“Opus” format would be better for sound quality, but is unfortunately not yet supported by Audacity)

Thanks a lot I was finally able to export it like that, it gave me the following error:
The project sample rate (44100) and bit rate (24 kbps) combination is not supported by the MP3 file format. You may resample to one of the rates below. I chose 2400 and it exported correctly.

Although I could export like this I still would like to know if I could do something to export to m4a as before so I have all the files with the same format.

You forgot this step:

You could use Audacity’s command line exporter (the “external program” option): https://manual.audacityteam.org/man/exporting_to_an_external_program.html
You may need to refer to the FFmpeg documentation to work out the correct command line options: https://ffmpeg.org/ffmpeg.html

Also note that FFmpeg has several different codecs for M4A. The available encoders are set when FFmpeg is compiled. More info here: https://trac.ffmpeg.org/wiki/Encode/AAC

Personally I think that due to the difficulties of using M4A on Linux, it would be better to use a different format, such as Opus or MP3.