【发布时间】:2017-02-14 14:15:28
【问题描述】:
我正在尝试将音频上传到 S3,但我有点困惑我应该将我的 mime 类型声明为什么。我的音频文件是在 iphone 上录制为 kAudioFormatMPEG4AAC 的 m4a。这会被视为audio/m4a 还是audio/mp4?我在网上看到相互矛盾的答案。
【问题讨论】:
标签: ios audio core-audio
我正在尝试将音频上传到 S3,但我有点困惑我应该将我的 mime 类型声明为什么。我的音频文件是在 iphone 上录制为 kAudioFormatMPEG4AAC 的 m4a。这会被视为audio/m4a 还是audio/mp4?我在网上看到相互矛盾的答案。
【问题讨论】:
标签: ios audio core-audio
m4a 中的m4 是MPEG-4 的简写,就像mp4 是MPEG-4 的简写一样。
实际上,m4a、m4v 和mp4 文件都具有相同的内部MPEG-4 原子结构。文件之间的区别在于它们的内容(视频文件有视频原子和音频原子。)
尽管使用相同的文件扩展名,音频的编解码器也可能不同,例如alac 和AAC 格式都使用MPEG-4 容器格式和m4a 文件扩展名。
所以要回答你的问题,这真的没有太大区别。我个人的偏好是audio/mp4,因为这实际上是在说
MPEG-4 容器中的音频数据
而audio/m4a 就像在说
MPEG-4 容器中包含音频的音频数据
【讨论】:
使用audio/mp4。 audio/m4a 可能有效,但无效。
2. Selection of MIME Types for MP4 Files The MIME types to be assigned to MP4 files are selected according to the contents. Basic guidelines for selecting MIME types are as follows: a) if the file contains neither visual nor audio presentations, but only, for example, MPEG-J or MPEG-7, use application/mp4; b) for all other files, including those that have MPEG-J, etc., in addition to video or audio streams, video/mp4 should be used; however: c) for files with audio but no visual aspect, including those that have MPEG-J, etc., in addition to audio streams, audio/mp4 may be used. In any case, these indicate files conforming to the "MP4" specification, ISO/IEC 14496-1:2000, systems file format.
此外,the list of standard MIME types 包括 audio/mp4,而不是 audio/m4a,非标准 MIME 类型应包括“x-”,如 audio/x-m4a。
【讨论】:
.m4a 是 MP4 容器的非标准扩展。
在 2021 年对我来说,audio/mp4 .m4a 文件在 Firefox + Chrome (Linux)、Opera (Android) 上工作,但在 iPhone Safari 上不工作。对于某些格式,操作系统由于编解码器而发挥作用。
我使用了一个带有类型属性集的源标签,我还在流/下载文件的Content-Type 标头中设置了相同的类型。
另见:How to play .m4a with HTML5 audio in IE(9+) and Safari (Pad)?
【讨论】: