在Android上播放RTP/TCP/AVP视频流

发布于 2024-10-07 14:19:13 字数 558 浏览 7 评论 0原文

我们正在尝试在Android平台上播放视频流,没有 成功。 使用VideoView,我们可以播放youtube移动视频(例如 这个网址工作得很好: rtsp://v3.cache7.c.youtube.com/CjYLENy73wIaLQnMYzt2FtQmqxMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYI6vr52RlLW1Sww=/0/0/0/video.3gp )

但是,我们需要播放一个流(来自给定的 RTSP url),通过该流 我们无法控制。 RTSP 服务器通过 RTSP 传递交错的 RTP/TCP/AVP 数据包。 RTSP 本身通过端口 80 上的 HTTP 隧道得到支持。 视频格式为 MPEG4-Part2 (H.263)。 而且rtsp url只能使用一次;用钥匙建造- 每次都串起来。在桌面系统上,quicktime 可以播放 流,VLC 不能。

是否可以在Android设备上播放这样的流 不知何故?

我在谷歌上搜索到内置(openCore?)RTP堆栈 支持基于 UDP 的 RTP,而不是 TCP。这(仍然)是真的吗? 我可以以某种方式绕过这个问题吗?

谢谢! 图里·安德拉斯

We are trying to play a video stream on the Android platform, with no
success.
Using the VideoView, we are able to play youtube mobile videos (e.g.
this url works just fine:
rtsp://v3.cache7.c.youtube.com/CjYLENy73wIaLQnMYzt2FtQmqxMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYI6vr52RlLW1Sww=/0/0/0/video.3gp
)

However, we need to play a stream (from a given RTSP url), over which
we have no control.
The RTSP server delivers RTP/TCP/AVP packets interleaved over RTSP.
RTSP itself is supported via HTTP tunnelling over port 80.
The video format is MPEG4-Part2 (H.263).
Moreover, the rtsp url can be used one time only; built with a key-
string every time. On a desktop system, quicktime could play the
stream, VLC could not.

Is it possible to play back such a stream on an Android device
somehow?

I read googling around that the builtin (openCore?) RTP stack only
supports RTP over UDP, not TCP. Is this (still) true?
Can I somehow bypass this problem?

Thanks!
Turi András

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一抹微笑 2024-10-14 14:19:13

如果只是 UDP,您可以将数据包转发到本地 UDP 端口(或将每个数据包转发到单独的端口,这可能会简化馈送到内置 RTP 堆栈的操作)。

VLC 无法播放可能是因为它默认不支持音频编解码器。没有更多细节很难知道。

If it's just UDP, you could forward the packets to a local UDP port (or each to a separate port, which would probably simplify things for feeding to the built-in RTP stack).

VLC not being able to play it might be due to an audio codec it doesn't support by default. Hard to know without more details.

弥枳 2024-10-14 14:19:13

我为你提供了部分解决方案。

我目前正在从事一个 Ra&D 项目,涉及从服务器到 Android 客户端的 RTP 媒体流。

通过这项工作,我为我自己的名为 smpte2022lib 的库做出了贡献,您可以在这里找到: http://sourceforge .net/projects/smpte-2022lib/

在这样的库的帮助下(Java实现是目前最好的一个),您也许能够解析来自专业流媒体设备、VLC RTP会话的RTP多播流......

我已经使用来自捕获的专业RTP流的流成功地测试了它SMPTE-2022 2D-FEC 或使用 VLC 生成的简单流。

不幸的是,我不能在这里放置代码片段,因为使用它的项目实际上受版权保护,但我保证您可以简单地通过解析 RtpPacket 构造函数帮助的 UDP 流来使用它。

如果数据包是有效的 RTP 数据包(字节),它们将按原样进行解码。

此时,我将对 RtpPacket 构造函数的调用包装到一个线程,该线程实际上将解码的有效负载存储为媒体文件。然后我将使用该文件作为参数调用 VideoView。

交叉手指;-)

亲切的问候,

David Fischer

另请参阅Android MediaPlayer 上的 RTP

I have a partial solution for you.

I'm currently working on a Ra&D project involving RTP streaming of medias from a server to Android clients.

By doing this work, I contribute to my own library called smpte2022lib you may find here : http://sourceforge.net/projects/smpte-2022lib/.

Helped with such library (the Java implementation is currently the best one) you may be able to parse RTP multicast streams coming from professional streaming equipements, VLC RTP sessions, ...

I already tested it successfully with streams coming from captured profesionnal RTP streams with SMPTE-2022 2D-FEC or with simple streams generated with VLC.

Unfortunately I cannot put a code-snippet here as the project using it is actually under copyright, but I ensure you you can use it simply by parsing UDP streams helped with RtpPacket constructor.

If the packets are valid RTP packets (the bytes) they will be decoded as such.

At this moment of time, I wrap the call to RtpPacket's constructor to a thread that actually stores the decoded payload as a media file. Then I will call the VideoView with this file as parameter.

Crossing fingers ;-)

Kind Regards,

David Fischer

See also RTP on Android MediaPlayer

我也只是我 2024-10-14 14:19:13

我正在尝试vlc,
如果您作为客户端打开 rtsp://serveradress:port/path
在vlc中端口通常是554。
我从未使用过 android,但如果你有 vlc,则必须打开网络流并输入上面的地址格式。
尝试找出发出流的端口不一定是 554。
还要确保您的防火墙不会阻止发出流的端口。

这里有一些 vlc 文档

vlc 文档vlc wiki

祝你好运

I am experimenting with vlc,
if u as a client are opening rtsp://serveradress:port/path
port is usually 554 in vlc.
I never used android but if u have vlc there you must open network stream and enter address format above.
try to find out which port stream is emitted on does not have to be 554.
also make sure your firewall does not block the port that is emitting the stream.

here you have some vlc documentation

vlc documentation and vlc wiki

Good luck

怪我太投入 2024-10-14 14:19:13

我现在正在开发这个 @ https://net7mma.codeplex.com/

它特别变得丑陋,因为 RTSP Interleaved ( RTP/AVP/TCP)需要不固定的内容长度,这不利于苹果提出的隧道方法。

据苹果@ https:/ /web.archive.org/web/20130501053040/https://developer.apple.com/quicktime/icefloe/dispatch028.html

您可以忽略内容长度,但我会看到更好的努力去使用 < code>Multi-Part/Chunked 响应选项并将每个 $ 块作为一个块发回,因为某些代理将观察内容长度中的长度并关闭连接,并且在交错 RTP 期间此操作很糟糕!

I am developing this now @ https://net7mma.codeplex.com/

It specifically gets ugly because RTSP Interleaved (RTP/AVP/TCP) requires a unfixed content length which is not good for the Tunneling Method proposed by apple.

According to Apple @ https://web.archive.org/web/20130501053040/https://developer.apple.com/quicktime/icefloe/dispatch028.html

You can ignore the Content-Length but I would see better effort going towards using the Multi-Part/Chunked response option and posting each $ block back as a chunk as some proxies will observe the length in the content-length and close the connection and during Interleaved RTP this is bad!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文