[FFmpeg-user] Problem editing m4a files with ffmpeg

richard richard at richsim900.plus.com
Wed Jun 1 12:10:21 CEST 2011


On Fri May 20 Richard wrote:

>
> When I edit an m4a file using ffmpeg using command like this:
>
> ffmpeg -i filename.m4a -ss 00:02:34 -t 00:28:35 -acodec copy
> outputfile.m4a
>
> the edited file will play OK on software media players, but large m4a
> files won't play on my Marantz CD6003. The files timeout after 30
> seconds.
>
> If I use mp4creator to optimize the edited m4a file using command like
> this:
>
> mp4creator -optimize filename.m4a
>
>the optimized file plays OK on the Marantz. 
>
> I found out using AtomicParsley that editing an m4a file with ffmpeg
> moves the mdat atoms from the end of the file to near the front. This
> seems to be an issue for the Marantz. mp4creator moves the mdat atoms
> back to the end of the file again.
>
> Is this a bug in ffmpeg?

fmpeg also moves mdat atoms from the end of a m4a file to near the front
(before the moov atom) when extracting audio from a video file using:

ffmpeg -i filename.mp4 -vn -acodec copy output.m4a

So I guess ffmpeg moves mdat atoms when modifying mp4 and m4a files.
This is a problem for my Marantz CD6003 player as it seems to need to
read some metadata before it will play. If the mdat atoms are moved to
near the front of the file, it has to read through all the mdat atoms
before it reaches the metadata. That causes it to timeout after 30
seconds and will not play.

I can work around this problem using the -optimize option of mp4creator.
This puts the mdat atoms back to the end of the file (where they were
before ffmpeg moved them).

As I've received no response to this topic, I assume the ffmpeg
developers are not concerned with this issue. 




More information about the ffmpeg-user mailing list