In seven cows do live SDK for over a year now, help customers to solve a variety of problems, such as live caton, Mosaic, flower screen, black screen, noise, and so on great is not synchronized, this among them, some network reasons, some customers use pose problems, some parameters configuration errors, of course, there are some is the SDK itself.

To sum up, if developers can have a deeper understanding of the basic knowledge of the live streaming field and master some basic obstacle removal methods, many problems can be solved quickly by themselves, and even better prevented in the future.

Therefore, with this series, I want to gradually share the practical experience of helping our live broadcast customers to solve problems over the past year, and also interspersing some basic knowledge and optimization experience of audio and video development, sincerely hoping to help developers in the field of live broadcast.

Topics covered in this series include, but are not limited to, the following:

Playback failure Live broadcast stutter first turn on slow delay high tone painting out of sync Mosaic serious play black screen, splintered screen, green screen Play Noise, noise, echo on demand drag No live broadcast Heat problem Other problems (to be continued)


In the first article, we will start from the playback, because the most important part of watching live broadcast is to turn on the player, and direct feedback of many problems also comes from the audience.

There are many reasons for playback failure, not necessarily the player itself, but with the player, it’s easy to reverse the search for server or streaming problems. Below, we will discuss the performance of playback failure, troubleshooting tools for playback problems, and analysis of common problems.


Performance of playback failures The performance of playback failures includes but is not limited to the following:

  1. “Loading” is displayed all the time on the interface, or an error message indicating playback failure is displayed.
  2. [Fixed] The playback screen is stuck, but the UI button can be clicked
  3. Sound without picture, picture without sound.

There is no discussion of issues such as playback stutters, out of sync, mosaics, delays, screen splintering, etc. These topics will be discussed in a later article. The focus of this article is: Why can’t you smoothly “open” the live stream?

Play the troubleshooting tool for the problem

Once we encounter a video cannot play, the first thing is to find several other players to play it, do a comparison test, or do some basic analysis of the code stream, so as to better locate the source of the problem. Common playback/analysis tools on various platforms are as follows:

  • Command line tools: FFplay, FFProbe, Mediainfo, HLS-Analyzer, etc
  • Web tools www.cutv.com/demo/live_t… www.ossrs.net/players/srs…
  • App application: VLC, VPlayer, MXPlayer, etc
  • Windows tools: MP4Info, FlvParse, FLVMeta, Elecard StreamEye Studio, etc

Troubleshooting common playback failures Basic concepts

Generally, there are the following steps from passing the playing address to the player to displaying the playing picture:

  1. DNS resolution: Resolves the domain name in the broadcast address to the corresponding server IP address.

  2. Connect to the server to complete the HTTP request or RTMP handshake;

  3. Receive the data sent by the server, unpack the protocol, and get the audio and video data decoded and played.

Any problem in any link may lead to playback failure. Different protocols, due to protocol layer reasons, often have different playback errors. The following discussion mainly focuses on RTMP/HTTP, assuming the normal broadcast test address is as follows: rtmp://live.hkstv.hk.lxdns.com/live/hks W3C School test mp4 flow: www.w3school.com.cn/i/movie.mp4

Domain name resolution failure

If the domain name of the broadcast address cannot be resolved, the broadcast will fail. Generally, the network is disconnected or the domain name is invalid.

$ffplay rtmp://live.hkstv.hk.lxdns.com1/live/hks
Failed to resolve hostname live.hkstv.hk.lxdns.com1: nodename nor servname provided, or not known
Failed to resolve hostname live.hkstv.hk.lxdns.com1: No address associated with hostnameCopy the code

Of course, if there is a network, but the resolution of the domain name fails, the general ISP may return some pages like 404, or jump to another default page, therefore, for HLS, HTTP-FLV, http-MP4 and other streams, will return some other errors because of “dirty data”, such as:

$ ffplay http://www.w3school2.com.cn1/i/movie.m3u8
http://www.w3school2.com.cn1/i/movie.m3u8: Operation timed out

$ ffplay http://www.w3school2.com.cn1/i/movie.mp4
http://www.w3school2.com.cn1/i/movie.mp4: Invalid data found when processing inputCopy the code

