Workaround for broken(?) m4a files from ffmpeg, was Re: [PATCH] Output AAC as M4A for iTunes with metadata tags

Jon Davies jon at hedgerows.org.uk
Fri Apr 8 14:20:16 EDT 2011


dinkypumpkin did some great work putting together a patch which makes
mpeg4/m4a the default file format for aac sources, rather than raw
aac.  This works for most people but ...

On 1 April 2011 21:15, richard <richard at richsim900.plus.com> wrote:
> The m4a file did not play in the Marantz CD player.It will play after
> using EasyTag to change a tag.

I did some work off-list with Richard to try and diagnose this, and my
conclusion is that there's a bug in the mpeg4 container code in
ffmpeg, but I've yet to prove this.

I did however find some command-line tools which fix the problem, and
built a script which is called using the command option in get_iplayer
to fix up the m4a file so that it plays on Marantz CD players.  This
automates the fixup process for those still having problems.  I'm not
proposing that this becomes part of get_iplayer - it shouldn't - it's
just a workaround for this problem until someone gets to the bottom of
what's not working with ffmpeg and some players.

I'm posting this here so that if anyone else still has problems with
m4a files not playing in their favourite media player, there's a
workaround.

Unfortunately this script only works on linux, and it requires a
couple of additional programs.  If there's interest I'm happy to have
a go at a windows equivalent (I have source and windows executables
for the additional programs, it just needs the script).  Sorry, I
can't help out on macos since I don't have access to a macos system.

To install the patch on Ubuntu:

$ sudo apt-get install mpeg4ip-utils mpeg4ip-server

(from mpeg4ip-utils we need mp4info and mp4tags, and from
mpeg4ip-server we need mp4creator.  it happens that easytag uses the
same underlying mpeg4 library as these tools)

There's a script called fixupm4a.sh attached - put this anywhere you
like, I'll use /some/path/fixupm4a.sh to refer to it.

then make it executable

$ chmod a+rx /some/path/fixupm4a.sh

and set an option for get_iplayer to call it thus

$ get_iplayer --prefs-add --command "/some/path/fixupm4a.sh \"<filename>\""

(or add the following line to ~/.get_iplayer/options
command /some/path/fixupm4a.sh "<filename>"
- the quotes matter if you end up with a space in the name)

You're done.  Now every .m4a file produced by get_iplayer will have
its metadata fixed and optimised, and it plays nicely on Marantz CD
players, and still imports nicely into iTunes.

fixupm4a.sh takes a filename as a single parameter, if it's an m4a
file then it sets the artist tag to whatever the artist tag was before
(this makes mp4tags rewrite the metadata atoms, doing the fix to make
the file play), and then optimizes the resulting file to move the
metadata to the front.

Cheers
Jon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixupm4a.sh
Type: application/x-sh
Size: 1466 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/get_iplayer/attachments/20110408/db79f854/attachment.sh>


More information about the get_iplayer mailing list