开发者

playing RTP/TCP/AVP video stream on Android

开发者 https://www.devze.com 2023-01-30 10:16 出处:网络
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.

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; bu开发者_StackOverflow社区ilt 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


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.


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


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


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!

0

精彩评论

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