How can I play AAC (.m4a) music files?

119 views
Skip to first unread message

Andre Maximo

unread,
Nov 13, 2008, 12:18:03 PM11/13/08
to pyglet-users
Hi,

I'm trying to write a media player with PyGLET and it can play mp3
files fine. The problem is when I tryed to play a .m4a file, also
called AAC file, which generally comes imported from audio CD musics.
How can I play it?

Thanks,
André

Tristam MacDonald

unread,
Nov 13, 2008, 2:50:30 PM11/13/08
to pyglet...@googlegroups.com
AAC files are an Apple-specific format, and tend to be generated by iTunes when it imports CDs. You can change iTunes' preferences to import as MP3 instead, and the same setting enables you to convert existing AAC tracks to MP3 (try the 'Advanced' menu -> 'Create MP3 Version'). Quicktime Player Pro can also be used to perform the conversion.

As for playing them directly in Pyglet, I am afraid that AVBin doesn't support an AAC codec - nor is it likely too in the immediate future, due to licensing issues.

- Tristam

Andre Maximo

unread,
Nov 13, 2008, 4:44:03 PM11/13/08
to pyglet-users
Hello Tristam,

The problem is that I already have a set of music databases which
have many AAC files (true enough because all of these databases comes
from iTunes). Looking around the web, I found this project:
http://code.google.com/p/quodlibet/

Maybe there is the answer to all riddles :) I'm thinking in using a
part of this Quod Libet project, which uses Mutagen, to play AAC
files.

--André.

Tristam MacDonald

unread,
Nov 13, 2008, 4:59:47 PM11/13/08
to pyglet...@googlegroups.com
On Thu, Nov 13, 2008 at 4:44 PM, Andre Maximo <and...@gmail.com> wrote:

Hello Tristam,

 The problem is that I already have a set of music databases which
have many AAC files (true enough because all of these databases comes
from iTunes).
Fair enough, although bulk conversion may still be your best bet. 

FFmpeg (of which AVBin is a wrapper) already contains an AAC codec, but it can't be included in the AVBin distribution because the codec has a license which is incompatible with the LGPL. You may be able to build a personal copy of FFmpeg which includes this codec, as long as check licensing issues before distributing.
 
Looking around the web, I found this project:
http://code.google.com/p/quodlibet/  
Maybe there is the answer to all riddles :) I'm thinking in using a
part of this Quod Libet project, which uses Mutagen, to play AAC
files.
That should work too, although you will end up with a fair amount of duplicated functionality. 

Ignatius Reilly

unread,
Nov 14, 2008, 4:55:34 AM11/14/08
to pyglet-users
AAC is not an Apple-specific format -- it's part of the MPEG-4 spec.
There are open source decoders available (FAAD is one example). Why
would licensing issues prevent MPEG-4 support but allow MPEG-1 support
(MP3 is part of the MPEG-1 spec)?

Alex Holkner

unread,
Nov 14, 2008, 5:39:43 AM11/14/08
to pyglet...@googlegroups.com
On Fri, Nov 14, 2008 at 8:55 PM, Ignatius Reilly
<chad.alexan...@gmail.com> wrote:
>
> AAC is not an Apple-specific format -- it's part of the MPEG-4 spec.
> There are open source decoders available (FAAD is one example). Why
> would licensing issues prevent MPEG-4 support but allow MPEG-1 support
> (MP3 is part of the MPEG-1 spec)?

The issue with licensing is that up until recently, FFmpeg only
supported AAC decoding by reusing parts of FAAD, which is GPL
licensed. If AVbin were built with this support enabled, AVbin would
not be redistributable except under the GPL; and pyglet cannot be
redistributed if it links to a GPL library without itself being GPL
(it is currently BSD, to allow for commercial use and wider 3rd party
library support).

In summary, it's the FAAD license that conflicts with pyglet, nothing
to do with the MPEG standard. I believe recent contributions to
FFmpeg have provided it with an LGPL (pyglet-compatible) AAC decoder,
which should be available in the next AVbin/pyglet release.

Note that a similar issue exists for decoding AC3; and similarly, I
believe an LGPL decoder has been added recently.

Cheers
Alex.

Andre Maximo

unread,
Nov 15, 2008, 6:36:02 AM11/15/08
to pyglet-users
Ok, thanks Alex, :)

But how can I included the AAC decoder from FFmpeg into my pyglet
version, before the next release? I see in the news -- August 21 -- on
the FFmpeg site ( http://ffmpeg.mplayerhq.hu/ ) that the AAC decoder
is already there, though with some bugs.
Is there some way that I can just add or change some pyglet .py
file, and search for FFmpeg codecs instead of AVbin? I'm really noob
in this area, so I'm probably being foolish about this matter. :-P

Best regards,
André.


On Nov 14, 8:39 am, "Alex Holkner" <alex.holk...@gmail.com> wrote:
> On Fri, Nov 14, 2008 at 8:55 PM, Ignatius Reilly
>
Reply all
Reply to author
Forward
0 new messages