If this error occurs, you can ping the domain name to check whether the ping succeeds. If the ping fails, you may need to check the configuration of domain name resolution.

Server connection failure

If domain name correctly, and have a network connection state, mostly can parse out the server IP address normally, but there was the possibility of connection fails, for example, the server of the corresponding service to hang out, or does not provide service in the corresponding port, resulting in player connection fails, an error similar problem are as follows:

$ ffplay rtmp://www.jhuster.com/live/hks
Cannot open connection tcp://www.jhuster.com:1935
rtmp://www.jhuster.com/live/hks: Operation timed outCopy the code

Because the server corresponding to www.jhuster.com does not provide the RTMP pull stream service, connecting to the server through 1935 will fail.

$ ffplay https://www.w3school.com.cn/i/movie.mp4
Connection to tcp://www.w3school.com.cn:443 failed: Connection refusedCopy the code

Because www.w3school.com.cn does not support HTTPS access, a request for an HTTPS connection through interface 443 failed.

Of course, it is also possible that this server is down although it provides RTMP pull stream service. Therefore, we need to use dig command to determine which server is finally accessed, and check why the server cannot be connected. Of course, it is best to modify the source code of FFpMEG. Print the resolved server IP address so that you can see directly the address of the connected server.

The requested resource does not exist

For HTTP protocol broadcast address, the requested playback resource does not exist, the return error is relatively fast, such as:

$ ffplay http://jhuster.com/live/hks.mp4
http://jhuster.com/live/hks.mp4: Server returned 404 Not Found
$ ffplay http://www.w3school2.com.cn/i/movie2.mp4
http://www.w3school2.com.cn/i/movie2.mp4: Invalid data found when processing inputCopy the code

Note: It is possible to return this error because of reading “dirty data” from the jump page returned by the ISP.

The data requested by the player is not necessarily “stored” on the server. Therefore, the server cannot simply use the URI to locate the data and return 404. The data may be stored after the RTMP handshake. The resource is generated gradually at the production end and forwarded by the server to the client. Therefore, it is difficult to simply say that the resource does not exist.

If the RTMP stream is not pushed, the player will return an error only after the read data times out.

$ ffplay rtmp://live.hkstv.hk.lxdns.com/live/hks1
rtmp://live.hkstv.hk.lxdns.com/live/hks1: Input/output errorCopy the code

An unsupported format

There are many network protocols, encoding formats and encapsulation formats used for video stream, such as HTTP/HTTPS/RTMP/RTSP, etc., encoding formats such as H.264, MPEG4, AAC, SPEex, etc., and encapsulation formats such as FLV, MP4, AVI, RMVB, etc. Streams of these protocols and formats need to be specially supported by the player. Therefore, if the player encounters an unsupported protocol or format, it will also fail to play, as shown below:

https://www.jhuster.com/xxxx.mp4 Protocol not found
https://www.jhuster.com/xxxx.rmvb Invalid data found when processing inputCopy the code

Only audio without video, or only video without audio

There are several possible reasons for this error:

  1. The audio/video encoding format is not supported, resulting in decoding failure
  2. The audio/video data content is abnormal, causing decoding failure
  3. Ffmpeg based playerprobesizeThe setting is too small, causing insufficient parsing stream information. Procedure
  4. The first half of the stream/file itself has only audio and no video, or only video and no audio

The process of starting the playback of this problem has been completed, but the picture or audio is missing, which is also a kind of playback failure. Limited by the length of this paper, special chapters will be selected to analyze this problem later.

Other playback failed

In fact, there are many reasons for the playback failure. It is impossible to list them all here. However, through the error of FFplay, it is possible to know the probable cause, and then debugging together with the server, the root cause can generally be found. Here are some common ffMPEG errors: ffmpeg.org/doxygen/tru…


The author of this article: Lu Jun@Qiniuyun. If you have questions that you are interested in, but are not on the above list, you can also write to [email protected] and follow @lu _ Jun on Sina Weibo or @jhuster on wechat to get the latest articles and information.