M4A标记问题

时间:2012-03-12 13:07:06

标签: id3 m4a

我遇到将M4A原子插入文件的问题。由于原始文件没有udta结构,我使用现有的M4A文件添加它作为指南。

以下是我添加原子所做的事情:

  1. 在内存中构建一个udta原子
  2. 更新moov原子的大小以包含udta原子的大小
  3. 将文件复制到第一个trak atom的末尾
  4. 插入我的udta原子
  5. 照常复制其余部分。
  6. 原始文件和标记文件之间唯一真正的区别是mdat原子已向下移动一点以容纳标记。这让我相信在其他原子中有一些参考这个位置,但我找不到一个。

    以下是AtomicParsley的输出:

    原始档案:

    Atom ftyp @ 0 of size: 36, ends @ 36
    Atom moov @ 36 of size: 30156, ends @ 30192
         Atom mvhd @ 44 of size: 108, ends @ 152
         Atom iods @ 152 of size: 33, ends @ 185
         Atom trak @ 185 of size: 30007, ends @ 30192
             Atom tkhd @ 193 of size: 92, ends @ 285
             Atom mdia @ 285 of size: 29907, ends @ 30192
                 Atom mdhd @ 293 of size: 32, ends @ 325
                 Atom hdlr @ 325 of size: 37, ends @ 362
                 Atom minf @ 362 of size: 29830, ends @ 30192
                     Atom smhd @ 370 of size: 16, ends @ 386
                     Atom dinf @ 386 of size: 36, ends @ 422
                         Atom dref @ 394 of size: 28, ends @ 422
                     Atom stbl @ 422 of size: 29770, ends @ 30192
                         Atom stts @ 430 of size: 24, ends @ 454
                         Atom stsd @ 454 of size: 106, ends @ 560
                             Atom mp4a @ 470 of size: 90, ends @ 560
                                 Atom esds @ 506 of size: 54, ends @ 560
                         Atom stsz @ 560 of size: 26888, ends @ 27448
                         Atom stsc @ 27448 of size: 40, ends @ 27488
                         Atom stco @ 27488 of size: 2704, ends @ 30192
    Atom mdat @ 30192 of size: 2495503, ends @ 2525695
    

    修改过的文件:

    Atom ftyp @ 0 of size: 36, ends @ 36
    Atom moov @ 36 of size: 30323, ends @ 30359
         Atom mvhd @ 44 of size: 108, ends @ 152
         Atom iods @ 152 of size: 33, ends @ 185
         Atom trak @ 185 of size: 30007, ends @ 30192
             Atom tkhd @ 193 of size: 92, ends @ 285
             Atom mdia @ 285 of size: 29907, ends @ 30192
                 Atom mdhd @ 293 of size: 32, ends @ 325
                 Atom hdlr @ 325 of size: 37, ends @ 362
                 Atom minf @ 362 of size: 29830, ends @ 30192
                     Atom smhd @ 370 of size: 16, ends @ 386
                     Atom dinf @ 386 of size: 36, ends @ 422
                         Atom dref @ 394 of size: 28, ends @ 422
                     Atom stbl @ 422 of size: 29770, ends @ 30192
                         Atom stts @ 430 of size: 24, ends @ 454
                         Atom stsd @ 454 of size: 106, ends @ 560
                             Atom mp4a @ 470 of size: 90, ends @ 560
                                 Atom esds @ 506 of size: 54, ends @ 560
                         Atom stsz @ 560 of size: 26888, ends @ 27448
                         Atom stsc @ 27448 of size: 40, ends @ 27488
                         Atom stco @ 27488 of size: 2704, ends @ 30192
         Atom udta @ 30192 of size: 167, ends @ 30359
             Atom meta @ 30200 of size: 159, ends @ 30359
                 Atom ilst @ 30212 of size: 147, ends @ 30359
                     Atom ©ART @ 30220 of size: 35, ends @ 30255
                         Atom data @ 30228 of size: 27, ends @ 30255
                     Atom ©nam @ 30255 of size: 63, ends @ 30318
                         Atom data @ 30263 of size: 55, ends @ 30318
                     Atom ©alb @ 30318 of size: 41, ends @ 30359
                         Atom data @ 30326 of size: 33, ends @ 30359
    Atom mdat @ 30359 of size: 2495503, ends @ 2525862
    

    另一点需要注意的是,我用作参考的标记文件在udta-> meta下有一个hdlr原子,但添加该标记的副本也无济于事。如果我手动删除udta原子和moov的大小数据,该文件将再次起作用。

    当我尝试播放标记文件时,我会在各种程序中收到这些错误:

    mplayer:
        [aac @ 0x204d720] channel element 0.0 is not allocated
        [aac @ 0x204d720] channel element 0.0 is not allocated
        [aac @ 0x204d720] channel element 3.13 is not allocated
        [aac @ 0x204d720] channel element 2.14 is not allocated
        [aac @ 0x204d720] channel element 2.9 is not allocated
        [aac @ 0x204d720] Prediction is not allowed in AAC-LC.
        [aac @ 0x204d720] channel element 3.1 is not allocated
        [aac @ 0x204d720] channel element 0.3 is not allocated
        ....
    totem:
        ** Message: Error: Could not decode stream.
        gstfaad.c(1319): gst_faad_chain (): /GstPlayBin2:play/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20/GstFaad:faad0:
        decoding error: Bitstream value not allowed by specification
    banshee:
        [Error 08:26:27.610] GStreamer stream error: Decode
        [Error 08:26:27.960] GStreamer stream error: Decode
        [Error 08:26:28.252] GStreamer resource error: NotFound
    

    哦,我希望其他99%的程序能够识别MP3以外的文件上的ID3标签......

1 个答案:

答案 0 :(得分:0)

感谢xdelta3,我能够找到标记有标记软件的文件与手动删除的文件和原始文件之间的区别。

问题似乎是'stco'原子,它是使用绝对文件偏移的块列表。答对了!由于我添加了标签,因此这些偏移现在无效。更多编码要做叹息