google / ExoPlayer

An extensible media player for Android
Apache License 2.0
21.65k stars 6.01k forks source link

Low latency streaming with ExoPlayer? #623

Closed Schizo closed 9 years ago

Schizo commented 9 years ago

Sorry for proposing this question here, but i was successfully using ExoPlayer as a main VOD Video-Player and i am really happy about it. Now i was going to use it to play Video-Streams but unfortunately exoplayer supports only DASH, HLS and Smoothstreaming.

But are those formats good for low-latency-streaming? Or how is the standard way of Streaming a "dash" file to a server, to browse it with a mobile phone? What are the minimum available Segment Durations. Can i set it to frames?

Please enlighten me.

ojw28 commented 9 years ago

ExoPlayer supports a bunch of formats in addition to the ones you mention (MP4, MP3, WebM, Matroska, Mpeg-TS, ADTS-AAC).

For DASH/HLS/SS you probably wouldn't want chunks any shorter than 2 seconds. For low latency streaming you'd probably want something like RTMP, which ExoPlayer doesn't support. The idea of single (or few) frame latency across the internet isn't realistic though, so I'm wondering exactly what you're trying to achieve.

Schizo commented 9 years ago

I don't want to achieve this latency over internet but in a intranet lan network. with RTMP the current latency is about 6 Frames, with UDP about 4 Frames. All in Local Network.

ojw28 commented 9 years ago

ExoPlayer isn't really geared to this use case (i.e. local playback with very low latency). We don't currently support RTMP/UDP.

winlinvip commented 8 years ago

Hi, I think the low-latency for ExoPlayer is possible, if streaming server support HTTP-FLV/HTTP-TS to replace RTMP. @ojw28 Can you re-open this issue, seems the #828 and HTTP-TS is supported by ExoPlayer.

I think the low-latency or realtime player need another important feature, the MaxBufferLength, which limit the max buffer length in seconds, drop packet or change the fps if exceed.

However, I think it's a very awesome feature for ExoPlayer to support realtime, eventhough without the MaxBufferLength.

winlinvip commented 8 years ago

BTW, I want to introduce more about the HTTP-FLV low latency live streaming for Android. I have start a Android encoder, which fetch the image from camera and encode by MediaCodec and send to SRS over HTTP POST, that is srs-sea. I plan to start a player named srs-spa, but I found ExoPlayer and this pull request, thanks very much, I have canceled the srs-spa project and linked to ExoPlayer.

It's very very important feature for low latency live streaming on Android, user can use srs-sea to publish stream to SRS and play with ExoPlayer, the latency is 1s+, it's awesome~

I test the latency, use srs-sea to publish to srs over HTTP-FLV, srs will remux the HTTP-FLV to RTMP then to HTTP-TS, finally use exoplayer to play http-ts from srs, the latency is 1s - 3s: sea exoplayer

winlinvip commented 8 years ago

Great ExoPlayer, I love this project, :+1: :+1: :+1:

erkand-imeri commented 8 years ago

Does ExoPlayer support RTMP links? Is it better than Vitamio to use?

winlinvip commented 8 years ago

@erkand-imeri Why RTMP? You can use server to remux the RTMP to HTTP-FLV.

BTW: Vitamio is not open-source, right?

erkand-imeri commented 8 years ago

Aha, great. I think Vitamio is not open-source. It's free to use for non-commercial purposes. @winlinvip: Do you think ExoPlayer is the best Android media library to use for live streaming?

winlinvip commented 8 years ago

@erkand-imeri I am the author of srs, which can used to remux rtmp to http-flv and/or hls. I think ExoPlayer is the one for android player for live streaming.