MP4/ISO 14496-12:如何找到视频和音频访问单元? [英] MP4 / ISO 14496-12 : How do you find the video and audio access units?

查看:74
本文介绍了MP4/ISO 14496-12:如何找到视频和音频访问单元?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写用于检查MP4文件(又称ISO基本媒体文件格式,ISO 14496第12部分)的工具.

我可以解释OSS生成的ISO 14496-12中列出的大多数框. 我还没有弄清楚如何提取单个视频访问单元和音频访问单元.

我有理由相信,"mdat"框中的H.264视频在NAL单元上没有ISO 14496-10附件B"0x000001"前缀.

我已经尝试过解释SampleToChunkBox('stsc'),SampleSizeBox('stsz')和ChunkOffsetBox('stco')来定位"mdat"内部的媒体样本,但是我似乎找不到任何东西我可以解释为nal_unit()(ISO 14496-10第7.3.1节)或slice_header()(第7.3.3节).

我也很好奇SPS(7.3.2.1)和PPS(7.3.2.2)的位置.我怀疑它们住在"trak"框内的某个位置,但是我还没有弄清楚在哪里.

指向应用程序或库的指针用途有限.我正在编写一个应用程序,与数学解释相比,外部源代码更难理解(被其自身的框架所束缚).

解决方案

花了几个小时讨论了关于stackoverflow的其他问题之后,我最终偶然发现了简短的回答,使我得到了更全面的答案.

在mdat MP4中解析H264

ISO涵盖了H.264在ISO媒体文件中的封装 14496第15部分.SPS和PPS存放在"avcC"框中 记录在5.3.4.1.2和5.2.4.1.1中.这个方块也告诉 您解释样本时长度字段的长度.

样本已在5.2.3节中记录,并由一系列 NAL单位以长度为前缀. ffmpeg的MP4示例有一个 每个样本切片,但第一个样本包含SEI 包含记录H.264编解码器版本和 编码参数.

I am writing a tool for inspecting MP4 files (aka ISO base media file format , ISO 14496 part 12).

I can interpret the majority of the boxes listed in ISO 14496-12 that are generated by OSS. I have yet to figure out how to extract individual video access units and audio access units.

I'm reasonably confident that the H.264 video in the 'mdat' box does not have the ISO 14496-10 Annex B "0x000001" prefix on the NAL units.

I have experimented with interpreting the SampleToChunkBox('stsc'), SampleSizeBox('stsz'), and ChunkOffsetBox('stco') to locate media samples inside the 'mdat', but I can't seem to find anything that I can interpret as a nal_unit() (ISO 14496-10 section 7.3.1) or a slice_header() ( section 7.3.3 ).

I am also curious where the SPS (7.3.2.1) and PPS (7.3.2.2) live. I have a suspicion these live somewhere inside the 'trak' box, but I haven't figured out where.

Pointers to applications or libraries are of limited utility. I'm writing an application, and external source code is harder to understand (being encumbered by its own framework) when compared to a mathematical explanation.

解决方案

After spending a couple of hours shoveling through other questions on stackoverflow, I eventually stumbled upon brief responses that led me to a more comprehensive answer.

Parsing H264 in mdat MP4

The encapsulation of H.264 within ISO media files is covered by ISO 14496 part 15. The SPS and PPS are stashed in the 'avcC' box documented in section 5.3.4.1.2 and 5.2.4.1.1. This box also tells you how long the length fields are when interpreting the samples.

The samples are documented in section 5.2.3 and consist of a series of NAL units prefixed by a length. An example MP4 from ffmpeg has one slice per sample, but the very first sample includes an SEI containing text documenting the version of the H.264 codec and the encoding parameters.

这篇关于MP4/ISO 14496-12:如何找到视频和音频访问单元?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