Coder Social home page Coder Social logo

Comments (11)

mekya avatar mekya commented on August 20, 2024

I see,

A quick solution, have you you realized that there is a buffer parameter that you can give at the url.

https://rtmpdump.mplayerhq.hu/librtmp.3.html

buffer=num
Set buffer time to num milliseconds. The default is 30000.

from librtmp-client-for-android.

matsujun avatar matsujun commented on August 20, 2024

I know.
But it's option of librtmp itself.

https://github.com/ant-media/LibRtmp-Client-for-Android/blob/master/rtmp-client/src/main/cpp/librtmp/rtmp.c
has I/F RTMP_SetBufferMS , but it's not jni exported
https://github.com/ant-media/LibRtmp-Client-for-Android/blob/master/rtmp-client/src/main/cpp/librtmp-jni.c

from librtmp-client-for-android.

mekya avatar mekya commented on August 20, 2024

yes you're right.

Do you need this kind of implementation urgently? In other hands, when do you need?

On the other hand, if you have chance to make a PR, I will be glad to merge it.

from librtmp-client-for-android.

matsujun avatar matsujun commented on August 20, 2024

If possibble, I want to use RTMP playback feature through ExoPlayer, but for live streaming service, latency is very important thing.
Now, the latency of RTMP on ExoPlayer is larger than that of HLS.

from librtmp-client-for-android.

mekya avatar mekya commented on August 20, 2024

Sorry for the late reply.

There should be a problem in somewhere, because latency does not exceed 3 seconds in our tests.

Which server do you use?

Regards,

from librtmp-client-for-android.

matsujun avatar matsujun commented on August 20, 2024

latency does not exceed 3 seconds in our tests

It may depend on the definition of "latency".
I mean the time between "Broadcaster do something in front of camera" and "it's displayed on screen of viewer", and our target of this "latency" is about 2-4 secs.
3 secs buffer size on librtmp is too large for us.

When I use ExoPlayer(with default setting) with RTMP extension (which use this library), it's about 3-8 seconds slower than our RTMP player for iOS.
The video is come from same broadcaster/server.
I think buffer size of librtmp (3 seconds) is one of the reason.
Additionally, ExoPlayer may have their own buffer.

from librtmp-client-for-android.

mekya avatar mekya commented on August 20, 2024

Yeah we both mean the samething for latency.

Let us check the latency one more time and post here.

from librtmp-client-for-android.

nagendraK6 avatar nagendraK6 commented on August 20, 2024

Do we have plant to add this feature?

from librtmp-client-for-android.

Brianvdb avatar Brianvdb commented on August 20, 2024

Any news on this? I am having the same issue with Exoplayer. @mekya

Did you find a solution? @matsujun

from librtmp-client-for-android.

mekya avatar mekya commented on August 20, 2024

this buffer time actually does not affect latency in RTMP. We have made some tests for @nagendraK6 :) and find out somethings. I have copied-pasted the things directly from email :)

Hey Guys,

Let me tell what I have found.  

Firstly, I digged into the native librtmp to find out somethings to reduce buffering times. Yeah I have found somethings, max buffer time for librtmp is 30sec. 
I have changed it several times, compiled native code and test it unfourtunately there is nothing changed. After all i go deeper and found out that librtmp does not care about this buffering time. It just reads data from server. 

After that I've started to look at the buffering times for ExoPlayer. After a while I found, min buffer, max buffer, play back buffer, playback rebuffer durations.

I have changed these default values by creating ExoPlayer like below
player = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, new DefaultLoadControl(
        new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE),
       500,  // min buffer 0.5s
        3000, //max buffer 3s
        1000, // playback 1s
        1000   //playback after rebuffer 1s
));

Then latency is really good on our test environment about 1.5 - 2 and no rebufferings. Source stream has 2 sec key frame interval.

However we need to be sure it also works for your real environment. 

The parameters above I've used needs to be tuned for your case. Values can be bigger or lower, just let's test on your environment and see the results. 

Btw, health of the source stream is very important.  If server does not has an healthy incoming stream, it is for sure that server does not send any stream to viewers and
rebufferings happen on viewer side. 

Regards,
A. Oguz 

from librtmp-client-for-android.

openmotion avatar openmotion commented on August 20, 2024

hello
i have the same problem, my rtmp stream has low latency when played with ffplay
but with exo player there is an important delay (3/4 seconds)
i tested your code :
DefaultAllocator allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);
DefaultLoadControl loadControl = new DefaultLoadControl(allocator, 1000, 1000, 1000, 1000, -1, true);
player = ExoPlayerFactory.newSimpleInstance(this, trackSelector,loadControl);

but not change ...

i tested to add the buffer option in my url but no improvement

  videoSource = new ExtractorMediaSource.Factory(mediaDataSourceFactory) .createMediaSource( Uri.parse(url + " live=1 buffer=0"), null, null );

this is my command with ffplay
ffplay -fflags nobuffer rtmp://xxx:1935/live/xxx -loglevel verbose

from librtmp-client-for-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.