Parsing h.264 NAL units from a quicktime MOV file

心不动则不痛 提交于 2019-12-06 04:23:27

问题


I'm trying to get h.264 NAL units from a MOV file on the iPhone, in order to RTP h.264 video from the iPhone camera to a server.

Apple's API does not allow direct access to the encoded bitstream from the camera output, so I can only access the MOV file, while it's being written.

I've parsed the MOV file into Atoms, according to Apple's MOV structure reference but now i need to extract the NAL units from the mdat atom in order to pack it to RTP and stream it.

I'd be glad for some help here because i can't find documentation about the mdat structure. Thanks!


回答1:


The mdat atom is a big blob of data that makes no sense on its own. To understand its contents, one must first parse the moov atom. You said that you decomposed the MOV files into atoms-- did you dig deeper than just moov, mdat, ftyp, and a few other top-level atoms? You have to parse the moov atom (lots of atoms in there) to get the data you need (extra codec data attached to the H.264 stsd atom which is combined with data from the H.264 chunks, which are indexed by the stco or co64 atoms).

Or use a library that already does all the tedious work for you.



来源:https://stackoverflow.com/questions/11717538/parsing-h-264-nal-units-from-a-quicktime-mov-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!