安卓:MPEG4 / H.264分组例如 [英] Android: mpeg4/H.264 packetization example

查看:181
本文介绍了安卓:MPEG4 / H.264分组例如的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要拆分MPEG4视频流(实际上是从机器人摄像机)将其通过RTP发送。 该规范是有点大,快速参考。

I need to split mpeg4 video stream (actually from android video camera) to send it through RTP. The specification is little large for quick reference.

我不知道是否有任何例子/开源$ C ​​$ c表示MPEG4分组?

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

感谢您的帮助!

推荐答案

Mpeg4的文件格式也被称为ISO / IEC 14496-14。谷歌,任何你会发现规范。 但是,你正在努力做的事情(RTP发布者)将很难有以下原因:

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已经在该文件的末尾首部。这意味着头将写出只有当视频数据流结束。既然你想要做的实时视频流,你需要去猜测,其中的音频和视频数据包开始/结束。这会不会是相同的所有Android设备,因为他们可能会使用不同的视频大小和codeC的参数。所以,你的code将是设备相关的,你会需要支持和测试许多不同的设备。

  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.

有些设备不刷新的视频数据,在定期的文件。有的只刷新一次,一分钟左右。这将打破你的实时数据流。

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.

有没有例如code。我知道,因为我看了。有一些公司做同样的事情,但主要是他们跳过RTP。相反,他们逐渐将文件上传到自己的服务器,然后实现视频/音频流斩,然后将其插入自己的视频/反codeR后端。我曾经工作的公司之一,这就是我们如何做的。 AFAIK竞争也采取了类似的做法。有利的一面是,所有的复杂性是在服务器中,你不需要更新客户端的东西时,休息或新设备进入市场的。

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.

这篇关于安卓:MPEG4 / H.264分组例如的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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