开发者

Android: mpeg4/H.264 packetization example

I need to split mpeg4 video stream (actually from android video came开发者_开发百科ra) to send it through RTP. The specification is little large for quick reference.

I wonder if there any example/open source code for mpeg4 packetization?

Thanks for any help !


Mpeg4 file format is also called ISO/IEC 14496-14. Google it any you will find specifications. However, what you are trying to do (RTP publisher) will be hard for the following reasons:

  1. Mpeg4 has header at the end of the file. Which means header will be written out only when video stream is finished. Since you want to do real time video streaming you will need to guess where audio and video packets start/end. This will not be the same on all Android devices as they might use different video sizes and codec parameters. So your code will be device-dependent and you'll need to support and test many different devices.

  2. Some devices do not flush video data to file in regular intervals. Some only flush once a minute or so. This will break your real-time stream.

  3. There is no example code. I know because I looked. There are a few companies that do something similar, but mainly they skip RTP. Instead they progressively upload the file to their own server and then implement video/audio stream "chopping" and then insert it into their video/transcoder backend. I used to work for one of those companies and that's how we did it. AFAIK competition took similar approaches. The upside is that all complexity is on server an you do not need to update clients when something breaks or new devices arrive on the market.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