Troubleshooting
We will update this document as we gather troubleshooting examples. (Written in Nov 04, 2021)
prerequisites.sh
Script Failed
prerequisites.sh
Script FailedIf you have problems with the prerequisites.sh
the script we have provided, please install it manually as follows.
Platform Specific Installation
Common Installation
systemctl start ovenmediaengine
failed
systemctl start ovenmediaengine
failedCheck SELinux
If SELinux is running on your system, SELinux can deny the execution of OvenMediaEngine.
You can choose between two methods of adding a policy to SELinux or setting SELinux to permissive mode. To add a policy, you must apply the SELinux policy file for the OvenMediaEngine service to your system as follows:
Setting SELinux to permissive mode is as simple as follows. But we don't recommend this method.
Streaming is not smooth
1. If you are using Transcoding as Bypass in OvenMediaEngine, and streaming does not work in all players
WebRTC does not support b-frame of H.264. But if your encoder sends b-frames the video will be stuttered in the player. In this case, you can solve the problem by disabling the b-frame function in your encoder. For OBS, you can set bframes=0 option as below.
Or by activating the encoding options in OvenMediaEngine.
Setting up Transcoding options in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/transcoding#encodes
2. When streaming does not work in some players
In this case, you are probably trying to stream with UDP in an environment where packet loss is high due to network performance, connection problems, etc., the interruption during stream playback may more and more worsen. This problem can be solved simply by playing with WebRTC/TCP.
If you want to monitor packet loss in your Chrome browser, you can access it by typing 'chrome://webrtc-internals' in the address bar.
Setting up WebRTC over TCP in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/streaming/webrtc-publishing#webrtc-over-tcp
Also, if the device's network speed, which is running the player, isn't fast enough to accommodate the stream's BPS, the stuttering during streaming won't resolve and will eventually drop the connection. In this case, there is no other way than to speed up your network.
3. When streaming fails due to excessive CPU/Memory/Network usage of Origin in OvenMediaEngine
If the Origin server uses excessive CPU/Memory/Network, all players may experience stuttering during streaming.
When you see Origin is CPU intensive on your Origin-Edge structure, the transcoding options in the OvenMediaEngine may be the primary cause. That is, you may have set the quality of the input stream too high, or the output stream to exceed the capabilities of your hardware significantly. In this case, it can be solved by enabling the hardware encoder in OvenMediaEngine.
Setting up GPU Acceleration in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/transcoding/gpu-usage
4. When streaming fails due to excessive CPU/Memory/Network usage of Edge in OvenMediaEngine
If the edge server excessively uses CPU/Memory/Network, the player connected to that Edge may experience stuttering during streaming. In this case, it can be solved by expanding Edge.
5. If you have enough CPU/Memory/Network, but streaming is not smooth
5-1. When a specific thread is using the CPU excessively
When you see a specific thread overuses the CPU, the video may not stream smoothly. Please refer to the manual below for more information on this.
Tuning OvenMediaEngine Performance: https://airensoft.gitbook.io/ovenmediaengine/performance-tuning#performance-tuning
5-2. Tuning your Linux kernel
The Linux kernel, which is set by default, cannot handle 1Gbps output, so put it as follows:
5-3. Congestion Control: Change to BBR
The mobile environment used by many people uses a wireless network. It has a high network speed but, conversely, can cause high packet loss.
Look, CUBIC, the Congestion Control set by default in your Linux, adjusts the TCP Window by packet loss, so it is not suitable to provide stable streaming in such an environment.
So our suggestion is to use Google's BBR. This setting is even more important if you mainly provide WebRTC services to mobile users who use a wireless network. Change the Congestion Control from CUBIC to BBR on your Linux.
Player connection fails
1. Due to the Mixed Contents
If you try to access OvenMediaEngine's WebRTC URL starting with ws:// (Non-TLS) from an HTTPS (HTTP/TLS) site, the connection may be rejected due to a mixed content problem depending on the browser.
In this case, you can solve this by installing a certificate in OvenMediaEngine and trying to connect with the wss:// (WebSocket/TLS) URL.
Setting up TLS Encryption in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/streaming/tls-encryption
2. Due to a Cross-Origin Resource Sharing (CORS) Error
As of October 2021, most browsers have enforced the CORS policy, and CORS errors often occur when requesting access to other domains if it is not a TLS site. In this case, you can solve the problem by installing a certificate on the site that loads the player.
3. When the message "Too many open files" appears in the log, the player cannot connect
At some point, when the message "Too many open files" is output in your OvenMediaEngine log, it may not be able to handle any more player connections. In this case, you can solve the problem by setting it as follows:
Player takes a long time first to load while trying to stream
1. Due to the Keyframe Interval
If you use Transcoding as Bypass in OvenMediaEngine and set a long keyframe interval in the encoder, the WebRTC player cannot start streaming until a keyframe is an input.
In this case, you can solve this by setting the keyframe interval in the encoder to 1-2 seconds,
Or by enabling the encoding options in OvenMediaEngine.
Setting up Transcoding options in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/transcoding#encodes
A/V is out of sync
1. When the A/V sync does not match during initial streaming, and it gradually fits
A/V may not be input evenly from the encoder. There are some encoders with policies for reliable streaming that they decide, for example, sending audio first and video very later, or video first and audio very late.
OvenMediaEngine outputs the input received from the encoder as-is for sub-second latency streaming. The WebRTC player also streams the received input as-is, so the A/V sync may not match during the initial playback due to the policy of specific encoders.
However, this can be resolved naturally as the player will sync A/V while streaming based on Timestamp. Still, if this work looks like an error, you can also solve it by enabling JitterBuffer in OvenMediaEngine.
Also, suppose you are using a transcoder in OvenMediaEngine and trying to input with b-frames of H264. Audio is encoded fast, but a video is buffered at the decoder because of b-frames. Therefore, there is a time difference at the start of each encoding, which may cause the A/V to be out of sync. Even in this case, enabling JitterBuffer will solve this problem.
Setting up WebRTC JitterBuffer in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/streaming/webrtc-publishing#publisher
2. Time has passed, but A/V is out of sync
There may be cases where the A/V sync is not corrected even after a certain amount of time has elapsed after playback. This problem is caused by small internal buffers in some browsers such as Firefox, which causes the player to give up calibration if the A/V sync differs too much. But this can also be solved by enabling JitterBuffer.
Setting up WebRTC JitterBuffer in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/streaming/webrtc-publishing#publisher
Nevertheless, if the A/V sync is not corrected, you should suspect an error in the original video file, which can be checked by playing as HLS.
However, if A/V sync is well during streaming with HLS, this is OvenMediaEnigne's bug. If you find any bugs, please feel free to report them to OvenMediaEngine GitHub Issues.
No audio is output
1. When Opus is not set in the encoding options
WebRTC supports Opus, not AAC, as an audio codec. Because RTMP and other protocols mainly use and transmit AAC as the audio codec, you may not have set up Opus, but WebRTC cannot output audio without Opus. This can be solved by setting Opus in OvenMediaEnigne.
Setting up Opus Codec in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/transcoding#audio
Not the video quality you want
1. When video encoding is enabled in OvenMediaEngine
If you are using video encoding in OME, the video bitrate may be set low. In this case, the video quality can be improved by increasing the unit of video bitrate.
However, since OvenMediaEngine has the default to the fastest encoding option for sub-second latency streaming, the video quality may not be as good as the set video bitrate. In this case, OvenMediaEngine provides an output profile preset that can control the quality, so you can choose to solve it.
Choosing an Encoding Preset in OvenMediaEngine: https://airensoft.gitbook.io/ovenmediaengine/transcoding#video
2. If you are using Transcoding as Bypass in OvenMediaEngine
Since the encoder is transmitting video to OvenMediaEngine in low quality, you can solve it by increasing the input quality in the encoder settings.
Last updated