Workaround for broken(?) m4a files from ffmpeg, was Re: [PATCH] Output AAC as M4A for iTunes with metadata tags
Simon Nash
get_iplayer at cjnash.com
Wed Apr 13 15:39:34 EDT 2011
richard wrote:
> On Tue Apr 12 Simon Nash wrote:
>
>>> dinkypumpkin wrote:
>>>
>>> When mp4tags rewrites the MP4 metadata on save, the underlying MP4
>>> library does the arithmetic to calculate the necessary values and
>>> fill in the esds atom. From perusing the ffmpeg code, it looks like
>>> the required logic could be added, but I'm not sure it should be. I
>>> don't think zero is an incorrect value for those fields, plus it
>>> would sort of violate the codec-based model of ffmpeg.
>> This makes sense, but it doesn't explain why ffmpeg sets the
>> maxBitrate field. Where does it get the value from?
>
> In order to understand the analysis of the metadata, below are extracts
> for the files tested with the Marantz player.
>
> Bells1_noscript.m4a is the only file that doesn't play. The average
> bitrate is zero. The average bitrate in all the other files is non
> zero.
>
> test1.mp4 does not play (as the Marantz does not recognise a .mp4 file),
> but change the extension to .m4a and it plays OK.
>
> Bells1_noscript.m4a is downloaded with get_iplayer. Bells1_script.m4a is
> the same file fixed up with Jon's script.
>
> Simon can explain what the other files are.
>
> Bells1_noscript.m4a
> type ftyp
> majorBrand = M4A
> type esds
> decConfigDescr
> bufferSizeDB = 0 (0x000000) <24 bits>
> maxBitrate = 143325 (0x00022fdd)
> avgBitrate = 0 (0x00000000)
>
> Bells1_script.m4a
> type esds
> decConfigDescr
> bufferSizeDB = 620 (0x00026c) <24 bits>
> maxBitrate = 135328 (0x000210a0)
> avgBitrate = 128002 (0x0001f402)
>
> Bells1_noscript_bitrate.m4a
> type esds
> decConfigDescr
> bufferSizeDB = 0 (0x000000) <24 bits>
> maxBitrate = 143325 (0x00022fdd)
> avgBitrate = 128002 (0x0001f402)
>
This is Bells1_noscript with the avgBitrate field patched using a
hex editor.
> Bells1_noscript_bitrate_buffer.m4a
> type esds
> decConfigDescr
> bufferSizeDB = 620 (0x00026c) <24 bits>
> maxBitrate = 143325 (0x00022fdd)
> avgBitrate = 128002 (0x0001f402)
>
This is Bells1_noscript with the avgBitrate and bufferSizeDB fields patched
using a hex editor.
> test1.mp4
> type ftyp
> majorBrand = mp42
> type esds
> decConfigDescr
> bufferSizeDB = 1164 (0x00048c) <24 bits>
> maxBitrate = 329224 (0x00050608)
> avgBitrate = 320110 (0x0004e26e)
>
This is an ADTS .aac file converted to mp4 format using mp4creator
with -optimize.
> test1a.m4a
> type ftyp
> majorBrand = M4A
> type esds
> decConfigDescr
> bufferSizeDB = 1164 (0x00048c) <24 bits>
> maxBitrate = 329224 (0x00050608)
> avgBitrate = 320110 (0x0004e26e)
>
This is an ADTS .aac file converted to mp4 format using mp4creator
with -optimize and then patched using a hex editor to change the
ftyp atom major brand from mp42 to M4A.
Simon
More information about the get_iplayer
mailing list