I try to use flash player to play rtmp live streaming video. In AS3, when I set NetStream's property bufferTime = 0, the video FPS is unstable. So the picture is not continuous.
When I set NetStream's property bufferTime = 1, the video FPS is stable. But, when the network is poor, the client will trigger RTMP WAITTING message,the picture become discontinuous. After network recover, the client's buffer become bigger and bigger. I check the NetStream's property bufferLength, it's number is increased.
My question is, how can I measure the picture is real-time and continuous. When I set bufferTime=1 and the bufferLength is growing, how can I display picture as fast as it can, to control the bufferLength number under a specific value, like 2 or 3.
Appreciated any solution.
Are you using a RTMP server? if yes, first of all the server buffertime must always be set higher than the client.
Usually a bufferTime of 9 sec on the client is good for all kind of situation. NetStream bufferTime is smart enough to
estimate the network speed so if it's high the video will start as soon as possible, then during the play the buffer will continue to load
until it's full.
I think I understand what you mean, but your answer is not suitable for me.
Because my video is real-time, I tried to set bufferTime bigger than 1, like 10, when I do that, my client need to wait 10 second to display first picture.
Besides, if encountering poor network, the client throw WAITING message. After a few second recover from it. The bufferLength value is increased, the picture is not real-time, it delay.
I try to avoid this situation.
you should carefully read the NetStream doc, also learn how a real time audio/video streaming is working on the net.
in resume you complain that there are some stream interruption due to a lack of network quality/speed, so in this case
you have no choice but:
- reduce the audio/video quality as much as possible
- increase the buffer (even in realtime)
9 seconds will be never reached in case of good network. now if it is a bad network,
you will have to choose between stream interruption or latency.
unless you have a genius development idea to correct this behavior, don't hesitate to share it.
Thank you for your patience.
It's very depressed to heard that there is no a good way to solve my problem.I don't know what number my server buffertime is.But the number should be small. Our video demands to be a real-time live show, so the buffertime need to be very small, 9 second is too big.
I read NetStream API, it says if I set bufferTime=0, the stream is real-time.But I don't understand why the picture is discontinuous, the FPS number is unstable and floating.
I try to set the client bufferTime=9. It takes about 9 second to play normally. I think because my server is taking pictures in real time, so it needs 9 second to fill the client buffer. I test :
- the client(bufferTime>0) plays dozens of second video in a bad network, it will encounter many time WAITING message. Then the network becomes normal, the client bufferLength number is increasing, sometimes reaches 60(s). But the bufferLength will reduce to 1~5 eventually, even though the process takes dozens of minutes. It's very strange to my client. I check the NetStream API, the maxBufferTime is useless when the bufferTime>0. I really hope the maxBufferTime can be useful in this case, but...
- the client's(bufferTime=0) FPS value is float(I still don't know why this happen).And then it plays dozens of second video in a bad network, it will encounter many time WAITING message. Then it displays picture as soon as possible when the network becomes normal. It this type client, the bufferLength value is always samll. I think this client is real-time player, and I want to know why this client picture is discontinuous.
Is there no other way?
> .I don't know what number my server buffertime is
you should know it, or you waste your time to try to solve your issue.
Maybe you are not carefully reading my comments, so I write it again:
If you expect some stream cut to the clients that's because:
- the audio/video quality and frame per sec is too high for the client network bandwidth capacity
- As the network bandwidth is to low the buffertime is not adapted for it.
you said it's a live show, so since there is no interation between the broadcaster and the watcher it doesn't matter there is 0 sec or 30 second latency. Now if you talk about realtime 2 way communication that's another story. it really depends on the network quality of each other, but to be sure it will work in any case, again reduce the audio/video quality and the number of frames per sec
or for sure you will face of lags and cuts.
live audio video is not a small thing, some guys work on it as a full time job.
some tutorial about live streaming with rtmp:
PS: RTMFP is a better live streaming protocol since it tolerate to skip frames and keep latency low.
But I still don't know why the fps is float when I set buffertime=0. I can sure my client network bandwidth is high enough.
I think I need to learn the RTMP protocol in depth. Thanks for your help. I would be grateful if you could provide a few URLs or books about RTMP protocol in detail. I notice that adobe.com no longer provides documentation, or maybe I can't find it.