You are not logged in.

#1 2012-04-08 04:51:23

Frabato
Member
Registered: 2007-10-24
Posts: 267

[SOLVED] is m4a THAT much better than flac

Hi All,

I just picked up 186.5 mb worth of music in .m4a format and I thought I'd convert it to flac. When I did, it turned out to be over 500 mb and I thought, this is silly, so I converted it to wave and it turned out to be 1 gigabyte. Now, these conversions were done using dbpoweramp under wine. But my question is this, can .m4a really compress wave files to less than 1/5th of their size? I got flac to compress the wave files to about 1/2 of their original size, a bit over 500 mb. Does anyone know about this stuff that can help me understand what's going on here?

Thanks

Last edited by Frabato (2012-04-09 22:58:49)

Offline

#2 2012-04-08 05:03:55

Grinch
Member
Registered: 2010-11-07
Posts: 265

Re: [SOLVED] is m4a THAT much better than flac

Seems to me that the m4a files in question is using lossy compression (aac?), afaik m4a can contain both lossless and lossy audio. Flac as the name implies is lossless.

Offline

#3 2012-04-08 05:59:40

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: [SOLVED] is m4a THAT much better than flac

If I understand correctly, m4a is a container, whereas flac is a codec. This would imply that you could, theoretically, actually create files that are both flac and m4a, in much the same way as you can put xvid encoded video inside an avi file.

(This is actually covered on wikipedia, but okay, I won't worry about telling you to stfw this time, since I agree this stuff can seem a bit abstract.)

Offline

#4 2012-04-08 08:23:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] is m4a THAT much better than flac

Frabato wrote:

But my question is this, can .m4a really compress wave files to less than 1/5th of their size? I got flac to compress the wave files to about 1/2 of their original size, a bit over 500 mb

Flac usually compresses to about half the size but it does so w/o any loss of quality.
You can easily compress to 1/11th of the original wav file by coding it down to 128kbps mp3s. Need more compression - pick libvorbis-aotuv [1] and see if tiny (about 64kbps) ogg files still sound decent to you.

Offline

#5 2012-04-08 10:51:48

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,731
Website

Re: [SOLVED] is m4a THAT much better than flac

/dev/zero wrote:

If I understand correctly, m4a is a container, whereas flac is a codec. This would imply that you could, theoretically, actually create files that are both flac and m4a, in much the same way as you can put xvid encoded video inside an avi file.

**ding ding ding**

Correct answer smile

Perhaps a package like mediainfo can tell you the codec used to compress the stream inside your m4a files.

Offline

#6 2012-04-08 11:54:57

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: [SOLVED] is m4a THAT much better than flac

Check it:

I first convert a wav file into m4a,

ffmpeg -i /usr/share/sounds/alsa/Side_Right.wav -y -strict experimental -acodec aac -ar 48000 -ab 256k ./Side_Right.m4a

Now let's have a peak under its hood.

$ ffprobe ./Side_Right.m4a 
ffprobe version 0.10.2 Copyright (c) 2007-2012 the FFmpeg developers
  built on Mar 19 2012 11:26:39 with gcc 4.6.3
  configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libvo-aacenc --enable-libtheora --enable-libgsm --enable-libspeex --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug --disable-static
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './Side_Right.m4a':
  Metadata:
    major_brand     : M4A 
    minor_version   : 512
    compatible_brands: isomiso2
    encoder         : Lavf53.32.100
  Duration: 00:00:01.36, start: 0.000000, bitrate: 218 kb/s
    Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, s16, 212 kb/s
    Metadata:
      handler_name    : 

You can clearly see from the output of ffprobe that I've encoded the audio as aac. Less obviously, the container is mp4/m4a; this is apparent not just from the file extension (which I wouldn't necessarily trust), but also the major_brand field. The moral of the story is, the container (-> file extension) doesn't really have much to do with what kind of compression is taking place.

