A common issue faced when retransmitting HLS streams to broadcasting networks, such as satellite, cable, terrestrial, or UDP multicast, is the occurrence of various artifacts like pixelation, sound drifts, and clicks. Interestingly, these streams perform well when played on a PC. Often, engineers place the blame on the headend manufacturer; however, to truly understand the root of the problem, it is essential to examine the characteristics of video encoding.
Video Encoding is the process of compressing video data for efficient storage and transmission. Video streams are split into frames:
The delivery of each frame within a specific timeframe is crucial for ensuring smooth playback and proper synchronization of audio and video in broadcasting networks. To achieve this, video streams must be encoded with a higher average bitrate to maintain a predictable and uniform bitrate. Balancing the GOP size and encoding quality is essential for maintaining a consistent bitrate and achieving optimal visual quality in video streams intended for broadcasting purposes.
In contrast to broadcasting networks, HLS (HTTP Live Streaming) handles variable bitrates more effectively, as data is transmitted in segments containing multiple seconds of video (typically 3 seconds or more). As a result, HLS can handle larger GOP sizes, achieving better video quality with a lower average bitrate.
The chart illustrates that the Stream encoded for HLS has a low average bitrate of only 2 Mbps, but it also has peaks reaching up to 6 Mbps.
HLS flexibility does not translate well to broadcasting networks, which require a consistent and predictable bandwidth for stable transmission and playback. Thus, when working with HLS streams and broadcasting systems, it is essential to consider the differences in bitrate requirements and adjust encoding parameters accordingly to ensure stable transmission and playback.
Bitrate peaks can also pose problems for UDP broadcasting. Most consumer devices, such as set-top boxes (STBs) and TVs, have limited network buffers for receiving UDP packets. When many packets arrive in a short time due to bitrate peaks, the device's network buffer may become overwhelmed, resulting in packet loss.
For streams with moderate bitrate deviation, you can enable the CBR (Constant Bitrate) feature in Astra's output settings. This feature helps distribute large keyframes over time and appends empty TS packets to maintain a consistent bitrate.
However, for some streams, transcoding may be necessary to adapt them for broadcasting. Consider the following adjustments to ensure better compatibility with broadcasting networks: