Short freeze when streaming from RTMP source

When I send an RTMP feed from the DJI Go drone application (custom feed option), when viewing it via the embedded player I see a short (~1 second) freeze every 5 seconds or so - the regularity of the freeze is very consistent. I don't see this freeze when feeding RTMP from some other sources, such as FFMPeg or Wirecast. I turned on recording, and do not see the freeze in the mp4 file that was made from the drone app stream either. Any suggestions on what might be happening and if there is a workaround? If it's any help, the resulting MP4 file has the following properties:

Video
Frame width 1280
Frame Height 720
Data rate 1648 kbps
Total bitrate 1777 kbps
Frame rate 30 frames/second
Audio
Bit rate 128kbps
Channels 1(mono)
Audio sample rate 44kHz
 

Max

Administrator
Staff member
Make sure you have a good network channel between the drone application and WCS server.
It should be at least 2 Mbps. Here it looks like bandwidth is not enough and it causes freeze.
1. Try to enable RTMP buffering in flashphoner.properties
Code:
rtmp_in_buffer_enabled=true
If it helps it may point to not enough bandwidth issue.
2. Try to reduce streaming video resolution and bitrate.
If it helps it looks like bw issue again.
3. Please send us tcpdump pcap of RTMP traffic where you see the freeze.
 
rtmp_in_buffer_enabled=true didn't change anything. Also I tried with the MSE and WSPlayer check boxes, and though there was the 5 second lag, there were no freezes. And just to point out again, the mp4 created on the server from the RTMP input doesn't have lags, so it doesn't seem that bandwidth would be the issue. The time between freezes is very consistent and always present- about 5 to 6 seconds.
 

Max

Administrator
Staff member
Hi,
Please, provide following data:
- 1-2 minutes tcpdump of rtmp stream;
- server and client logs of this stream;
- server and client logs of subscriber;
To enable client logs in debug mode add this property to flashphoner.properties:
Code:
 client_log_level=debug
 

Max

Administrator
Staff member
Hello

WCS server is writing logs for each connected client.
For example, if you connect using ffmpeg over RTMP (publishing connection), server will write server logs associated with this connection at
Code:
WCS_HOME/logs/client_logs/2017-11-22/{login}-{time}
here {login} is unique identifier of connection.

If you connect from browser to play stream (subscriber), server creates similar folder for subscriber. WCS_HOME/logs/client_logs/2017-11-22/{login_subscriber}-{time}
So eventually you have two debug logs
  • publisher debug log
  • subscriber debug log
The publisher's log says how traffic is received and processed.
The subscriber's log says how traffic delivered to the subscriber.
 
I have (hopefully) created the correct logs and sent them to your log email address. Let me know if you need additional information.
 

Max

Administrator
Staff member
It can be seen from the dump that there are ~1.5 second gaps in the stream.
Please try increasing RTMP buffer size adding this setting to flashphoner.properties and increasing its value
Code:
rtmp_in_buffer_initial_size=2000
The value is in milliseconds; by default it is set to two seconds.
 

Attachments

It can be seen from the dump that there are ~1.5 second gaps in the stream.
Please try increasing RTMP buffer size adding this setting to flashphoner.properties and increasing its value
Code:
rtmp_in_buffer_initial_size=2000
The value is in milliseconds; by default it is set to two seconds.
Thanks. So the 2000 in the above setting is the same as the default, correct? And we can try increasing that as needed?
 

Max

Administrator
Staff member
Yes you can extend initial buffer to accumulate more RTMP packets. 2000ms is default value.
You can set 5 seconds, 10 seconds, etc.
 
I tried both 10000 and 20000, restarting wc5 server after each change, but still get the same behavior at the same interval - about every 5 or 6 seconds.
 
Also just a reminder of a couple of things I posted earlier - I tried using the MSE and WS playback options rather than WebRTC, and although there was a 5 second delay overall, there were no freezes.
 

Max

Administrator
Staff member
Adaptive buffering is used for MSE and WSPlayer, therefore may be no freezes. Do the freezes occur if play as Flash, or if play the RTMP stream in VLC player?
 
How would I play the RTMP stream in VLC player? I would think I would have to target an RTMP server from the DJI app.
I couldn't find a browser that worked with Flash, even for other streams (i.e. FFMPeg test streams).
 

Max

Administrator
Staff member
MSE and WS playback options rather than WebRTC, and although there was a 5 second delay overall, there were no freezes.
As you noted, MSE player has 5 seconds delay with no freezes. It is because MSE player is buffering video gaps in your initial RTMP stream.
WebRTC player has low-latency buffers and that's why WebRTC drops packets if the packets are arriving too late.
Therefore, even if we implement adaptive server-side buffer, it will introduce about 5 seconds delay for WebRTC too.
So the question is would you consider MSE for streaming?
Because source stream is choppy and it will cause either freezes or latency regardless used technology (MES or WebRTC).
Is there way to fix the stream source to get more steady RTMP stream with no gaps?
How would I play the RTMP stream in VLC player?
Means try to open rtmp://wcshost:1935/live/streamName in VLC to check stream gaps
However VLC has large playback buffers too, so it should play smooth with 5 and more seconds latency
 
We want to be able to stream to iOS (Safari) and Android device, so I don't think MSE is an option for iOS is it? What protocol besides WebRTC should work on Safari - just WSPlayer?
 
Top