It's like if you move house, it doesn't really matter whether the removalists drive an Isuzu or a Mitsubishi, all you care about is the trade-off between them not charging you much money and them not breaking all your gear (lossy vs lossless). Of course, the kind of truck does matter if you have a strange environment such as a steep driveway or restrictive road rules (and likewise, not all containers are universally well-recognised by all devices - ogg quickly comes to mind).

Last edited by /dev/zero (2012-04-08 11:58:01)

Offline

#7 2012-04-08 13:58:51

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] is m4a THAT much better than flac

/dev/zero wrote:

If I understand correctly, m4a is a container, whereas flac is a codec.

According to wikipedia[1] flac can also be the name of the container for flac encoded files.

A simple container format for the stream, also called FLAC (or Native FLAC)

[1] http://en.wikipedia.org/wiki/FLAC#Composition


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2012-04-08 14:42:51

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] is m4a THAT much better than flac

M4a can only be a container afaik, mostly for AAC; FLAC can be both a container and a codec. So you're comparing apples and oranges.

Unless your m4a files are lossless (and at this size, it is very improbable), there is no reason to convert to FLAC. Quality will not improve; only deteriorate.

Last edited by .:B:. (2012-04-08 14:43:48)


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#9 2012-04-09 15:45:33

Frabato
Member
Registered: 2007-10-24
Posts: 267

Re: [SOLVED] is m4a THAT much better than flac

Thanks to all for the piles of replies. One reason for my confusion is that I thought m4a was always lossless. I've converted .m4a to flac many times and the flac files were always just slightly larger than the original .m4a's so when I saw the size difference here I was indeed perplexed. I ran ffprobe on one of the files but I'm not sure how to tell the level of compression. If it is compressed then I suppose I'm better off leaving it as an .m4a.
Here is the output:

ffprobe version 0.10.2 Copyright (c) 2007-2012 the FFmpeg developers
  built on Mar 21 2012 07:09:54 with gcc 4.6.3
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libdirac --disable-decoder=libdirac --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libdc1394 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 0
    compatible_brands: M4A mp42isom
    creation_time   : 2010-06-06 12:14:17
    title           :
    artist          :
    composer        :
    album           :
    track           : 1/21
    disc            : 1/2
    date            : 1966
    gapless_playback: 0
    encoder         : iTunes 9.1.1.12, QuickTime 7.6.6
    genre           : Pop/Rock
  Duration: 00:02:21.15, start: 0.000000, bitrate: 296 kb/s
    Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 287 kb/s
    Metadata:
      creation_time   : 2010-06-06 12:14:17
      handler_name    :

Should I leave the file as is. Does anyone know how to interpret this stuff?

Thanks

Offline

#10 2012-04-09 16:24:18

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] is m4a THAT much better than flac

The bitrate is often the most reliable indicator. FLAC often hits 1 Mbps; heavier MP3 encodes do ~300 Kbps.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#11 2012-04-09 17:11:04

Frabato
Member
Registered: 2007-10-24
Posts: 267

Re: [SOLVED] is m4a THAT much better than flac

OK, so the best thing is to leave these files as .m4a's. Thanks to everyone for your help!

Offline

#12 2012-04-09 17:39:21

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] is m4a THAT much better than flac

Exactly. Trying to convert a lossy format to lossless is redundant. You're not improving the quality.


PS: Here's what I wanted to say before I scrolled down and saw your reply (thought I should post it anyway since I bothered to write it):

".m4a" is just an mp4 container to indicate audio, just like ".m4v" is an mp4 container to indicate video. In fact, you can even change the extension from a (DRM-free) .m4a (or .m4v) file to .mp4 and it will work fine:

http://en.wikipedia.org/wiki/M4a#.MP4_versus_.M4A
http://en.wikipedia.org/wiki/M4v

As you can see, Apple stuck their nasty, slimy little tail into it (just like they did with ePub, but that's a different story).

FLAC's description here: http://flac.sourceforge.net/index.html. Maybe check out the FAQ.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

Board footer

Powered by FluxBB